Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/replaymenu/replay_menu.js
Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | |||||
function init(data) | function init(data) | ||||
{ | { | ||||
if (!g_Settings) | if (!g_Settings) | ||||
{ | { | ||||
Engine.SwitchGuiPage("page_pregame.xml"); | Engine.SwitchGuiPage("page_pregame.xml"); | ||||
return; | return; | ||||
} | } | ||||
loadReplays(data && data.replaySelectionData, false); | loadReplays(data && data.replaySelectionData || null, false); | ||||
if (!g_Replays) | if (!g_Replays) | ||||
{ | { | ||||
Engine.SwitchGuiPage("page_pregame.xml"); | Engine.SwitchGuiPage("page_pregame.xml"); | ||||
return; | return; | ||||
} | } | ||||
initGUIWindow(); | |||||
initHotkeyTooltips(); | initHotkeyTooltips(); | ||||
displayReplayList(); | displayReplayList(); | ||||
if (data && data.summarySelectedData) | if (data && data.summarySelectedData) | ||||
g_SummarySelectedData = data.summarySelectedData; | g_SummarySelectedData = data.summarySelectedData; | ||||
} | } | ||||
/** | /** | ||||
* Set sprite of the window and size of the window and the window title and close button caption. | |||||
*/ | |||||
function initGUIWindow() | |||||
{ | |||||
let dialog = Engine.HasXmppClient(); | |||||
let window = Engine.GetGUIObjectByName("replayWindow"); | |||||
window.sprite = dialog ? "ModernDialog" : "ModernWindow"; | |||||
window.size = dialog ? "16 24 100%-16 100%-24" : "0 0 100% 100%"; | |||||
Engine.GetGUIObjectByName("replayWindowTitle").size = dialog ? "50%-128 -16 50%+128 16" : "50%-128 4 50%+128 36"; | |||||
Engine.GetGUIObjectByName("closeButton").caption = dialog ? translate("Lobby") : translate("Main Menu"); | |||||
Engine.GetGUIObjectByName("fadeImage").hidden = !dialog; | |||||
} | |||||
/** | |||||
* Store the list of replays loaded in C++ in g_Replays. | * Store the list of replays loaded in C++ in g_Replays. | ||||
* Check timestamp and compatibility and extract g_Playernames, g_MapNames, g_VictoryConditions. | * Check timestamp and compatibility and extract g_Playernames, g_MapNames, g_VictoryConditions. | ||||
* Restore selected filters and item. | * Restore selected filters and item. | ||||
* @param replaySelectionData - Currently selected filters and item to be restored after the loading. | * @param replaySelectionData - Currently selected filters and item to be restored after the loading. | ||||
* @param compareFiles - If true, compares files briefly (which might be slow with optical harddrives), | * @param compareFiles - If true, compares files briefly (which might be slow with optical harddrives), | ||||
* otherwise blindly trusts the replay cache. | * otherwise blindly trusts the replay cache. | ||||
*/ | */ | ||||
function loadReplays(replaySelectionData, compareFiles) | function loadReplays(replaySelectionData, compareFiles) | ||||
▲ Show 20 Lines • Show All 274 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator