Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/loadgame/SavegamePage.js
/** | /** | ||||
* This class architecture is an example of how to use classes | |||||
* to encapsulate and to avoid fragmentation and globals. | |||||
*/ | |||||
var g_SavegamePage; | |||||
function init(data) | |||||
{ | |||||
g_SavegamePage = new SavegamePage(data); | |||||
} | |||||
/** | |||||
* This class is responsible for loading the affected GUI control classes, | * This class is responsible for loading the affected GUI control classes, | ||||
* and setting them up to communicate with each other. | * and setting them up to communicate with each other. | ||||
*/ | */ | ||||
class SavegamePage | class SavegamePage | ||||
Stan: I guess we should take the warnings into account? | |||||
Done Inline ActionsI think this is spurious but yeah sure. wraitii: I think this is spurious but yeah sure. | |||||
{ | { | ||||
constructor(data) | constructor(data) | ||||
{ | { | ||||
this.savegameList = new SavegameList(); | this.savegameList = new SavegameList(data && data.campaignRun || null); | ||||
this.savegameDetails = new SavegameDetails(); | this.savegameDetails = new SavegameDetails(); | ||||
this.savegameList.registerSelectionChangeHandler(this.savegameDetails); | this.savegameList.registerSelectionChangeHandler(this.savegameDetails); | ||||
this.savegameDeleter = new SavegameDeleter(); | this.savegameDeleter = new SavegameDeleter(); | ||||
this.savegameDeleter.registerSavegameListChangeHandler(this.savegameList); | this.savegameDeleter.registerSavegameListChangeHandler(this.savegameList); | ||||
this.savegameList.registerSelectionChangeHandler(this.savegameDeleter); | this.savegameList.registerSelectionChangeHandler(this.savegameDeleter); | ||||
Show All 9 Lines | else | ||||
this.savegameList.registerSelectionChangeHandler(this.savegameLoader); | this.savegameList.registerSelectionChangeHandler(this.savegameLoader); | ||||
this.savegameList.selectFirst(); | this.savegameList.selectFirst(); | ||||
} | } | ||||
Engine.GetGUIObjectByName("title").caption = savePage ? translate("Save Game") : translate("Load Game"); | Engine.GetGUIObjectByName("title").caption = savePage ? translate("Save Game") : translate("Load Game"); | ||||
Engine.GetGUIObjectByName("cancel").onPress = () => { Engine.PopGuiPage(); }; | Engine.GetGUIObjectByName("cancel").onPress = () => { Engine.PopGuiPage(); }; | ||||
} | } | ||||
} | } | ||||
var g_SavegamePage; | |||||
function init(data) | |||||
{ | |||||
g_SavegamePage = new SavegamePage(data); | |||||
} |
Wildfire Games · Phabricator
I guess we should take the warnings into account?