Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/gamesetup/SetupWindow.js
/** | /** | ||||
* This class stores the GameSetupPage and every subpage that is shown in the gamesetup. | |||||
*/ | |||||
class SetupWindowPages | |||||
{ | |||||
} | |||||
/** | |||||
* The SetupWindow is the root class owning all other class instances. | * The SetupWindow is the root class owning all other class instances. | ||||
* The class shall be ineligible to perform any GUI object logic and shall defer that task to owned classes. | * The class shall be ineligible to perform any GUI object logic and shall defer that task to owned classes. | ||||
*/ | */ | ||||
class SetupWindow | class SetupWindow | ||||
{ | { | ||||
constructor(initData, hotloadData) | constructor(initData, hotloadData) | ||||
{ | { | ||||
if (!g_Settings) | if (!g_Settings) | ||||
Show All 15 Lines | constructor(initData, hotloadData) | ||||
// These class instances control central data and do not manage any GUI Object. | // These class instances control central data and do not manage any GUI Object. | ||||
this.controls = { | this.controls = { | ||||
"gameSettingsControl": gameSettingsControl, | "gameSettingsControl": gameSettingsControl, | ||||
"playerAssignmentsControl": playerAssignmentsControl, | "playerAssignmentsControl": playerAssignmentsControl, | ||||
"mapCache": mapCache, | "mapCache": mapCache, | ||||
"mapFilters": mapFilters, | "mapFilters": mapFilters, | ||||
"readyControl": readyControl, | "readyControl": readyControl, | ||||
"startGameControl": startGameControl | "startGameControl": startGameControl, | ||||
}; | |||||
// These class instances are interfaces to networked messages and do not manage any GUI Object. | |||||
this.networkControls = { | |||||
"netMessages": netMessages, | "netMessages": netMessages, | ||||
"gameRegisterStanza": | "gameRegisterStanza": | ||||
Engine.HasXmppClient() && | Engine.HasXmppClient() && | ||||
new GameRegisterStanza( | new GameRegisterStanza( | ||||
initData, this, netMessages, gameSettingsControl, playerAssignmentsControl, mapCache) | initData, this, netMessages, gameSettingsControl, playerAssignmentsControl, mapCache) | ||||
}; | }; | ||||
// These are the pages within the setup window that may use the controls defined above | // These are the pages within the setup window that may use the controls defined above | ||||
this.pages = { | this.pages = {}; | ||||
"loadingPage": new LoadingPage(netMessages), | for (let name in SetupWindowPages) | ||||
"gameSetupPage": new GameSetupPage(this, gameSettingsControl, playerAssignmentsControl, netMessages, this.networkControls.gameRegisterStanza, mapCache, mapFilters, startGameControl, readyControl) | this.pages[name] = new SetupWindowPages[name](this); | ||||
}; | |||||
setTimeout(displayGamestateNotifications, 1000); | setTimeout(displayGamestateNotifications, 1000); | ||||
Engine.GetGUIObjectByName("setupWindow").onTick = updateTimers; | Engine.GetGUIObjectByName("setupWindow").onTick = updateTimers; | ||||
// This event is triggered after all classes have been instantiated and subscribed to each others events | // This event is triggered after all classes have been instantiated and subscribed to each others events | ||||
for (let handler of this.loadHandlers) | for (let handler of this.loadHandlers) | ||||
handler(initData, hotloadData); | handler(initData, hotloadData); | ||||
▲ Show 20 Lines • Show All 55 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator