Differential D3711 Diff 16562 binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/MapSelection.js
Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/MapSelection.js
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | updateMapList() | ||||
this.dropdown.list_data = this.values.file; | this.dropdown.list_data = this.values.file; | ||||
g_GameSettings.map.setRandomOptions(this.values.file); | g_GameSettings.map.setRandomOptions(this.values.file); | ||||
// Reset the selected map. | // Reset the selected map. | ||||
if (this.values.file.indexOf(g_GameSettings.map.map) === -1) | if (this.values.file.indexOf(g_GameSettings.map.map) === -1) | ||||
{ | { | ||||
g_GameSettings.map.selectMap(this.values.file[this.values.Default]); | g_GameSettings.map.selectMap(this.values.file[this.values.Default]); | ||||
this.gameSettingsControl.setNetworkGameAttributes(); | this.gameSettingsControl.setNetworkInitAttributes(); | ||||
} | } | ||||
// The index may have changed: reset. | // The index may have changed: reset. | ||||
this.setSelectedValue(g_GameSettings.map.map); | this.setSelectedValue(g_GameSettings.map.map); | ||||
Engine.ProfileStop(); | Engine.ProfileStop(); | ||||
} | } | ||||
onSelectionChange(itemIdx) | onSelectionChange(itemIdx) | ||||
{ | { | ||||
// The triggering that happens on map change can be just slow enough | // The triggering that happens on map change can be just slow enough | ||||
// that the next event happens before we're done when scrolling, | // that the next event happens before we're done when scrolling, | ||||
// and then the scrolling is not smooth since it can take arbitrarily long to render. | // and then the scrolling is not smooth since it can take arbitrarily long to render. | ||||
// To avoid that, run the change on the next GUI tick, and only do one increment. | // To avoid that, run the change on the next GUI tick, and only do one increment. | ||||
// TODO: the problem is mostly that updating visibility can relayout the gamesetting, | // TODO: the problem is mostly that updating visibility can relayout the gamesetting, | ||||
// which takes a few ms, but this could only be done once per frame anyways. | // which takes a few ms, but this could only be done once per frame anyways. | ||||
// NB: this technically makes it possible to start the game without the change going through | // NB: this technically makes it possible to start the game without the change going through | ||||
// but it's essentially impossible to trigger accidentally. | // but it's essentially impossible to trigger accidentally. | ||||
if (this.reRenderTimeout) | if (this.reRenderTimeout) | ||||
return; | return; | ||||
this.reRenderTimeout = setTimeout(() => { | this.reRenderTimeout = setTimeout(() => { | ||||
g_GameSettings.map.selectMap(this.values.file[itemIdx]); | g_GameSettings.map.selectMap(this.values.file[itemIdx]); | ||||
this.gameSettingsControl.setNetworkGameAttributes(); | this.gameSettingsControl.setNetworkInitAttributes(); | ||||
delete this.reRenderTimeout; | delete this.reRenderTimeout; | ||||
}, 0); | }, 0); | ||||
} | } | ||||
getAutocompleteEntries() | getAutocompleteEntries() | ||||
{ | { | ||||
return this.values.name; | return this.values.name; | ||||
} | } | ||||
Show All 18 Lines |
Wildfire Games · Phabricator