mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-29 03:52:10 +00:00
Display the filename of the selected replay in the replay menu to ease sharing of replays.
Differential Revision: https://code.wildfiregames.com/D495 Reviewed By: Sandarac This was SVN commit r19650.
This commit is contained in:
@@ -8,5 +8,6 @@
|
||||
<include>common/sprites.xml</include>
|
||||
<include>common/styles.xml</include>
|
||||
|
||||
<include>replaymenu/sprites.xml</include>
|
||||
<include>replaymenu/replay_menu.xml</include>
|
||||
</page>
|
||||
|
||||
@@ -254,6 +254,7 @@ function displayReplayDetails()
|
||||
Engine.GetGUIObjectByName("replayInfoEmpty").hidden = replaySelected;
|
||||
Engine.GetGUIObjectByName("startReplayButton").enabled = replaySelected;
|
||||
Engine.GetGUIObjectByName("deleteReplayButton").enabled = replaySelected;
|
||||
Engine.GetGUIObjectByName("replayFilename").hidden = !replaySelected;
|
||||
Engine.GetGUIObjectByName("summaryButton").hidden = true;
|
||||
|
||||
if (!replaySelected)
|
||||
@@ -267,6 +268,7 @@ function displayReplayDetails()
|
||||
Engine.GetGUIObjectByName("sgVictory").caption = translateVictoryCondition(replay.attribs.settings.GameType);
|
||||
Engine.GetGUIObjectByName("sgNbPlayers").caption = sprintf(translate("Players: %(numberOfPlayers)s"),
|
||||
{ "numberOfPlayers": replay.attribs.settings.PlayerData.length });
|
||||
Engine.GetGUIObjectByName("replayFilename").caption = escapeText(Engine.GetReplayDirectoryName(replay.directory));
|
||||
|
||||
let metadata = Engine.GetReplayMetadata(replay.directory);
|
||||
Engine.GetGUIObjectByName("sgPlayersNames").caption =
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
|
||||
<!-- Replay List in that left panel -->
|
||||
<object name="replaySelection"
|
||||
size="0 35 100% 100%"
|
||||
size="0 35 100% 100%-24"
|
||||
style="ModernList"
|
||||
type="olist"
|
||||
sortable="true"
|
||||
@@ -108,6 +108,9 @@
|
||||
|
||||
</object>
|
||||
|
||||
<!-- Filename -->
|
||||
<object name="replayFilename" type="text" size="0 100%-24 100% 100%" font="sans-14" textcolor="white" sprite="ReplayMenuFilenameBackground"/>
|
||||
|
||||
</object>
|
||||
|
||||
<!-- Right Panel: Compatibility Filter & Replay Details -->
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<sprites>
|
||||
<sprite name="ReplayMenuFilenameBackground">
|
||||
<image
|
||||
backcolor="12 12 12 100"
|
||||
size="0 0 100% 100%"
|
||||
/>
|
||||
</sprite>
|
||||
</sprites>
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2016 Wildfire Games.
|
||||
/* Copyright (C) 2017 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -53,6 +53,11 @@ JS::Value JSI_VisualReplay::GetReplayMetadata(ScriptInterface::CxPrivate* pCxPri
|
||||
return VisualReplay::GetReplayMetadata(pCxPrivate, directoryName);
|
||||
}
|
||||
|
||||
CStrW JSI_VisualReplay::GetReplayDirectoryName(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const CStrW& directoryName)
|
||||
{
|
||||
return OsPath(VisualReplay::GetDirectoryName() / directoryName).string();
|
||||
}
|
||||
|
||||
void JSI_VisualReplay::RegisterScriptFunctions(ScriptInterface& scriptInterface)
|
||||
{
|
||||
scriptInterface.RegisterFunction<JS::Value, &GetReplays>("GetReplays");
|
||||
@@ -61,4 +66,5 @@ void JSI_VisualReplay::RegisterScriptFunctions(ScriptInterface& scriptInterface)
|
||||
scriptInterface.RegisterFunction<JS::Value, CStrW, &GetReplayAttributes>("GetReplayAttributes");
|
||||
scriptInterface.RegisterFunction<JS::Value, CStrW, &GetReplayMetadata>("GetReplayMetadata");
|
||||
scriptInterface.RegisterFunction<bool, CStrW, &HasReplayMetadata>("HasReplayMetadata");
|
||||
scriptInterface.RegisterFunction<CStrW, CStrW, &GetReplayDirectoryName>("GetReplayDirectoryName");
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2016 Wildfire Games.
|
||||
/* Copyright (C) 2017 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -30,6 +30,7 @@ namespace JSI_VisualReplay
|
||||
bool HasReplayMetadata(ScriptInterface::CxPrivate* pCxPrivate, const CStrW& directoryName);
|
||||
JS::Value GetReplayMetadata(ScriptInterface::CxPrivate* pCxPrivate, const CStrW& directoryName);
|
||||
void RegisterScriptFunctions(ScriptInterface& scriptInterface);
|
||||
CStrW GetReplayDirectoryName(ScriptInterface::CxPrivate* pCxPrivate, const CStrW& directoryName);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user