Differential D2593 Diff 11153 binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/MapPreview.js
Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/MapPreview.js
class MapPreview | class MapPreview | ||||
{ | { | ||||
constructor(setupWindow) | constructor(setupWindow) | ||||
{ | { | ||||
this.gameSettingsControl = setupWindow.controls.gameSettingsControl; | this.gameSettingsControl = setupWindow.controls.gameSettingsControl; | ||||
this.mapCache = setupWindow.controls.mapCache; | this.mapCache = setupWindow.controls.mapCache; | ||||
this.mapInfoName = Engine.GetGUIObjectByName("mapInfoName"); | this.mapInfoName = Engine.GetGUIObjectByName("mapInfoName"); | ||||
this.mapPreview = Engine.GetGUIObjectByName("mapPreview"); | this.mapPreview = Engine.GetGUIObjectByName("mapPreview"); | ||||
this.gameSettingsControl.registerMapChangeHandler(this.onMapChange.bind(this)); | this.previousMap = undefined; | ||||
this.gameSettingsControl.registerGameAttributesChangeHandler(this.onGameAttributesChange.bind(this)); | |||||
this.gameSettingsControl.registerGameAttributesBatchChangeHandler(this.onGameAttributesBatchChange.bind(this)); | this.gameSettingsControl.registerGameAttributesBatchChangeHandler(this.onGameAttributesBatchChange.bind(this)); | ||||
} | } | ||||
onMapChange(mapData) | onGameAttributesChange() | ||||
{ | { | ||||
if (!g_GameAttributes.map || this.previousMap == g_GameAttributes.map || !g_GameAttributes.mapType) | |||||
return; | |||||
this.previousMap = g_GameAttributes.map; | |||||
let mapData = this.mapCache.getMapData(g_GameAttributes.mapType, g_GameAttributes.map); | |||||
let preview = mapData && mapData.settings && mapData.settings.Preview; | let preview = mapData && mapData.settings && mapData.settings.Preview; | ||||
if (!g_GameAttributes.settings.Preview || g_GameAttributes.settings.Preview != preview) | if (!g_GameAttributes.settings.Preview || g_GameAttributes.settings.Preview != preview) | ||||
{ | { | ||||
g_GameAttributes.settings.Preview = preview; | g_GameAttributes.settings.Preview = preview; | ||||
this.gameSettingsControl.updateGameAttributes(); | this.gameSettingsControl.updateGameAttributes(); | ||||
} | } | ||||
} | } | ||||
Show All 12 Lines |
Wildfire Games · Phabricator