<data>
	<canvases>
		<!-- -->
		<!-- MAIN SCREENS -->
		<!-- -->
		<!-- template -->
		<canvas r_name="'gameScreenTemplate'" r_template="'mainCanvasTemplate'"
						screenName="r_name"
						r_graphic="'rngsdk.display.CdplSpriteSimple'"
						w_isInDungeon="0"
						isPaused="0"
						isSettingsOpen="0"
						isKeyBindingsOpen="0"
						isMenuOpen="0"
						externalCSOpening="''"
						externalCSSelection="-1"
						globalHMISelection="-1"
						isLeftCSOpen="0"
						isRightCSOpen="0"
						isTopCSOpen="0"
						currentLeftCharacterSheet="''"
						currentRightCharacterSheet="''"
						mainTooltip="''"
						secondaryTooltip="''"
						miniTooltip="''"
						specialActionYPos="0"
						potionBarVisible="0"
						permanentBarVisible="0"
						lootMenuVisible="0">
			<canvas r_name="'HMI'" r_template="'dungeonZoneHMI'" r_graphicName="'HMI'" r_visible="w_isInDungeon"/>
			<canvas r_name="'buttonsCanvas'" r_template="'characterSheetButtonsCanvas'"/>
			<canvas r_name="'heroHMI'" r_template="'heroHMICanvas'"/>	
			<canvas r_name="'characterSheet'" r_template="'mainCharacterSheetCanvas'"/>
			<canvas r_name="'gameMenu'" r_template="'gameMenu'"/>
			<canvas r_name="'notification'" r_template="'mainNotification'"/>
			<canvas r_name="'settings'" r_template="'settings'" isScreen="0" r_visible="isSettingsOpen"/>
			<canvas r_name="'keyBindings'" r_template="'keyBindings'" r_visible="isKeyBindingsOpen"/>
			<canvas r_name="'Tooltip'" r_template="'TooltipHMI'"/>
			<canvas r_name="'miniTooltip'" r_template="'miniTooltipHMI'"/>
			
			<event r_name="'refresh'" r_template="'mainEventTemplate'" r_eventTarget="'w_isInDungeon'" r_targetType="'attribute'">
				<effect r_name="'graphicRefresh'" r_template="'mainGraphicEffectTemplate'" r_type="'LocalRefresh'"/>
			</event>
			<picture r_name="'savingMessage'" r_template="'mainPictureTemplate'" r_graphic="text.pictureSave" r_visible="gameParameters.w_isSaving" rw_xPos="(globalParameters.w_stageWidth-w_initialWidth*r_scaleX)/2" rw_yPos="(globalParameters.w_stageHeight-w_initialHeight*r_scaleY)/2" r_scaleX="globalParameters.UIScale" r_scaleY="globalParameters.UIScale">
				<event r_name="'isSaving'" r_template="'mainEventTemplate'" r_eventTarget="'gameParameters.w_isSaving'" r_targetType="'attribute'">
					<effect r_name="'graphicRefresh'" r_template="'mainGraphicEffectTemplate'" r_type="'LocalRefresh'"/>
				</event>
			</picture>
		</canvas>

		<canvasTemplate r_name="'TooltipHMI'" r_template="{'capsuleButtonTemplate','capsuleDarkTextTemplate'}"
										r_visible="globalParameters.showTooltip&&((mainTooltip!='')||(secondaryTooltip!=''))"
										capsuleWidth="globalParameters.w_stageWidth-2*rw_xPos"
										capsuleHeight="88*globalParameters.UIScale+5"
										rw_xPos="10+(10+44*globalParameters.UIScale)"
										rw_yPos="globalParameters.w_stageHeight-capsuleHeight-((mainTooltip!='')?(20+44*globalParameters.UIScale):5)"
										capsuleText="(mainTooltip!='')?mainTooltip:secondaryTooltip"
										capsuleEffect="all({mainTooltip='',secondaryTooltip=''})"
										centeredText="0">
			<text r_name="'capsuleText'" textSize="12*globalParameters.UIScale" r_autoReduceTextSize="1"/>
			<event r_name="'mainTooltipChange'" r_template="'mainEventTemplate'" r_eventTarget="'mainTooltip'" r_targetType="'attribute'">
				<effect r_name="'refresh'" r_template="'mainGraphicEffectTemplate'" r_type="'LocalRefresh'"/>
			</event>
			<event r_name="'secondaryTooltipChange'" r_template="'mainEventTemplate'" r_eventTarget="'secondaryTooltip'" r_targetType="'attribute'">
				<effect r_name="'refresh'" r_template="'mainGraphicEffectTemplate'" r_type="'LocalRefresh'"/>
			</event>
		</canvasTemplate>
		
		<canvasTemplate r_name="'miniTooltipHMI'" r_template="{'capsuleButtonTemplate','capsuleDarkTextTemplate'}"
										r_visible="globalParameters.showTooltip&&(miniTooltip!='')"
										capsuleWidth="200*globalParameters.UIScale"
										capsuleHeight="60*globalParameters.UIScale"
										rw_xPos="5"
										rw_yPos="specialActionYPos-60*globalParameters.UIScale-10"
										capsuleText="miniTooltip"
										capsuleEffect="miniTooltip=''"
										centeredText="0">
			<text r_name="'capsuleText'" textSize="12*globalParameters.UIScale" r_autoReduceTextSize="1"/>
			<event r_name="'miniTooltipChange'" r_template="'mainEventTemplate'" r_eventTarget="'miniTooltip'" r_targetType="'attribute'">
				<effect r_name="'refresh'" r_template="'mainGraphicEffectTemplate'" r_type="'LocalRefresh'"/>
			</event>
		</canvasTemplate>
		
		<!-- standard (with map) -->
		<canvas r_name="'gameScreen'" r_template="'gameScreenTemplate'">
			<canvas r_name="'map'" r_template="'mainExternalZone'" r_visible="!w_isInDungeon" r_viewIndex="-1"/>
		</canvas>
		
		<!-- mono dungeon (without map) -->
		<canvas r_name="'gameScreenMonoDungeon'" r_template="'gameScreenTemplate'"
						w_loaded="0"
						loadingBarWidth="min(250*globalParameters.screenScale,globalParameters.w_stageWidth*0.3)"
						creationProgress="(exists(world.currentDungeon))?(world.currentDungeon.w_creationProgress):0">
			<picture 	r_name="'loadingIcon'" r_template="'mainPictureTemplate'"
								r_visible="!w_isInDungeon"
								r_graphic="text.pictureLoading"
								rw_xPos="(globalParameters.w_stageWidth-w_initialWidth*r_scaleX)/2"
								rw_yPos="globalParameters.w_stageHeight/2-w_initialHeight*r_scaleY"
								r_scaleX="globalParameters.UIScale"
								r_scaleY="globalParameters.UIScale"
								r_viewIndex="-1"/>
			
			<canvas r_name="'progressBar'" r_template="'mainCanvasTemplate'"
							r_graphic="'vwProgressBar'"
							r_visible="!w_isInDungeon&&(creationProgress>0)"
							rw_xPos="(globalParameters.w_stageWidth-loadingBarWidth)/2"
							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="!w_isInDungeon" r_align="'center'" r_text="text.loading" r_width="loadingBarWidth" rw_xPos="(globalParameters.w_stageWidth-loadingBarWidth)/2" rw_yPos="globalParameters.w_stageHeight-10-(50*globalParameters.screenScale+w_textHeight+6)/2" textSize="10*globalParameters.screenScale"/>
			<picture r_name="'tipsBackground'" r_template="'mainPictureTemplate'" r_graphic="'vwBlackLayer'" r_alpha="0.8" r_visible="!w_isInDungeon" 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="!w_isInDungeon" 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="10*globalParameters.UIScale" r_wordWrap="1"/>

			<event r_name="'onLoad'" r_template="'mainEventTemplate'" r_eventTarget="'w_loaded'" r_targetType="'attribute'">
				<effect r_name="'enterDungeon'" r_template="'enterDungeonTemplate'" r_enabled="w_loaded&&!w_isInDungeon" dungeonName="world.nextDungeon"/>
			</event>
		</canvas>
		
		<!-- -->
		<!-- BUTTONS -->
		<!-- -->
		<canvas r_name="'characterSheetButtonsCanvas'" r_template="'mainCanvasTemplate'" r_graphic="'rngsdk.display.CdplSpriteSimple'" rw_yPos="5">
			<buttonTemplate r_name="'characterSheetButtonTemplate'" r_template="'mainButtonTemplate'"
											r_enabled="!isPaused"
											rw_xPos="globalParameters.w_stageWidth/2+r_scaleX*(((index>=0)?85:-80)+index*35)"
											r_scaleX="globalParameters.UIScale"
											r_scaleY="globalParameters.UIScale">
				<event r_name="'onMouseEvent'" r_template="'mainEventTemplate'" r_eventTarget="'w_userEvent'" r_targetType="'attribute'">
					<effect r_name="'rollOver'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_enabled="(w_userEvent=='ROLL_OVER')||(globalParameters.isMobile&&(w_userEvent=='MOUSE_DOWN'))" r_effect="mainTooltip=buttonTooltip"/>
					<effect r_name="'rollOut'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_enabled="(w_userEvent=='ROLL_OUT')||(w_userEvent=='MOUSE_UP')" r_effect="mainTooltip=''"/>
				</event>
			</buttonTemplate>
			<buttonTemplate r_name="'leftCharacterSheetButtonTemplate'" r_template="'characterSheetButtonTemplate'">
				<effect r_name="'opening'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_effect="(!isLeftCSOpen)?all({isLeftCSOpen=1,currentLeftCharacterSheet=canvasName}):((currentLeftCharacterSheet!=canvasName)?(currentLeftCharacterSheet=canvasName):(isLeftCSOpen=0))"/>
			</buttonTemplate>
			<buttonTemplate r_name="'rightCharacterSheetButtonTemplate'" r_template="'characterSheetButtonTemplate'">
				<effect r_name="'opening'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_effect="(!isRightCSOpen)?all({isRightCSOpen=1,currentRightCharacterSheet=canvasName}):((currentRightCharacterSheet!=canvasName)?(currentRightCharacterSheet=canvasName):(isRightCSOpen=0))"/>
			</buttonTemplate>
			<buttonTemplate r_name="'topCharacterSheetButtonTemplate'" r_template="'characterSheetButtonTemplate'">
				<effect r_name="'opening'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_effect="isTopCSOpen=!isTopCSOpen"/>
			</buttonTemplate>
			
			<button r_name="'skill'" r_template="'leftCharacterSheetButtonTemplate'" r_graphic="'RangedS.png'" index="-3" shortcutName="'S'" canvasName="'skill'" r_keys="globalParameters.keySkills" buttonTooltip="text.skillButtonTooltip"/>
			<button r_name="'log'" r_template="'topCharacterSheetButtonTemplate'" r_graphic="'LogS.png'" index="-2" shortcutName="'X'" canvasName="'log'" r_keys="globalParameters.keyCombatLog" buttonTooltip="text.combatLogButtonTooltip"/>
			<button r_name="'menu'" r_template="'characterSheetButtonTemplate'" r_graphic="'menu.png'" index="-1" buttonTooltip="text.menuButtonTooltip">
				<effect r_name="'openCloseMenu'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_enabled="isMenuOpen==isPaused" r_effect="all({isMenuOpen=!isMenuOpen,isPaused=!isPaused})"/>
			</button>
			
			<button r_name="'magic'" r_template="'rightCharacterSheetButtonTemplate'" r_graphic="'MagicS.png'" index="0" shortcutName="'M'" canvasName="'magic'" r_keys="globalParameters.keyMagic" buttonTooltip="text.magicButtonTooltip"/>
			<button r_name="'class'" r_template="'rightCharacterSheetButtonTemplate'" r_graphic="'ClassesS.png'" index="1" shortcutName="'C'" canvasName="'class'" r_keys="globalParameters.keyClasses" buttonTooltip="text.classeButtonTooltip"/>
			<button r_name="'inventory'" r_template="'rightCharacterSheetButtonTemplate'" r_graphic="'InventoryS.png'" index="2" shortcutName="'I'" canvasName="'inventory'" r_keys="globalParameters.keyInventory" buttonTooltip="text.inventoryButtonTooltip"/>
		</canvas>
		
		<!-- -->
		<!-- HERO HMI -->
		<!-- -->
		<canvas r_name="'heroHMICanvas'" r_template="'mainCanvasTemplate'"
						r_graphicName="'heroHMI'"
						r_visible="w_isInDungeon"
						r_graphic="'vwHeroStatFrame'"
						rw_xPos="(globalParameters.w_stageWidth-w_initialWidth*r_scaleX)/2"
						rw_yPos="0"
						r_scaleX="globalParameters.UIScale"
						r_scaleY="globalParameters.UIScale"
						r_mouseEnabled="1"
						w_userEvent=""
						frameWidth="w_initialWidth"
						frameHeight="w_initialHeight">
			<picture r_name="'barHP'" r_template="'mainPictureTemplate'"r_existingGraphic="'s_barHP'" r_width="max(0, min(1, heroes.@0.hitPoints/heroes.@0.maxHitPoints))*155"/>
			<picture r_name="'barFatigue'" r_template="'mainPictureTemplate'" r_existingGraphic="'s_barFatigue'" r_width="max(0, min(1, heroes.@0.fatigue/heroes.@0.maxExhaustion))*155"/>
			<picture r_name="'barExhaustion'" r_template="'mainPictureTemplate'" r_existingGraphic="'s_barExhaustion'" r_width="max(0, min(1, heroes.@0.exhaustion/heroes.@0.maxExhaustion))*155"/>
			
			<event r_name="'onHPRefresh'" r_template="'mainEventTemplate'" r_eventTarget="'heroes.@0.hitPoints'" r_targetType="'attribute'">
				<effect r_name="'graphicRefresh'" r_template="'mainGraphicEffectTemplate'" r_type="'LocalRefresh'"/>
			</event>
			<event r_name="'onMaxHPRefresh'" r_template="'mainEventTemplate'" r_eventTarget="'heroes.@0.maxHitPoints'" r_targetType="'attribute'">
				<effect r_name="'graphicRefresh'" r_template="'mainGraphicEffectTemplate'" r_type="'LocalRefresh'"/>
			</event>
			<event r_name="'onConstitutionRefresh'" r_template="'mainEventTemplate'" r_eventTarget="'heroes.@0.Constitution'" r_targetType="'attribute'">
				<effect r_name="'graphicRefresh'" r_template="'mainGraphicEffectTemplate'" r_type="'LocalRefresh'"/>
			</event>
			<event r_name="'onFatigueRefresh'" r_template="'mainEventTemplate'" r_eventTarget="'heroes.@0.fatigue'" r_targetType="'attribute'">
				<effect r_name="'graphicRefresh'" r_template="'mainGraphicEffectTemplate'" r_type="'LocalRefresh'"/>
			</event>
			<event r_name="'onExhaustionRefresh'" r_template="'mainEventTemplate'" r_eventTarget="'heroes.@0.exhaustion'" r_targetType="'attribute'">
				<effect r_name="'graphicRefresh'" r_template="'mainGraphicEffectTemplate'" r_type="'LocalRefresh'"/>
			</event>
			<event r_name="'onHeroDurableEffects'" r_template="'mainEventTemplate'" r_eventTarget="'heroes.@0.effects'" r_targetType="'evaluator'">
				<effect r_name="'graphicRefresh'" r_template="'mainGraphicEffectTemplate'" r_type="'LocalRefresh'"/>
			</event>
			<button r_name="'mouseCatcher'" r_template="'mainButtonTemplate'" r_graphic="'vwInvisibleLayer'" r_width="frameWidth" r_height="frameHeight">
				<event r_name="'onUserEvent'" r_template="'mainEventTemplate'" r_eventTarget="'w_userEvent'" r_targetType="'attribute'">
					<effect r_name="'rollOver'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_enabled="(w_userEvent=='ROLL_OVER')||(globalParameters.isMobile&&(w_userEvent=='MOUSE_DOWN'))" r_effect="mainTooltip=text.hitPointsTooltip"/>
					<effect r_name="'rollOut'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_enabled="(w_userEvent=='ROLL_OUT')||(w_userEvent=='MOUSE_UP')" r_effect="mainTooltip=''"/>
				</event>
			</button>
		</canvas>		
			
		<!-- -->
		<!-- GAME MENU -->
		<!-- -->
		<canvas r_name="'gameMenu'" r_template="'mainCanvasTemplate'" r_visible="isMenuOpen" gameMenuName="r_name">
			<button r_name="'background'" r_template="'mainButtonTemplate'" r_graphic="'vwBlackLayer'" r_alpha="0.4" rw_xPos="0" rw_yPos="0" r_width="globalParameters.w_stageWidth" r_height="globalParameters.w_stageHeight">
				<effect r_name="'graphicRefresh'" r_template="'mainGraphicEffectTemplate'" r_type="'LocalRefresh'" r_refreshTarget="gameMenuName"/>
				<effect r_name="'closeMenu'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_effect="all({isMenuOpen=0,isPaused=0})"/>
			</button>
			<canvas r_name="'verticalSizer'" r_template="'mainCanvasTemplate'"
							r_verticalSizer="230*globalParameters.UIScale"
							rw_yPos="(globalParameters.w_stageHeight-r_verticalSizer)/2">
				<canvasTemplate r_name="'menuButtonTemplate'" r_template="'capsuleSimpleButtonTemplate'"
												capsuleWidth="200*globalParameters.UIScale"
												capsuleHeight="50*globalParameters.UIScale"
												rw_xPos="(globalParameters.w_stageWidth-capsuleWidth)/2"
												scale="globalParameters.UIScale"/>
				<canvas r_name="'resume'" r_template="'menuButtonTemplate'" capsuleText="text.resume">
					<button r_name="'capsuleButton'">
						<event r_name="'isDown'">
							<effect r_name="'graphicRefresh'" r_refreshTarget="'gameMenu'"/>
						</event>
						<effect r_name="'closeMenu'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_effect="all({isMenuOpen=0,isPaused=0})"/>
					</button>
				</canvas>
				<canvas r_name="'settings'" r_template="'menuButtonTemplate'" capsuleText="text.settings">
					<button r_name="'capsuleButton'">
						<event r_name="'isDown'">
							<effect r_name="'graphicRefresh'" r_type="'Refresh'"/>
						</event>
						<effect r_name="'closeMenu'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_effect="all({isMenuOpen=0,isPaused=0})"/>
						<effect r_name="'openSettings'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_effect="all({isSettingsOpen=1,isPaused=1})"/>
					</button>
				</canvas>
				<canvas r_name="'keyBindings'" r_template="'menuButtonTemplate'" capsuleText="text.keyBindings">
					<button r_name="'capsuleButton'">
						<event r_name="'isDown'">
							<effect r_name="'graphicRefresh'" r_type="'Refresh'"/>
						</event>
						<effect r_name="'closeMenu'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_effect="all({isMenuOpen=0,isPaused=0})"/>
						<effect r_name="'openKeyBindings'" r_template="{'mainSelfEffectTemplate','evaluationEffect'}" r_effect="all({isKeyBindingsOpen=1,isPaused=1})"/>
					</button>
				</canvas>
				<canvas r_name="'gotoMainMenu'" r_template="'menuButtonTemplate'" capsuleText="text.mainMenu">
					<button r_name="'capsuleButton'">
						<effect r_name="'gotoMainMenu'" r_template="{'mainSelfEffectTemplate','controllerEffect'}" r_className="'CctlEffectQuitDungeon'" r_destination="'screen'" r_screen="'mainMenu'" r_resetDungeon="0"/>
					</button>
				</canvas>
			</canvas>
			<event r_name="'onMenu'" r_template="'mainEventTemplate'" r_eventTarget="'isMenuOpen'" r_targetType="'attribute'">
				<effect r_name="'graphicRefresh'" r_template="'mainGraphicEffectTemplate'" r_type="'LocalRefresh'"/>
			</event>
		</canvas>		
	</canvases>
</data>