<data>
	<canvases>
		<!-- -->
		<!-- MAP SCREEN -->
		<!-- -->
		<canvasTemplate r_name="'mainExternalZone'" r_template="'mainCanvasTemplate'"
										r_graphic="'rngsdk.display.CdplSpriteSimple'"
										w_loaded="0">
			<canvas r_name="'externalMap'" r_template="'mainCanvasTemplate'"
							r_graphic="'rngsdk.display.CdplSpriteSimple'"
							r_graphicName="'externalMap'"
							dungeonTooltip="''"
							dungeonObjective="''"
							currentDungeonName="''"
							creationProgress="(exists(world.currentDungeon))?(world.currentDungeon.w_creationProgress):0"
							loadingBarWidth="min(250*globalParameters.screenScale,globalParameters.w_stageWidth*0.3)"
							loadingBarHeight="loadingBarWidth*48/250"
							tooltipWidth="(globalParameters.w_stageWidth-40-loadingBarWidth)/2">
				<canvas r_name="'hexs'"
								r_graphic="'vwMapHexes'"
								unscaledWidth="612+60+2*50"
								unscaledHeight="384+54+2*50"
								scale="min(globalParameters.w_stageWidth/unscaledWidth,globalParameters.w_stageHeight/unscaledHeight)"
								rw_xPos="(globalParameters.w_stageWidth-unscaledWidth*scale)/2+50*scale"
								rw_yPos="(globalParameters.w_stageHeight-unscaledHeight*scale)/2+25*scale"
								r_scaleX="scale"
								r_scaleY="scale">
					<canvas r_name="'dungeon0a'" r_template="'mainDungeonHex'" r_existingGraphic="'s_coordinate0a'"/>
					<canvas r_name="'dungeon1a'" r_template="'mainDungeonHex'" r_existingGraphic="'s_coordinate1a'"/>
					<canvas r_name="'dungeon1b'" r_template="'mainDungeonHex'" r_existingGraphic="'s_coordinate1b'"/>
					<canvas r_name="'dungeon2a'" r_template="'mainDungeonHex'" r_existingGraphic="'s_coordinate2a'"/>
					<canvas r_name="'dungeon2b'" r_template="'mainDungeonHex'" r_existingGraphic="'s_coordinate2b'"/>
					<canvas r_name="'dungeon2c'" r_template="'mainDungeonHex'" r_existingGraphic="'s_coordinate2c'"/>
					<canvas r_name="'dungeon3a'" r_template="'mainDungeonHex'" r_existingGraphic="'s_coordinate3a'"/>
					<canvas r_name="'dungeon3b'" r_template="'mainDungeonHex'" r_existingGraphic="'s_coordinate3b'"/>
					<canvas r_name="'dungeon3c'" r_template="'mainDungeonHex'" r_existingGraphic="'s_coordinate3c'"/>
					<canvas r_name="'dungeon3d'" r_template="'mainDungeonHex'" r_existingGraphic="'s_coordinate3d'"/>
					<canvas r_name="'dungeon4a'" r_template="'mainDungeonHex'" r_existingGraphic="'s_coordinate4a'"/>
					<canvas r_name="'dungeon4b'" r_template="'mainDungeonHex'" r_existingGraphic="'s_coordinate4b'"/>
					<canvas r_name="'dungeon4c'" r_template="'mainDungeonHex'" r_existingGraphic="'s_coordinate4c'"/>
					<canvas r_name="'dungeon5a'" r_template="'mainDungeonHex'" r_existingGraphic="'s_coordinate5a'"/>
					<canvas r_name="'dungeon5b'" r_template="'mainDungeonHex'" r_existingGraphic="'s_coordinate5b'"/>
					<canvas r_name="'dungeon6a'" r_template="'mainDungeonHex'" r_existingGraphic="'s_coordinate6a'"/>
				</canvas>
				
				<canvas r_name="'timeCanvas'" r_template="'mainCanvasTemplate'" r_graphic="'rngsdk.display.CdplSpriteSimple'" rw_yPos="10+32*globalParameters.UIScale">
					<picture r_name="'princess'" r_template="'mainPictureTemplate'" r_graphic="'princess.png'" r_visible="gameParameters.princessAlive&&(gameParameters.daysLeft==0)" rw_xPos="globalParameters.w_stageWidth-(15+24)*globalParameters.screenPixelScale" r_scaleX="globalParameters.screenPixelScale" r_scaleY="globalParameters.screenPixelScale"/>
					<loop r_name="'childrenLoop'" r_loopCondition="9>iLoop" r_loopStep="all({child.iLoop=iLoop,child.r_name=(child.r_name+iLoop++)})" iLoop="0">
						<picture r_name="'child'" r_template="'mainPictureTemplate'" r_visible="(gameParameters.childrenAlive>iLoop)&&(gameParameters.daysLeft==0)" iLoop="0" r_graphic="'kid.png'" rw_xPos="globalParameters.w_stageWidth-(25+16*(iLoop+2))*globalParameters.screenPixelScale" r_scaleX="globalParameters.screenPixelScale" r_scaleY="globalParameters.screenPixelScale"/>
					</loop>
					<loop r_name="'hourglassLoop'" r_loopCondition="7>iLoop" r_loopStep="all({child.iLoop=iLoop,child.r_name=(child.r_name+iLoop++)})" iLoop="0">
						<picture r_name="'hourglass'" r_template="'mainPictureTemplate'" r_visible="gameParameters.daysLeft>iLoop" iLoop="0" r_graphic="'Time.png'" rw_xPos="globalParameters.w_stageWidth-(15+24*(iLoop+1))*globalParameters.screenPixelScale" r_scaleX="globalParameters.screenPixelScale" r_scaleY="globalParameters.screenPixelScale"/>
					</loop>
					<text r_name="'spendDays'" r_template="'mainTextFieldTemplate'" r_graphicName="'daysText'" r_text="text.day+' '+(gameParameters.spendDays+1)" rw_xPos="globalParameters.w_stageWidth-210" r_width="200" r_height="w_textHeight+4" rw_yPos="10+32*globalParameters.screenPixelScale" textSize="14*globalParameters.screenPixelScale" r_align="'right'" r_textColor="16777215"/>
				</canvas>
				
				<canvas r_name="'enterButton'" r_template="'capsuleSimpleButtonTemplate'"
								r_visible="creationProgress==0"
								capsuleText="text.enterDungeon"
								rw_xPos="tooltipWidth+20"
								rw_yPos="globalParameters.w_stageHeight-10-capsuleHeight"
								capsuleWidth="loadingBarWidth"
								capsuleHeight="loadingBarHeight"
								scale="globalParameters.screenScale"
								dungeonAccessible="(currentDungeonName!='')&&(world.attributeByName(currentDungeonName).accessible)"
								activation="selection||dungeonAccessible"
								selection="exists(world.currentDungeon)">
					<button r_name="'capsuleButton'">
						<effect r_name="'enterDungeon'" r_template="'enterDungeonTemplate'" r_enabled="!isPaused&&!exists(world.currentDungeon)&&dungeonAccessible" dungeonName="currentDungeonName"/>
						<effect r_name="'refresh'" r_template="'mainGraphicEffectTemplate'" r_type="'LocalRefresh'" r_refreshTarget="'map'"/>
					</button>
				</canvas>
				<canvas r_name="'mapMessage'" r_template="'mainCanvasTemplate'"
								r_graphic="'rngsdk.display.CdplSpriteSimple'"
								r_visible="gameParameters.mapMessage!=''">
					<button r_name="'mapMessageButton'" r_template="'mainButtonTemplate'"
									r_enabled="gameParameters.mapMessage!=''"
									r_graphic="'vwInvisibleLayer'"
									r_keys="'any'"
									r_width="globalParameters.w_stageWidth"
									r_height="globalParameters.w_stageHeight">
						<effect r_name="'close'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_effect="gameParameters.mapMessage=''"/>
						<effect r_name="'graphicRefresh'" r_template="'mainGraphicEffectTemplate'" r_type="'LocalRefresh'" r_refreshTarget="'mapMessage'"/>
						<effect r_name="'finalDungeon'" r_template="'enterDungeonTemplate'" r_enabled="!gameParameters.princessAlive" dungeonName="'finalBattle'"/>
					</button>
					<canvas r_name="'mapMessageText'" r_template="'capsuleDarkTextTemplate'"
									capsuleText="gameParameters.mapMessage"
									rw_xPos="(globalParameters.w_stageWidth-capsuleWidth)/2"
									rw_yPos="(globalParameters.w_stageHeight-capsuleHeight)/2"
									capsuleWidth="max(300*globalParameters.screenScale,globalParameters.w_stageWidth*0.5)"
									capsuleHeight="200*globalParameters.screenScale"
									scale="globalParameters.screenScale">
						<text r_name="'capsuleText'" r_wordWrap="1" textSize="18*globalParameters.screenScale"/>
					</canvas>
				</canvas>
				<canvas r_name="'progressBar'" r_template="'mainCanvasTemplate'" r_graphic="'vwProgressBar'" r_visible="creationProgress>0" rw_xPos="tooltipWidth+20" rw_yPos="globalParameters.w_stageHeight-10-50*globalParameters.screenScale" r_width="loadingBarWidth" r_scaleX="globalParameters.screenScale" r_scaleY="globalParameters.screenScale">
					<picture r_name="'bar'" r_template="'mainPictureTemplate'" r_existingGraphic="'s_bar'" r_width="w_initialWidth*creationProgress">
						<event r_name="'creationProgress'" r_template="'mainEventTemplate'" r_enabled="exists(world.currentDungeon)" r_eventTarget="'world.currentDungeon.w_creationProgress'" r_targetType="'attribute'">
							<effect r_name="'graphicRefresh'" r_template="'mainGraphicEffectTemplate'" r_type="'LocalRefresh'" r_refreshTarget="'progressBar'"/>
							<event r_name="'currentDungeonUpdate'" r_template="'mainEventTemplate'" r_eventTarget="'world.currentDungeon'" r_targetType="'evaluator'">
								<effect r_name="'eventRefresh'" r_template="{'mainSelfEffectTemplate','utilityEffect'}" r_className="'CutiEffectRefreshHierarchy'" r_refreshTarget="'creationProgress'"/>
							</event>
						</event>
					</picture>
				</canvas>
				<text r_name="'loadingText'" r_template="'mainTextFieldTemplate'" r_visible="creationProgress>0" r_align="'center'" r_text="text.loading" r_width="loadingBarWidth" rw_xPos="tooltipWidth+20" rw_yPos="globalParameters.w_stageHeight-10-(50*globalParameters.screenScale+w_textHeight+6)/2" textSize="12*globalParameters.screenScale"/>
				<picture r_name="'tipsBackground'" r_template="'mainPictureTemplate'" r_graphic="'vwBlackLayer'" r_alpha="0.8" r_visible="creationProgress>0" rw_xPos="0" rw_yPos="globalParameters.w_stageHeight-30-140*globalParameters.screenScale" r_width="globalParameters.w_stageWidth" r_height="50*globalParameters.screenScale"/>
				<text r_name="'tipsText'" r_template="'mainTextFieldTemplate'" r_visible="creationProgress>0" r_textColor="16777215" r_align="'center'" r_text="randomElement(text.randomTips)" rw_xPos="50*globalParameters.screenScale" rw_yPos="globalParameters.w_stageHeight-30-140*globalParameters.screenScale" r_width="globalParameters.w_stageWidth-100*globalParameters.screenScale" r_height="50*globalParameters.UIScale" textSize="12*globalParameters.screenScale" r_wordWrap="1"/>
				
				<canvas r_name="'tooltip'" r_template="'capsuleDarkTextTemplate'" r_graphicName="'dungeonTooltip'" capsuleWidth="tooltipWidth" capsuleHeight="100*globalParameters.screenScale" rw_xPos="10" rw_yPos="globalParameters.w_stageHeight-10-100*globalParameters.screenScale" capsuleText="dungeonTooltip" scale="globalParameters.screenScale">
					<text r_name="'capsuleText'" textSize="18*globalParameters.screenScale"/>
				</canvas>
				<canvas r_name="'objective'" r_template="'capsuleDarkTextTemplate'" r_graphicName="'dungeonObjective'" capsuleWidth="tooltipWidth" capsuleHeight="100*globalParameters.screenScale" rw_xPos="globalParameters.w_stageWidth-10-tooltipWidth" rw_yPos="globalParameters.w_stageHeight-10-100*globalParameters.screenScale" capsuleText="dungeonObjective" scale="globalParameters.screenScale">
					<text r_name="'capsuleText'" textSize="18*globalParameters.screenScale"/>
				</canvas>					
				<!-- Menu -->
				<button r_name="'menu'" r_template="'mainButtonTemplate'" r_keys="{'ESCAPE','BACK'}" r_enabled="!w_isInDungeon&&((isLeftCSOpen||isRightCSOpen||isTopCSOpen)||(isMenuOpen==isPaused))">
					<effect r_name="'openCloseMenu'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_enabled="!(isLeftCSOpen||isRightCSOpen||isTopCSOpen)&&(isMenuOpen==isPaused)" r_effect="all({isMenuOpen=!isMenuOpen,isPaused=!isPaused})"/>
					<effect r_name="'CloseLeftCS'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_enabled="isLeftCSOpen" r_effect="all({isLeftCSOpen=0})"/>
					<effect r_name="'CloseRightCS'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_enabled="isRightCSOpen" r_effect="all({isRightCSOpen=0})"/>
					<effect r_name="'CloseTopCS'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_enabled="isTopCSOpen" r_effect="all({isTopCSOpen=0})"/>
				</button>
			</canvas>
		</canvasTemplate>
		
		<!-- dungeon Hex template -->
		<canvasTemplate r_name="'mainDungeonHex'" r_template="'mainCanvasTemplate'"
										hexDungeon="hexDungeon=world.attributeByName(dungeonName)"
										dungeonVisible="hexDungeon.visible"
										dungeonAccessible="hexDungeon.accessible"
										dungeonName="r_name">
			<button r_name="'mainDungeonButton'" r_template="'mainButtonTemplate'" rw_xPos="-61" rw_yPos="-55" r_enabled="dungeonAccessible" r_graphic="(hexDungeon.victory)?'HexCompleted.png':(dungeonAccessible?'HexAccessible.png':'HexUnexplored.png')">
				<effect r_name="'setTooltip'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_effect="all({currentDungeonName=dungeonName,dungeonTooltip=hexDungeon.completeTooltip,dungeonObjective=hexDungeon.completeObjective})"/>
				<effect r_name="'refresh'" r_template="'mainGraphicEffectTemplate'" r_type="'LocalRefresh'" r_refreshTarget="'map'"/>
			</button>
			<picture r_name="'dungeonSelected'" r_template="'mainPictureTemplate'" rw_xPos="-61" rw_yPos="-55" r_visible="dungeonVisible&&(currentDungeonName==dungeonName)" r_graphic="'HexSelected'"/>
			<picture r_name="'dungeonGraphic'" r_template="'mainPictureTemplate'" rw_xPos="-61" rw_yPos="-55" r_visible="dungeonVisible" r_graphic="hexDungeon.hexGraphic"/>
			<button r_name="'enterDungeonButton'" r_template="'mainButtonTemplate'" r_visible="dungeonAccessible&&r_enabled" r_enabled="!exists(world.currentDungeon)" r_graphic="text.pictureEnter" rw_xPos="-32" rw_yPos="25">
				<effect r_name="'setTooltip'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_effect="all({currentDungeonName=dungeonName,dungeonTooltip=hexDungeon.completeTooltip,dungeonObjective=hexDungeon.completeObjective})"/>
				<effect r_name="'enterDungeon'" r_template="'enterDungeonTemplate'"/>
				<effect r_name="'refresh'" r_template="'mainGraphicEffectTemplate'" r_type="'LocalRefresh'" r_refreshTarget="'map'"/>
			</button>
		</canvasTemplate>
	</canvases>
</data>