mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-29 00:53:42 +00:00
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:
@@ -37,7 +37,7 @@ var g_BuddySymbol = '•';
|
|||||||
/**
|
/**
|
||||||
* Returns map description and preview image or placeholder.
|
* Returns map description and preview image or placeholder.
|
||||||
*/
|
*/
|
||||||
function getMapDescriptionAndPreview(mapType, mapName)
|
function getMapDescriptionAndPreview(mapType, mapName, gameAttributes = undefined)
|
||||||
{
|
{
|
||||||
let mapData;
|
let mapData;
|
||||||
if (mapType == "random" && mapName == "random")
|
if (mapType == "random" && mapName == "random")
|
||||||
@@ -47,9 +47,12 @@ function getMapDescriptionAndPreview(mapType, mapName)
|
|||||||
else if (Engine.FileExists(mapName + ".xml"))
|
else if (Engine.FileExists(mapName + ".xml"))
|
||||||
mapData = Engine.LoadMapSettings(mapName + ".xml");
|
mapData = Engine.LoadMapSettings(mapName + ".xml");
|
||||||
|
|
||||||
|
let mapBiome = gameAttributes && g_Settings.Biomes.find(biome => biome.Id == gameAttributes.settings.Biome);
|
||||||
|
|
||||||
return deepfreeze({
|
return deepfreeze({
|
||||||
"description": mapData && mapData.settings && mapData.settings.Description ? translate(mapData.settings.Description) : translate("Sorry, no description available."),
|
"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;
|
return;
|
||||||
|
|
||||||
Engine.GetGUIObjectByName("savedMapName").caption = translate(metadata.initAttributes.settings.Name);
|
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);
|
setMapPreviewImage("savedInfoPreview", mapData.preview);
|
||||||
|
|
||||||
Engine.GetGUIObjectByName("savedPlayers").caption = metadata.initAttributes.settings.PlayerData.length - 1;
|
Engine.GetGUIObjectByName("savedPlayers").caption = metadata.initAttributes.settings.PlayerData.length - 1;
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ function displayReplayDetails()
|
|||||||
metadata.playerStates.map(pState => pState.state)
|
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("sgMapDescription").caption = mapData.description;
|
||||||
|
|
||||||
Engine.GetGUIObjectByName("summaryButton").hidden = !Engine.HasReplayMetadata(replay.directory);
|
Engine.GetGUIObjectByName("summaryButton").hidden = !Engine.HasReplayMetadata(replay.directory);
|
||||||
|
|||||||
Reference in New Issue
Block a user