Changed duration to use TimeSpan.
Using actual round realtime span to determine round length.
This commit is contained in:
@@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<RoundEndPlayerInfo> info )
|
||||
public RoundEndSummaryWindow(string gm, TimeSpan roundTimeSpan, List<RoundEndPlayerInfo> 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();
|
||||
|
||||
@@ -206,8 +206,9 @@ namespace Content.Server.GameTicking
|
||||
var roundEndMessage = _netManager.CreateNetMessage<MsgRoundEndMessage>();
|
||||
roundEndMessage.GamemodeTitle = MakeGamePreset().ModeTitle;
|
||||
|
||||
//TODO:Grab actual timespan of round.
|
||||
roundEndMessage.DurationInHours = 1337;
|
||||
//Get the timespan of the round.
|
||||
var gameTime = IoCManager.Resolve<IGameTiming>();
|
||||
roundEndMessage.RoundDuration = gameTime.RealTime;
|
||||
|
||||
//Generate a list of basic player info to display in the end round summary.
|
||||
var listOfPlayerInfo = new List<RoundEndPlayerInfo>();
|
||||
|
||||
@@ -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<RoundEndPlayerInfo>();
|
||||
@@ -169,7 +173,10 @@ namespace Content.Shared
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user