diff --git a/Content.Client/GameTicking/ClientGameTicker.cs b/Content.Client/GameTicking/ClientGameTicker.cs index 621be8e936..1d3d278a67 100644 --- a/Content.Client/GameTicking/ClientGameTicker.cs +++ b/Content.Client/GameTicking/ClientGameTicker.cs @@ -73,7 +73,7 @@ namespace Content.Client.GameTicking { //This is not ideal at all, but I don't see an immediately better fit anywhere else. - var roundEnd = new RoundEndSummaryWindow(message.GamemodeTitle, message.DurationInHours, message.AllPlayersEndInfo); + var roundEnd = new RoundEndSummaryWindow(message.GamemodeTitle, message.RoundDuration, message.AllPlayersEndInfo); } } diff --git a/Content.Client/UserInterface/RoundEndSummaryWindow.cs b/Content.Client/UserInterface/RoundEndSummaryWindow.cs index 024182fab6..5e8600b188 100644 --- a/Content.Client/UserInterface/RoundEndSummaryWindow.cs +++ b/Content.Client/UserInterface/RoundEndSummaryWindow.cs @@ -13,6 +13,7 @@ using System.Linq; using System.Collections.Generic; using static Robust.Client.UserInterface.Controls.ItemList; using static Content.Shared.SharedGameTicker; +using System; namespace Content.Client.UserInterface { @@ -23,7 +24,7 @@ namespace Content.Client.UserInterface private TabContainer RoundEndWindowTabs { get; } protected override Vector2? CustomSize => (520, 580); - public RoundEndSummaryWindow(string gm, uint duration, List info ) + public RoundEndSummaryWindow(string gm, TimeSpan roundTimeSpan, List info ) { Title = Loc.GetString("Round End Summary"); @@ -55,7 +56,11 @@ namespace Content.Client.UserInterface gamemodeLabel.SetMarkup(Loc.GetString("Round of [color=white]{0}[/color] has ended.", gm)); RoundEndSummaryTab.AddChild(gamemodeLabel); - //TODO: Implement showing the duration of the round. + //Duration + var roundTimeLabel = new RichTextLabel(); + roundTimeLabel.SetMarkup(Loc.GetString("It lasted for [color=yellow]{0} hours, {1} minutes, and {2} seconds.", + roundTimeSpan.Hours,roundTimeSpan.Minutes,roundTimeSpan.Seconds)); + RoundEndSummaryTab.AddChild(roundTimeLabel); //Initialize what will be the list of players display. var scrollContainer = new ScrollContainer(); diff --git a/Content.Server/GameTicking/GameTicker.cs b/Content.Server/GameTicking/GameTicker.cs index a7b2b9bf61..2862b43f16 100644 --- a/Content.Server/GameTicking/GameTicker.cs +++ b/Content.Server/GameTicking/GameTicker.cs @@ -206,8 +206,9 @@ namespace Content.Server.GameTicking var roundEndMessage = _netManager.CreateNetMessage(); roundEndMessage.GamemodeTitle = MakeGamePreset().ModeTitle; - //TODO:Grab actual timespan of round. - roundEndMessage.DurationInHours = 1337; + //Get the timespan of the round. + var gameTime = IoCManager.Resolve(); + roundEndMessage.RoundDuration = gameTime.RealTime; //Generate a list of basic player info to display in the end round summary. var listOfPlayerInfo = new List(); diff --git a/Content.Shared/SharedGameTicker.cs b/Content.Shared/SharedGameTicker.cs index 41a1651d12..38d3e0985e 100644 --- a/Content.Shared/SharedGameTicker.cs +++ b/Content.Shared/SharedGameTicker.cs @@ -137,8 +137,8 @@ namespace Content.Shared #endregion public string GamemodeTitle; - //TODO: Change to a more detailed measurement of time. - public uint DurationInHours; + public TimeSpan RoundDuration; + public uint PlayerCount; @@ -147,7 +147,11 @@ namespace Content.Shared public override void ReadFromBuffer(NetIncomingMessage buffer) { GamemodeTitle = buffer.ReadString(); - DurationInHours = buffer.ReadUInt32(); + + var hours = buffer.ReadInt32(); + var mins = buffer.ReadInt32(); + var seconds = buffer.ReadInt32(); + RoundDuration = new TimeSpan(hours, mins, seconds); PlayerCount = buffer.ReadUInt32(); AllPlayersEndInfo = new List(); @@ -163,13 +167,16 @@ namespace Content.Shared AllPlayersEndInfo.Add(readPlayerData); } - + } public override void WriteToBuffer(NetOutgoingMessage buffer) { buffer.Write(GamemodeTitle); - buffer.Write(DurationInHours); + buffer.Write(RoundDuration.Hours); + buffer.Write(RoundDuration.Minutes); + buffer.Write(RoundDuration.Seconds); + buffer.Write(PlayerCount); foreach(var playerEndInfo in AllPlayersEndInfo)