Display map biome specific preview in the replay menu and loading screen too, refs #4962.
This was SVN commit r21523.
This commit is contained in:
parent
6d35fe5d2b
commit
8adc6d8e93
@ -37,7 +37,7 @@ var g_BuddySymbol = '•';
|
||||
/**
|
||||
* Returns map description and preview image or placeholder.
|
||||
*/
|
||||
function getMapDescriptionAndPreview(mapType, mapName)
|
||||
function getMapDescriptionAndPreview(mapType, mapName, gameAttributes = undefined)
|
||||
{
|
||||
let mapData;
|
||||
if (mapType == "random" && mapName == "random")
|
||||
@ -47,9 +47,12 @@ function getMapDescriptionAndPreview(mapType, mapName)
|
||||
else if (Engine.FileExists(mapName + ".xml"))
|
||||
mapData = Engine.LoadMapSettings(mapName + ".xml");
|
||||
|
||||
let mapBiome = gameAttributes && g_Settings.Biomes.find(biome => biome.Id == gameAttributes.settings.Biome);
|
||||
|
||||
return deepfreeze({
|
||||
"description": mapData && mapData.settings && mapData.settings.Description ? translate(mapData.settings.Description) : translate("Sorry, no description available."),
|
||||
"preview": mapData && mapData.settings && mapData.settings.Preview ? mapData.settings.Preview : "nopreview.png"
|
||||
"preview": mapBiome && mapBiome.Preview ? mapBiome.Preview :
|
||||
mapData && mapData.settings && mapData.settings.Preview ? mapData.settings.Preview : "nopreview.png"
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ function selectionChanged()
|
||||
return;
|
||||
|
||||
Engine.GetGUIObjectByName("savedMapName").caption = translate(metadata.initAttributes.settings.Name);
|
||||
let mapData = getMapDescriptionAndPreview(metadata.initAttributes.mapType, metadata.initAttributes.map);
|
||||
let mapData = getMapDescriptionAndPreview(metadata.initAttributes.mapType, metadata.initAttributes.map, metadata.initAttributes);
|
||||
setMapPreviewImage("savedInfoPreview", mapData.preview);
|
||||
|
||||
Engine.GetGUIObjectByName("savedPlayers").caption = metadata.initAttributes.settings.PlayerData.length - 1;
|
||||
|
@ -284,7 +284,7 @@ function displayReplayDetails()
|
||||
metadata.playerStates.map(pState => pState.state)
|
||||
);
|
||||
|
||||
let mapData = getMapDescriptionAndPreview(replay.attribs.settings.mapType, replay.attribs.map);
|
||||
let mapData = getMapDescriptionAndPreview(replay.attribs.settings.mapType, replay.attribs.map, replay.attribs);
|
||||
Engine.GetGUIObjectByName("sgMapDescription").caption = mapData.description;
|
||||
|
||||
Engine.GetGUIObjectByName("summaryButton").hidden = !Engine.HasReplayMetadata(replay.directory);
|
||||
|
Loading…
Reference in New Issue
Block a user