Differential D3243 Diff 16276 binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameDescription.js
Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameDescription.js
class GameDescription | class GameDescription | ||||
{ | { | ||||
constructor(setupWindow, gameSettingTabs) | constructor(setupWindow, gameSettingTabs) | ||||
{ | { | ||||
this.mapCache = setupWindow.controls.mapCache; | this.mapCache = setupWindow.controls.mapCache; | ||||
this.gameDescriptionFrame = Engine.GetGUIObjectByName("gameDescriptionFrame"); | this.gameDescriptionFrame = Engine.GetGUIObjectByName("gameDescriptionFrame"); | ||||
this.gameDescription = Engine.GetGUIObjectByName("gameDescription"); | this.gameDescription = Engine.GetGUIObjectByName("gameDescription"); | ||||
setupWindow.controls.gameSettingsControl.registerGameAttributesBatchChangeHandler(this.onGameAttributesBatchChange.bind(this)); | |||||
gameSettingTabs.registerTabsResizeHandler(this.onTabsResize.bind(this)); | gameSettingTabs.registerTabsResizeHandler(this.onTabsResize.bind(this)); | ||||
this.registerWatchers(); | |||||
this.updateGameDescription(); | |||||
} | |||||
registerWatchers() | |||||
{ | |||||
let update = () => this.updateGameDescription(); | |||||
g_NewGameSettings.biome.watch(update, ["biome"]); | |||||
g_NewGameSettings.ceasefire.watch(update, ["value"]); | |||||
g_NewGameSettings.cheats.watch(update, ["enabled"]); | |||||
g_NewGameSettings.disableTreasures.watch(update, ["enabled"]); | |||||
g_NewGameSettings.lastManStanding.watch(update, ["enabled"]); | |||||
g_NewGameSettings.lockedTeams.watch(update, ["enabled"]); | |||||
g_NewGameSettings.map.watch(update, ["map", "type"]); | |||||
g_NewGameSettings.mapExploration.watch(update, ["explored"]); | |||||
g_NewGameSettings.mapExploration.watch(update, ["revealed"]); | |||||
g_NewGameSettings.nomad.watch(update, ["enabled"]); | |||||
g_NewGameSettings.population.watch(update, ["perPlayer", "cap", "useWorldPop"]); | |||||
g_NewGameSettings.rating.watch(update, ["enabled"]); | |||||
g_NewGameSettings.regicideGarrison.watch(update, ["enabled"]); | |||||
g_NewGameSettings.relic.watch(update, ["count", "duration"]); | |||||
g_NewGameSettings.startingResources.watch(update, ["perPlayer", "resources"]); | |||||
g_NewGameSettings.triggerDifficulty.watch(update, ["value"]); | |||||
g_NewGameSettings.victoryConditions.watch(update, ["active"]); | |||||
g_NewGameSettings.wonder.watch(update, ["duration"]); | |||||
} | } | ||||
onTabsResize(settingsTabButtonsFrame) | onTabsResize(settingsTabButtonsFrame) | ||||
{ | { | ||||
let size = this.gameDescriptionFrame.size; | let size = this.gameDescriptionFrame.size; | ||||
size.top = settingsTabButtonsFrame.size.bottom + this.Margin; | size.top = settingsTabButtonsFrame.size.bottom + this.Margin; | ||||
this.gameDescriptionFrame.size = size; | this.gameDescriptionFrame.size = size; | ||||
} | } | ||||
onGameAttributesBatchChange() | updateGameDescription() | ||||
{ | { | ||||
this.gameDescription.caption = getGameDescription(this.mapCache); | this.gameDescription.caption = getGameDescription(this.mapCache); | ||||
} | } | ||||
} | } | ||||
GameDescription.prototype.Margin = 3; | GameDescription.prototype.Margin = 3; |
Wildfire Games · Phabricator