Added final game tick to replay meta data for completion percentage on replay.

This commit is contained in:
Jeremy
2018-12-22 22:05:52 -05:00
committed by Oliver Brakmann
parent 863091d5cc
commit 85a97998aa
4 changed files with 5 additions and 2 deletions

View File

@@ -24,6 +24,7 @@ namespace OpenRA
public string MapUid; public string MapUid;
public string MapTitle; public string MapTitle;
public int FinalGameTick;
/// <summary>Game start timestamp (when the recoding started).</summary> /// <summary>Game start timestamp (when the recoding started).</summary>
public DateTime StartTimeUtc; public DateTime StartTimeUtc;

View File

@@ -33,6 +33,7 @@ namespace OpenRA.Network
public int LocalClientId { get { return 0; } } public int LocalClientId { get { return 0; } }
public ConnectionState ConnectionState { get { return ConnectionState.Connected; } } public ConnectionState ConnectionState { get { return ConnectionState.Connected; } }
public readonly int TickCount; public readonly int TickCount;
public readonly int FinalGameTick;
public readonly bool IsValid; public readonly bool IsValid;
public readonly Session LobbyInfo; public readonly Session LobbyInfo;
public readonly string Filename; public readonly string Filename;
@@ -40,6 +41,7 @@ namespace OpenRA.Network
public ReplayConnection(string replayFilename) public ReplayConnection(string replayFilename)
{ {
Filename = replayFilename; Filename = replayFilename;
FinalGameTick = ReplayMetadata.Read(replayFilename).GameInfo.FinalGameTick;
// Parse replay data into a struct that can be fed to the game in chunks // Parse replay data into a struct that can be fed to the game in chunks
// to avoid issues with all immediate orders being resolved on the first tick. // to avoid issues with all immediate orders being resolved on the first tick.

View File

@@ -66,7 +66,7 @@ namespace OpenRA
foreach (var t in WorldActor.TraitsImplementing<IGameOver>()) foreach (var t in WorldActor.TraitsImplementing<IGameOver>())
t.GameOver(this); t.GameOver(this);
gameInfo.FinalGameTick = WorldTick;
GameOver(); GameOver();
} }
} }

View File

@@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{ {
var connection = orderManager.Connection as ReplayConnection; var connection = orderManager.Connection as ReplayConnection;
if (connection != null && connection.TickCount != 0) if (connection != null && connection.TickCount != 0)
timerTooltip.GetTooltipText = () => "{0}% complete".F(orderManager.NetFrameNumber * 100 / connection.TickCount); timerTooltip.GetTooltipText = () => "{0}% complete".F(world.WorldTick * 100 / connection.FinalGameTick);
else else
timerTooltip.GetTooltipText = null; timerTooltip.GetTooltipText = null;
} }