Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesetup/Controls/GuiData.js
- This file was added.
/** | |||||
* This class contains GUI-specific gamesetting data. | |||||
*/ | |||||
class GameSettingsGuiData | |||||
{ | |||||
constructor() | |||||
{ | |||||
this.mapFilter = new Observable(); | |||||
this.mapFilter.filter = "default"; | |||||
// This is set by the mapPreview control. | |||||
this.mapPreview = undefined; | |||||
} | |||||
/** | |||||
* Serialize for network transmission, settings persistence or convenience in other GUI files. | |||||
*/ | |||||
Serialize() | |||||
{ | |||||
let ret = { | |||||
"mapFilter": this.mapFilter.filter, | |||||
// Copy the map name so that the replay menu doesn't have to load hundreds of map descriptions on init | |||||
// Also it allows determining the english mapname from the replay file if the map is not available. | |||||
"mapName": g_NewGameSettings.map?.data?.settings?.Name | |||||
}; | |||||
// If a specific mappreview was chosen, save it to avoid implementing complex | |||||
// gamesetting-related logic in a bunch of unrelated component (saved games, lobby list,...). | |||||
if (this.mapPreview) | |||||
ret.mapPreview = this.mapPreview; | |||||
return ret; | |||||
} | |||||
Deserialize(data) | |||||
{ | |||||
this.mapFilter.filter = data.mapFilter; | |||||
} | |||||
} |
Wildfire Games · Phabricator