Differential D3243 Diff 16284 binaries/data/mods/public/gui/gamesetup/Pages/AIConfigPage/AIConfigPage.js
Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesetup/Pages/AIConfigPage/AIConfigPage.js
Show All 19 Lines | for (let name of this.AIGameSettingControlOrder) | ||||
this.AIGameSettingControls[name] = | this.AIGameSettingControls[name] = | ||||
new AIGameSettingControls[name](this, undefined, undefined, setupWindow); | new AIGameSettingControls[name](this, undefined, undefined, setupWindow); | ||||
this.aiDescription = new AIDescription(this, setupWindow); | this.aiDescription = new AIDescription(this, setupWindow); | ||||
this.aiConfigPage = Engine.GetGUIObjectByName("aiConfigPage"); | this.aiConfigPage = Engine.GetGUIObjectByName("aiConfigPage"); | ||||
Engine.GetGUIObjectByName("aiConfigOkButton").onPress = this.closePage.bind(this); | Engine.GetGUIObjectByName("aiConfigOkButton").onPress = this.closePage.bind(this); | ||||
this.gameSettingsControl.registerGameAttributesBatchChangeHandler( | g_NewGameSettings.playerAI.watch(() => this.maybeClose(), ["values"]); | ||||
this.onGameAttributesBatchChange.bind(this)); | |||||
} | } | ||||
registerOpenPageHandler(handler) | registerOpenPageHandler(handler) | ||||
{ | { | ||||
this.openPageHandlers.add(handler); | this.openPageHandlers.add(handler); | ||||
} | } | ||||
getRow() | getRow() | ||||
{ | { | ||||
return this.row++; | return this.row++; | ||||
} | } | ||||
openPage(playerIndex) | openPage(playerIndex) | ||||
{ | { | ||||
this.playerIndex = playerIndex; | this.playerIndex = playerIndex; | ||||
for (let handler of this.openPageHandlers) | for (let handler of this.openPageHandlers) | ||||
handler(playerIndex); | handler(playerIndex); | ||||
this.aiConfigPage.hidden = false; | this.aiConfigPage.hidden = false; | ||||
} | } | ||||
onGameAttributesBatchChange() | maybeClose() | ||||
{ | { | ||||
let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex); | if (!g_NewGameSettings.playerAI.get(this.playerIndex)) | ||||
if (!pData) | |||||
this.closePage(); | this.closePage(); | ||||
} | } | ||||
closePage() | closePage() | ||||
{ | { | ||||
this.aiConfigPage.hidden = true; | this.aiConfigPage.hidden = true; | ||||
} | } | ||||
} | }; | ||||
SetupWindowPages.AIConfigPage.prototype.AIGameSettingControlOrder = [ | SetupWindowPages.AIConfigPage.prototype.AIGameSettingControlOrder = [ | ||||
"AISelection", | "AISelection", | ||||
"AIDifficulty", | "AIDifficulty", | ||||
"AIBehavior" | "AIBehavior" | ||||
]; | ]; |
Wildfire Games · Phabricator