Differential D3041 Diff 13661 binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/Biome.js
Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/Biome.js
GameSettingControls.Biome = class extends GameSettingControlDropdown | GameSettingControls.Biome = class extends GameSettingControlDropdown | ||||
{ | { | ||||
constructor(...args) | constructor(...args) | ||||
{ | { | ||||
super(...args); | super(...args); | ||||
this.values = undefined; | this.values = undefined; | ||||
this.biomeValues = undefined; | this.biomeValues = undefined; | ||||
this.lastBiome = undefined; | |||||
this.randomItem = { | this.randomItem = { | ||||
"Id": this.RandomBiomeId, | "Id": this.RandomBiomeId, | ||||
"Title": setStringTags(this.RandomBiome, this.RandomItemTags), | "Title": setStringTags(this.RandomBiome, this.RandomItemTags), | ||||
"Autocomplete": this.RandomBiome, | "Autocomplete": this.RandomBiome, | ||||
"Description": this.RandomDescription | "Description": this.RandomDescription | ||||
}; | }; | ||||
} | } | ||||
Show All 24 Lines | if (available) | ||||
this.dropdown.list = this.values.Title; | this.dropdown.list = this.values.Title; | ||||
this.dropdown.list_data = this.values.Id; | this.dropdown.list_data = this.values.Id; | ||||
Engine.ProfileStop(); | Engine.ProfileStop(); | ||||
} | } | ||||
else | else | ||||
this.values = undefined; | this.values = undefined; | ||||
this.lastBiome = undefined; | |||||
} | } | ||||
onGameAttributesChange() | onGameAttributesChange() | ||||
{ | { | ||||
if (!g_GameAttributes.mapType || !g_GameAttributes.map) | if (!g_GameAttributes.mapType || !g_GameAttributes.map) | ||||
return; | return; | ||||
if (this.values) | if (this.values) | ||||
{ | { | ||||
if (this.values.Id.indexOf(g_GameAttributes.settings.Biome || undefined) == -1) | if (this.values.Id.indexOf(g_GameAttributes.settings.Biome || undefined) == -1) | ||||
{ | { | ||||
g_GameAttributes.settings.Biome = this.RandomBiomeId; | g_GameAttributes.settings.Biome = this.RandomBiomeId; | ||||
this.gameSettingsControl.updateGameAttributes(); | this.gameSettingsControl.updateGameAttributes(); | ||||
} | } | ||||
if (this.lastBiome != g_GameAttributes.settings.Biome) | |||||
{ | |||||
let biomePreviewFile = | let biomePreviewFile = | ||||
basename(g_GameAttributes.map) + "_" + | basename(g_GameAttributes.map) + "_" + | ||||
basename(g_GameAttributes.settings.Biome || "") + ".png"; | basename(g_GameAttributes.settings.Biome || "") + ".png"; | ||||
if (Engine.TextureExists(this.mapCache.TexturesPath + this.mapCache.PreviewsPath + biomePreviewFile)) | if (!g_GameAttributes.settings.Preview || g_GameAttributes.settings.Preview != biomePreviewFile && Engine.TextureExists(this.mapCache.TexturesPath + this.mapCache.PreviewsPath + biomePreviewFile)) | ||||
g_GameAttributes.settings.Preview = biomePreviewFile; | g_GameAttributes.settings.Preview = biomePreviewFile; | ||||
this.lastBiome = g_GameAttributes.settings.Biome; | |||||
} | |||||
} | } | ||||
else if (g_GameAttributes.settings.Biome) | else if (g_GameAttributes.settings.Biome) | ||||
{ | { | ||||
delete g_GameAttributes.settings.Biome; | delete g_GameAttributes.settings.Biome; | ||||
this.gameSettingsControl.updateGameAttributes(); | this.gameSettingsControl.updateGameAttributes(); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator