2021-06-21 02:13:54 +02:00
|
|
|
using System;
|
2020-08-13 14:40:27 +02:00
|
|
|
using System.Linq;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Client.Message;
|
2021-06-20 10:09:24 +02:00
|
|
|
using Content.Shared.GameTicking;
|
2020-04-08 06:07:54 -05:00
|
|
|
using Robust.Client.UserInterface.Controls;
|
|
|
|
|
using Robust.Client.UserInterface.CustomControls;
|
|
|
|
|
using Robust.Shared.Localization;
|
2021-07-18 18:39:31 +02:00
|
|
|
using static Robust.Client.UserInterface.Controls.BoxContainer;
|
2020-04-08 06:07:54 -05:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Client.RoundEnd
|
2020-04-08 06:07:54 -05:00
|
|
|
{
|
2022-01-21 01:38:35 -08:00
|
|
|
public sealed class RoundEndSummaryWindow : DefaultWindow
|
2020-04-08 06:07:54 -05:00
|
|
|
{
|
|
|
|
|
|
2021-06-20 10:09:24 +02:00
|
|
|
public RoundEndSummaryWindow(string gm, string roundEnd, TimeSpan roundTimeSpan, RoundEndMessageEvent.RoundEndPlayerInfo[] info)
|
2020-04-08 06:07:54 -05:00
|
|
|
{
|
2021-02-21 12:38:56 +01:00
|
|
|
MinSize = SetSize = (520, 580);
|
2020-04-12 00:59:44 -05:00
|
|
|
|
2021-06-21 02:13:54 +02:00
|
|
|
Title = Loc.GetString("round-end-summary-window-title");
|
2020-04-12 00:59:44 -05:00
|
|
|
|
2021-12-12 05:09:47 -08:00
|
|
|
// The round end window is split into two tabs, one about the round stats
|
|
|
|
|
// and the other is a list of RoundEndPlayerInfo for each player.
|
|
|
|
|
// This tab would be a good place for things like: "x many people died.",
|
|
|
|
|
// "clown slipped the crew x times.", "x shots were fired this round.", etc.
|
|
|
|
|
// Also good for serious info.
|
|
|
|
|
|
|
|
|
|
var roundEndTabs = new TabContainer();
|
|
|
|
|
roundEndTabs.AddChild(MakeRoundEndSummaryTab(gm, roundEnd, roundTimeSpan));
|
|
|
|
|
roundEndTabs.AddChild(MakePlayerManifestoTab(info));
|
|
|
|
|
|
|
|
|
|
Contents.AddChild(roundEndTabs);
|
|
|
|
|
|
|
|
|
|
OpenCentered();
|
|
|
|
|
MoveToFront();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private BoxContainer MakeRoundEndSummaryTab(string gamemode, string roundEnd, TimeSpan roundDuration)
|
|
|
|
|
{
|
|
|
|
|
var roundEndSummaryTab = new BoxContainer
|
2020-04-12 00:59:44 -05:00
|
|
|
{
|
2021-07-18 18:39:31 +02:00
|
|
|
Orientation = LayoutOrientation.Vertical,
|
2021-06-21 02:13:54 +02:00
|
|
|
Name = Loc.GetString("round-end-summary-window-round-end-summary-tab-title")
|
2020-04-12 00:59:44 -05:00
|
|
|
};
|
|
|
|
|
|
2021-12-12 05:09:47 -08:00
|
|
|
var roundEndSummaryContainerScrollbox = new ScrollContainer
|
2020-04-12 00:59:44 -05:00
|
|
|
{
|
2021-12-12 05:09:47 -08:00
|
|
|
VerticalExpand = true
|
|
|
|
|
};
|
|
|
|
|
var roundEndSummaryContainer = new BoxContainer
|
|
|
|
|
{
|
|
|
|
|
Orientation = LayoutOrientation.Vertical
|
2020-04-12 00:59:44 -05:00
|
|
|
};
|
|
|
|
|
|
2020-04-08 06:07:54 -05:00
|
|
|
//Gamemode Name
|
|
|
|
|
var gamemodeLabel = new RichTextLabel();
|
2021-12-12 05:09:47 -08:00
|
|
|
gamemodeLabel.SetMarkup(Loc.GetString("round-end-summary-window-gamemode-name-label", ("gamemode", gamemode)));
|
|
|
|
|
roundEndSummaryContainer.AddChild(gamemodeLabel);
|
|
|
|
|
|
|
|
|
|
//Duration
|
|
|
|
|
var roundTimeLabel = new RichTextLabel();
|
|
|
|
|
roundTimeLabel.SetMarkup(Loc.GetString("round-end-summary-window-duration-label",
|
|
|
|
|
("hours", roundDuration.Hours),
|
|
|
|
|
("minutes", roundDuration.Minutes),
|
|
|
|
|
("seconds", roundDuration.Seconds)));
|
|
|
|
|
roundEndSummaryContainer.AddChild(roundTimeLabel);
|
2020-04-08 06:07:54 -05:00
|
|
|
|
2020-08-20 18:09:29 +02:00
|
|
|
//Round end text
|
|
|
|
|
if (!string.IsNullOrEmpty(roundEnd))
|
|
|
|
|
{
|
2020-09-13 14:23:52 +02:00
|
|
|
var roundEndLabel = new RichTextLabel();
|
2021-12-12 05:09:47 -08:00
|
|
|
roundEndLabel.SetMarkup(roundEnd);
|
|
|
|
|
roundEndSummaryContainer.AddChild(roundEndLabel);
|
2020-08-20 18:09:29 +02:00
|
|
|
}
|
|
|
|
|
|
2021-12-12 05:09:47 -08:00
|
|
|
roundEndSummaryContainerScrollbox.AddChild(roundEndSummaryContainer);
|
|
|
|
|
roundEndSummaryTab.AddChild(roundEndSummaryContainerScrollbox);
|
|
|
|
|
|
|
|
|
|
return roundEndSummaryTab;
|
|
|
|
|
}
|
2020-04-08 23:51:49 -05:00
|
|
|
|
2021-12-12 05:09:47 -08:00
|
|
|
private BoxContainer MakePlayerManifestoTab(RoundEndMessageEvent.RoundEndPlayerInfo[] playersInfo)
|
|
|
|
|
{
|
|
|
|
|
var playerManifestTab = new BoxContainer
|
|
|
|
|
{
|
|
|
|
|
Orientation = LayoutOrientation.Vertical,
|
|
|
|
|
Name = Loc.GetString("round-end-summary-window-player-manifesto-tab-title")
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var playerInfoContainerScrollbox = new ScrollContainer
|
2021-06-21 02:13:54 +02:00
|
|
|
{
|
|
|
|
|
VerticalExpand = true
|
|
|
|
|
};
|
2021-12-12 05:09:47 -08:00
|
|
|
var playerInfoContainer = new BoxContainer
|
2021-07-18 18:39:31 +02:00
|
|
|
{
|
|
|
|
|
Orientation = LayoutOrientation.Vertical
|
|
|
|
|
};
|
2020-04-08 23:51:49 -05:00
|
|
|
|
2020-08-22 12:45:49 +02:00
|
|
|
//Put observers at the bottom of the list. Put antags on top.
|
2021-12-12 05:09:47 -08:00
|
|
|
var sortedPlayersInfo = playersInfo.OrderBy(p => p.Observer).ThenBy(p => !p.Antag);
|
|
|
|
|
|
2020-04-11 10:31:44 -05:00
|
|
|
//Create labels for each player info.
|
2021-12-12 05:09:47 -08:00
|
|
|
foreach (var playerInfo in sortedPlayersInfo)
|
2020-04-08 23:51:49 -05:00
|
|
|
{
|
2021-02-21 12:38:56 +01:00
|
|
|
var playerInfoText = new RichTextLabel();
|
2020-04-12 00:59:44 -05:00
|
|
|
|
2021-03-16 15:50:20 +01:00
|
|
|
if (playerInfo.PlayerICName != null)
|
2020-08-22 12:45:49 +02:00
|
|
|
{
|
2021-03-16 15:50:20 +01:00
|
|
|
if (playerInfo.Observer)
|
|
|
|
|
{
|
|
|
|
|
playerInfoText.SetMarkup(
|
2021-06-21 02:13:54 +02:00
|
|
|
Loc.GetString("round-end-summary-window-player-info-if-observer-text",
|
2021-12-12 05:09:47 -08:00
|
|
|
("playerOOCName", playerInfo.PlayerOOCName),
|
2021-06-21 02:13:54 +02:00
|
|
|
("playerICName", playerInfo.PlayerICName)));
|
2021-03-16 15:50:20 +01:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//TODO: On Hover display a popup detailing more play info.
|
|
|
|
|
//For example: their antag goals and if they completed them sucessfully.
|
|
|
|
|
var icNameColor = playerInfo.Antag ? "red" : "white";
|
|
|
|
|
playerInfoText.SetMarkup(
|
2021-06-21 02:13:54 +02:00
|
|
|
Loc.GetString("round-end-summary-window-player-info-if-not-observer-text",
|
|
|
|
|
("playerOOCName", playerInfo.PlayerOOCName),
|
|
|
|
|
("icNameColor", icNameColor),
|
2021-12-12 05:09:47 -08:00
|
|
|
("playerICName", playerInfo.PlayerICName),
|
2021-06-21 02:13:54 +02:00
|
|
|
("playerRole", Loc.GetString(playerInfo.Role))));
|
2021-03-16 15:50:20 +01:00
|
|
|
}
|
2020-08-22 12:45:49 +02:00
|
|
|
}
|
2021-12-12 05:09:47 -08:00
|
|
|
playerInfoContainer.AddChild(playerInfoText);
|
2020-04-08 23:51:49 -05:00
|
|
|
}
|
2020-04-10 01:37:14 -05:00
|
|
|
|
2021-12-12 05:09:47 -08:00
|
|
|
playerInfoContainerScrollbox.AddChild(playerInfoContainer);
|
|
|
|
|
playerManifestTab.AddChild(playerInfoContainerScrollbox);
|
2020-04-11 10:31:44 -05:00
|
|
|
|
2021-12-12 05:09:47 -08:00
|
|
|
return playerManifestTab;
|
2020-04-08 06:07:54 -05:00
|
|
|
}
|
|
|
|
|
}
|
2020-04-08 23:51:49 -05:00
|
|
|
|
2020-04-08 06:07:54 -05:00
|
|
|
}
|