Make round end summary scroll (#5740)
This commit is contained in:
@@ -1,21 +1,16 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Client.Message;
|
using Content.Client.Message;
|
||||||
using Content.Shared.GameTicking;
|
using Content.Shared.GameTicking;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Client.UserInterface.CustomControls;
|
using Robust.Client.UserInterface.CustomControls;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using static Content.Shared.GameTicking.SharedGameTicker;
|
|
||||||
using static Robust.Client.UserInterface.Controls.BoxContainer;
|
using static Robust.Client.UserInterface.Controls.BoxContainer;
|
||||||
|
|
||||||
namespace Content.Client.RoundEnd
|
namespace Content.Client.RoundEnd
|
||||||
{
|
{
|
||||||
public sealed class RoundEndSummaryWindow : SS14Window
|
public sealed class RoundEndSummaryWindow : SS14Window
|
||||||
{
|
{
|
||||||
private BoxContainer RoundEndSummaryTab { get; }
|
|
||||||
private BoxContainer PlayerManifestoTab { get; }
|
|
||||||
private TabContainer RoundEndWindowTabs { get; }
|
|
||||||
|
|
||||||
public RoundEndSummaryWindow(string gm, string roundEnd, TimeSpan roundTimeSpan, RoundEndMessageEvent.RoundEndPlayerInfo[] info)
|
public RoundEndSummaryWindow(string gm, string roundEnd, TimeSpan roundTimeSpan, RoundEndMessageEvent.RoundEndPlayerInfo[] info)
|
||||||
{
|
{
|
||||||
@@ -23,65 +18,88 @@ namespace Content.Client.RoundEnd
|
|||||||
|
|
||||||
Title = Loc.GetString("round-end-summary-window-title");
|
Title = Loc.GetString("round-end-summary-window-title");
|
||||||
|
|
||||||
//Round End Window is split into two tabs, one about the round stats
|
// 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.
|
// 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.",
|
// 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.
|
// "clown slipped the crew x times.", "x shots were fired this round.", etc.
|
||||||
//Also good for serious info.
|
// Also good for serious info.
|
||||||
RoundEndSummaryTab = new BoxContainer
|
|
||||||
|
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
|
||||||
{
|
{
|
||||||
Orientation = LayoutOrientation.Vertical,
|
Orientation = LayoutOrientation.Vertical,
|
||||||
Name = Loc.GetString("round-end-summary-window-round-end-summary-tab-title")
|
Name = Loc.GetString("round-end-summary-window-round-end-summary-tab-title")
|
||||||
};
|
};
|
||||||
|
|
||||||
//Tab for listing unique info per player.
|
var roundEndSummaryContainerScrollbox = new ScrollContainer
|
||||||
PlayerManifestoTab = new BoxContainer
|
|
||||||
{
|
{
|
||||||
Orientation = LayoutOrientation.Vertical,
|
VerticalExpand = true
|
||||||
Name = Loc.GetString("round-end-summary-window-player-manifesto-tab-title")
|
};
|
||||||
|
var roundEndSummaryContainer = new BoxContainer
|
||||||
|
{
|
||||||
|
Orientation = LayoutOrientation.Vertical
|
||||||
};
|
};
|
||||||
|
|
||||||
RoundEndWindowTabs = new TabContainer();
|
|
||||||
RoundEndWindowTabs.AddChild(RoundEndSummaryTab);
|
|
||||||
RoundEndWindowTabs.AddChild(PlayerManifestoTab);
|
|
||||||
|
|
||||||
Contents.AddChild(RoundEndWindowTabs);
|
|
||||||
|
|
||||||
//Gamemode Name
|
//Gamemode Name
|
||||||
var gamemodeLabel = new RichTextLabel();
|
var gamemodeLabel = new RichTextLabel();
|
||||||
gamemodeLabel.SetMarkup(Loc.GetString("round-end-summary-window-gamemode-name-label", ("gamemode",gm)));
|
gamemodeLabel.SetMarkup(Loc.GetString("round-end-summary-window-gamemode-name-label", ("gamemode", gamemode)));
|
||||||
RoundEndSummaryTab.AddChild(gamemodeLabel);
|
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);
|
||||||
|
|
||||||
//Round end text
|
//Round end text
|
||||||
if (!string.IsNullOrEmpty(roundEnd))
|
if (!string.IsNullOrEmpty(roundEnd))
|
||||||
{
|
{
|
||||||
var roundEndLabel = new RichTextLabel();
|
var roundEndLabel = new RichTextLabel();
|
||||||
roundEndLabel.SetMarkup(Loc.GetString(roundEnd));
|
roundEndLabel.SetMarkup(roundEnd);
|
||||||
RoundEndSummaryTab.AddChild(roundEndLabel);
|
roundEndSummaryContainer.AddChild(roundEndLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Duration
|
roundEndSummaryContainerScrollbox.AddChild(roundEndSummaryContainer);
|
||||||
var roundTimeLabel = new RichTextLabel();
|
roundEndSummaryTab.AddChild(roundEndSummaryContainerScrollbox);
|
||||||
roundTimeLabel.SetMarkup(Loc.GetString("round-end-summary-window-duration-label",
|
|
||||||
("hours",roundTimeSpan.Hours),
|
|
||||||
("minutes",roundTimeSpan.Minutes),
|
|
||||||
("seconds",roundTimeSpan.Seconds)));
|
|
||||||
RoundEndSummaryTab.AddChild(roundTimeLabel);
|
|
||||||
|
|
||||||
//Initialize what will be the list of players display.
|
return roundEndSummaryTab;
|
||||||
var scrollContainer = new ScrollContainer
|
}
|
||||||
|
|
||||||
|
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
|
||||||
{
|
{
|
||||||
VerticalExpand = true
|
VerticalExpand = true
|
||||||
};
|
};
|
||||||
var innerScrollContainer = new BoxContainer
|
var playerInfoContainer = new BoxContainer
|
||||||
{
|
{
|
||||||
Orientation = LayoutOrientation.Vertical
|
Orientation = LayoutOrientation.Vertical
|
||||||
};
|
};
|
||||||
|
|
||||||
//Put observers at the bottom of the list. Put antags on top.
|
//Put observers at the bottom of the list. Put antags on top.
|
||||||
var manifestSortedList = info.OrderBy(p => p.Observer).ThenBy(p => !p.Antag);
|
var sortedPlayersInfo = playersInfo.OrderBy(p => p.Observer).ThenBy(p => !p.Antag);
|
||||||
|
|
||||||
//Create labels for each player info.
|
//Create labels for each player info.
|
||||||
foreach (var playerInfo in manifestSortedList)
|
foreach (var playerInfo in sortedPlayersInfo)
|
||||||
{
|
{
|
||||||
var playerInfoText = new RichTextLabel();
|
var playerInfoText = new RichTextLabel();
|
||||||
|
|
||||||
@@ -91,7 +109,7 @@ namespace Content.Client.RoundEnd
|
|||||||
{
|
{
|
||||||
playerInfoText.SetMarkup(
|
playerInfoText.SetMarkup(
|
||||||
Loc.GetString("round-end-summary-window-player-info-if-observer-text",
|
Loc.GetString("round-end-summary-window-player-info-if-observer-text",
|
||||||
("playerOOCName",playerInfo.PlayerOOCName),
|
("playerOOCName", playerInfo.PlayerOOCName),
|
||||||
("playerICName", playerInfo.PlayerICName)));
|
("playerICName", playerInfo.PlayerICName)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -103,20 +121,17 @@ namespace Content.Client.RoundEnd
|
|||||||
Loc.GetString("round-end-summary-window-player-info-if-not-observer-text",
|
Loc.GetString("round-end-summary-window-player-info-if-not-observer-text",
|
||||||
("playerOOCName", playerInfo.PlayerOOCName),
|
("playerOOCName", playerInfo.PlayerOOCName),
|
||||||
("icNameColor", icNameColor),
|
("icNameColor", icNameColor),
|
||||||
("playerICName",playerInfo.PlayerICName),
|
("playerICName", playerInfo.PlayerICName),
|
||||||
("playerRole", Loc.GetString(playerInfo.Role))));
|
("playerRole", Loc.GetString(playerInfo.Role))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
innerScrollContainer.AddChild(playerInfoText);
|
playerInfoContainer.AddChild(playerInfoText);
|
||||||
}
|
}
|
||||||
|
|
||||||
scrollContainer.AddChild(innerScrollContainer);
|
playerInfoContainerScrollbox.AddChild(playerInfoContainer);
|
||||||
//Attach the entire ScrollContainer that holds all the playerinfo.
|
playerManifestTab.AddChild(playerInfoContainerScrollbox);
|
||||||
PlayerManifestoTab.AddChild(scrollContainer);
|
|
||||||
|
|
||||||
//Finally, display the window.
|
return playerManifestTab;
|
||||||
OpenCentered();
|
|
||||||
MoveToFront();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user