Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/common/MapCache.js
Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | if (mapPath == "random") | ||||
return translate("A randomly selected map."); | return translate("A randomly selected map."); | ||||
let mapData = this.getMapData(mapType, mapPath); | let mapData = this.getMapData(mapType, mapPath); | ||||
return mapData && mapData.settings && translate(mapData.settings.Description) || ""; | return mapData && mapData.settings && translate(mapData.settings.Description) || ""; | ||||
} | } | ||||
getMapPreview(mapType, mapPath, gameAttributes = undefined) | getMapPreview(mapType, mapPath, gameAttributes = undefined) | ||||
{ | { | ||||
let mapData = this.getMapData(mapType, mapPath); | let filename = gameAttributes && gameAttributes.settings && gameAttributes.settings.Preview || undefined; | ||||
let biomePreviewFile = | if (!filename) | ||||
basename(mapPath) + "_" + | { | ||||
basename(gameAttributes && gameAttributes.settings.Biome || "") + ".png"; | let mapData = this.getMapData(mapType, mapPath); | ||||
filename = mapData && mapData.settings && mapData.settings.Preview || this.DefaultPreview; | |||||
let biomePreview = Engine.TextureExists( | } | ||||
this.TexturesPath + this.PreviewsPath + biomePreviewFile) && biomePreviewFile; | |||||
let filename = | |||||
biomePreview ? | |||||
biomePreview : | |||||
mapData && mapData.settings && mapData.settings.Preview ? | |||||
mapData.settings.Preview : | |||||
this.DefaultPreview; | |||||
return "cropped:" + this.PreviewWidth + "," + this.PreviewHeight + ":" + this.PreviewsPath + filename; | return "cropped:" + this.PreviewWidth + "," + this.PreviewHeight + ":" + this.PreviewsPath + filename; | ||||
} | } | ||||
} | } | ||||
MapCache.prototype.TexturesPath = | MapCache.prototype.TexturesPath = | ||||
"art/textures/ui/"; | "art/textures/ui/"; | ||||
Show All 11 Lines |
Wildfire Games · Phabricator