Differential D4039 Diff 17917 ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/MapFilter.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/MapFilter.js
GameSettingControls.MapFilter = class MapFilter extends GameSettingControlDropdown | GameSettingControls.MapFilter = class MapFilter extends GameSettingControlDropdown | ||||
{ | { | ||||
constructor(...args) | constructor(...args) | ||||
{ | { | ||||
super(...args); | super(...args); | ||||
this.values = undefined; | this.values = undefined; | ||||
} | |||||
onSettingsLoaded() | |||||
{ | |||||
if (this.gameSettingsController.guiData.lockSettings?.map) | |||||
this.setEnabled(false); | |||||
else | |||||
{ | |||||
this.gameSettingsController.guiData.mapFilter.watch(() => this.render(), ["filter"]); | this.gameSettingsController.guiData.mapFilter.watch(() => this.render(), ["filter"]); | ||||
g_GameSettings.map.watch(() => this.checkMapTypeChange(), ["type"]); | g_GameSettings.map.watch(() => this.checkMapTypeChange(), ["type"]); | ||||
this.checkMapTypeChange(); | |||||
} | |||||
this.render(); | |||||
} | } | ||||
onHoverChange() | onHoverChange() | ||||
{ | { | ||||
this.dropdown.tooltip = this.values.Description[this.dropdown.hovered] || this.Tooltip; | this.dropdown.tooltip = this.values.Description[this.dropdown.hovered] || this.Tooltip; | ||||
} | } | ||||
checkMapTypeChange() | checkMapTypeChange() | ||||
Show All 19 Lines | if (this.values && this.values.Name.indexOf(this.gameSettingsController.guiData.mapFilter.filter) === -1) | ||||
this.gameSettingsController.guiData.mapFilter.filter = this.values.Name[this.values.Default]; | this.gameSettingsController.guiData.mapFilter.filter = this.values.Name[this.values.Default]; | ||||
this.gameSettingsController.setNetworkInitAttributes(); | this.gameSettingsController.setNetworkInitAttributes(); | ||||
} | } | ||||
this.render(); | this.render(); | ||||
} | } | ||||
render() | render() | ||||
{ | { | ||||
if (!this.enabled) | |||||
{ | |||||
if (!this.hidden) | |||||
this.setHidden(true); | |||||
return; | |||||
} | |||||
// Index may have changed, reset. | // Index may have changed, reset. | ||||
this.setSelectedValue(this.gameSettingsController.guiData.mapFilter.filter); | this.setSelectedValue(this.gameSettingsController.guiData.mapFilter.filter); | ||||
this.setHidden(!this.values); | this.setHidden(!this.values); | ||||
} | } | ||||
getAutocompleteEntries() | getAutocompleteEntries() | ||||
{ | { | ||||
return this.values && this.values.Title; | return this.values && this.values.Title; | ||||
Show All 15 Lines |
Wildfire Games · Phabricator