Differential D3351 Diff 15323 ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/MapSize.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/MapSize.js
GameSettingControls.MapSize = class extends GameSettingControlDropdown | GameSettingControls.MapSize = class extends GameSettingControlDropdown | ||||
{ | { | ||||
constructor(...args) | constructor(...args) | ||||
{ | { | ||||
super(...args); | super(...args); | ||||
this.previousMapType = undefined; | |||||
this.dropdown.list = g_MapSizes.Name; | this.dropdown.list = g_MapSizes.Name; | ||||
this.dropdown.list_data = g_MapSizes.Tiles; | this.dropdown.list_data = g_MapSizes.Tiles; | ||||
} | } | ||||
onHoverChange() | onHoverChange() | ||||
{ | { | ||||
this.dropdown.tooltip = g_MapSizes.Tooltip[this.dropdown.hovered] || this.Tooltip; | this.dropdown.tooltip = g_MapSizes.Tooltip[this.dropdown.hovered] || this.Tooltip; | ||||
} | } | ||||
Show All 11 Lines | if (g_GameAttributes.mapType == "random" && mapValue !== undefined && mapValue != g_GameAttributes.settings.Size) | ||||
g_GameAttributes.settings.Size = mapValue; | g_GameAttributes.settings.Size = mapValue; | ||||
this.gameSettingsControl.updateGameAttributes(); | this.gameSettingsControl.updateGameAttributes(); | ||||
} | } | ||||
} | } | ||||
onGameAttributesChange() | onGameAttributesChange() | ||||
{ | { | ||||
if (!g_GameAttributes.mapType || | if (!g_GameAttributes.mapType || | ||||
!g_GameAttributes.settings || | !g_GameAttributes.settings) | ||||
this.previousMapType == g_GameAttributes.mapType) | |||||
return; | return; | ||||
this.previousMapType = g_GameAttributes.mapType; | |||||
let available = g_GameAttributes.mapType == "random"; | let available = g_GameAttributes.mapType == "random"; | ||||
this.setHidden(!available); | this.setHidden(!available); | ||||
if (available) | if (available) | ||||
{ | { | ||||
if (g_GameAttributes.settings.Size === undefined) | if (g_GameAttributes.settings.Size === undefined) | ||||
{ | { | ||||
g_GameAttributes.settings.Size = g_MapSizes.Tiles[g_MapSizes.Default]; | g_GameAttributes.settings.Size = g_MapSizes.Tiles[g_MapSizes.Default]; | ||||
Show All 31 Lines |
Wildfire Games · Phabricator