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.
|
//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 System.Collections.Generic;
|
||||||
using static Robust.Client.UserInterface.Controls.ItemList;
|
using static Robust.Client.UserInterface.Controls.ItemList;
|
||||||
using static Content.Shared.SharedGameTicker;
|
using static Content.Shared.SharedGameTicker;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace Content.Client.UserInterface
|
namespace Content.Client.UserInterface
|
||||||
{
|
{
|
||||||
@@ -23,7 +24,7 @@ namespace Content.Client.UserInterface
|
|||||||
private TabContainer RoundEndWindowTabs { get; }
|
private TabContainer RoundEndWindowTabs { get; }
|
||||||
protected override Vector2? CustomSize => (520, 580);
|
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");
|
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));
|
gamemodeLabel.SetMarkup(Loc.GetString("Round of [color=white]{0}[/color] has ended.", gm));
|
||||||
RoundEndSummaryTab.AddChild(gamemodeLabel);
|
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.
|
//Initialize what will be the list of players display.
|
||||||
var scrollContainer = new ScrollContainer();
|
var scrollContainer = new ScrollContainer();
|
||||||
|
|||||||
@@ -206,8 +206,9 @@ namespace Content.Server.GameTicking
|
|||||||
var roundEndMessage = _netManager.CreateNetMessage<MsgRoundEndMessage>();
|
var roundEndMessage = _netManager.CreateNetMessage<MsgRoundEndMessage>();
|
||||||
roundEndMessage.GamemodeTitle = MakeGamePreset().ModeTitle;
|
roundEndMessage.GamemodeTitle = MakeGamePreset().ModeTitle;
|
||||||
|
|
||||||
//TODO:Grab actual timespan of round.
|
//Get the timespan of the round.
|
||||||
roundEndMessage.DurationInHours = 1337;
|
var gameTime = IoCManager.Resolve<IGameTiming>();
|
||||||
|
roundEndMessage.RoundDuration = gameTime.RealTime;
|
||||||
|
|
||||||
//Generate a list of basic player info to display in the end round summary.
|
//Generate a list of basic player info to display in the end round summary.
|
||||||
var listOfPlayerInfo = new List<RoundEndPlayerInfo>();
|
var listOfPlayerInfo = new List<RoundEndPlayerInfo>();
|
||||||
|
|||||||
@@ -137,8 +137,8 @@ namespace Content.Shared
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public string GamemodeTitle;
|
public string GamemodeTitle;
|
||||||
//TODO: Change to a more detailed measurement of time.
|
public TimeSpan RoundDuration;
|
||||||
public uint DurationInHours;
|
|
||||||
|
|
||||||
public uint PlayerCount;
|
public uint PlayerCount;
|
||||||
|
|
||||||
@@ -147,7 +147,11 @@ namespace Content.Shared
|
|||||||
public override void ReadFromBuffer(NetIncomingMessage buffer)
|
public override void ReadFromBuffer(NetIncomingMessage buffer)
|
||||||
{
|
{
|
||||||
GamemodeTitle = buffer.ReadString();
|
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();
|
PlayerCount = buffer.ReadUInt32();
|
||||||
AllPlayersEndInfo = new List<RoundEndPlayerInfo>();
|
AllPlayersEndInfo = new List<RoundEndPlayerInfo>();
|
||||||
@@ -163,13 +167,16 @@ namespace Content.Shared
|
|||||||
|
|
||||||
AllPlayersEndInfo.Add(readPlayerData);
|
AllPlayersEndInfo.Add(readPlayerData);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void WriteToBuffer(NetOutgoingMessage buffer)
|
public override void WriteToBuffer(NetOutgoingMessage buffer)
|
||||||
{
|
{
|
||||||
buffer.Write(GamemodeTitle);
|
buffer.Write(GamemodeTitle);
|
||||||
buffer.Write(DurationInHours);
|
buffer.Write(RoundDuration.Hours);
|
||||||
|
buffer.Write(RoundDuration.Minutes);
|
||||||
|
buffer.Write(RoundDuration.Seconds);
|
||||||
|
|
||||||
|
|
||||||
buffer.Write(PlayerCount);
|
buffer.Write(PlayerCount);
|
||||||
foreach(var playerEndInfo in AllPlayersEndInfo)
|
foreach(var playerEndInfo in AllPlayersEndInfo)
|
||||||
|
|||||||
Reference in New Issue
Block a user