Change frm ItemList to list of labels with markup
This commit is contained in:
@@ -18,59 +18,48 @@ namespace Content.Client.UserInterface
|
|||||||
{
|
{
|
||||||
public sealed class RoundEndSummaryWindow : SS14Window
|
public sealed class RoundEndSummaryWindow : SS14Window
|
||||||
{
|
{
|
||||||
|
|
||||||
#pragma warning disable 649
|
|
||||||
[Dependency] private IPlayerManager _playerManager;
|
|
||||||
#pragma warning restore 649
|
|
||||||
|
|
||||||
private readonly int _headerFontSize = 14;
|
|
||||||
private VBoxContainer VBox { get; }
|
private VBoxContainer VBox { get; }
|
||||||
private ItemList _playerList;
|
|
||||||
|
|
||||||
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, uint duration, List<RoundEndPlayerInfo> info )
|
||||||
{
|
{
|
||||||
Title = Loc.GetString("Round End Summary");
|
Title = Loc.GetString("Round End Summary");
|
||||||
|
VBox = new VBoxContainer();
|
||||||
var cache = IoCManager.Resolve<IResourceCache>();
|
Contents.AddChild(VBox);
|
||||||
var inputManager = IoCManager.Resolve<IInputManager>();
|
|
||||||
Font headerFont = new VectorFont(cache.GetResource<FontResource>("/Nano/NotoSans/NotoSans-Regular.ttf"), _headerFontSize);
|
|
||||||
|
|
||||||
var scrollContainer = new ScrollContainer();
|
|
||||||
scrollContainer.AddChild(VBox = new VBoxContainer());
|
|
||||||
Contents.AddChild(scrollContainer);
|
|
||||||
|
|
||||||
//Gamemode Name
|
//Gamemode Name
|
||||||
var gamemodeLabel = new RichTextLabel();
|
var gamemodeLabel = new RichTextLabel();
|
||||||
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));
|
||||||
VBox.AddChild(gamemodeLabel);
|
VBox.AddChild(gamemodeLabel);
|
||||||
|
|
||||||
//Duration
|
//Duration
|
||||||
var roundDurationInfo = new RichTextLabel();
|
//var roundDurationInfo = new RichTextLabel();
|
||||||
roundDurationInfo.SetMarkup(Loc.GetString("The round lasted for [color=yellow]{0}[/color] hours.", duration));
|
//roundDurationInfo.SetMarkup(Loc.GetString("The round lasted for [color=yellow]{0}[/color] hours.", duration));
|
||||||
VBox.AddChild(roundDurationInfo);
|
//VBox.AddChild(roundDurationInfo);
|
||||||
|
|
||||||
|
|
||||||
//Populate list of players.
|
//Initialize what will be the list of players display.
|
||||||
_playerManager = IoCManager.Resolve<IPlayerManager>();
|
var scrollContainer = new ScrollContainer();
|
||||||
_playerList = new ItemList()
|
scrollContainer.SizeFlagsVertical = SizeFlags.FillExpand;
|
||||||
{
|
var innerScrollContainer = new VBoxContainer();
|
||||||
SizeFlagsStretchRatio = 8,
|
|
||||||
SizeFlagsVertical = SizeFlags.FillExpand,
|
|
||||||
SelectMode = ItemList.ItemListSelectMode.Button
|
|
||||||
};
|
|
||||||
|
|
||||||
foreach(var plyinfo in info)
|
//Create labels for each player info.
|
||||||
|
foreach (var plyinfo in info)
|
||||||
{
|
{
|
||||||
var oocName = plyinfo.PlayerOOCName;
|
var oocName = plyinfo.PlayerOOCName;
|
||||||
var icName = plyinfo.PlayerICName;
|
var icName = plyinfo.PlayerICName;
|
||||||
var role = plyinfo.Role;
|
var role = plyinfo.Role;
|
||||||
var wasAntag = plyinfo.Antag;
|
var wasAntag = plyinfo.Antag;
|
||||||
_playerList.AddItem($"{oocName} was {icName} playing role of {role}.");
|
|
||||||
|
var playerInfoText = new RichTextLabel();
|
||||||
|
playerInfoText.SetMarkup(Loc.GetString($"[color=gray]{oocName}[/color] was [color=white]{icName}[/color] playing role of [color=orange]{role}[/color]."));
|
||||||
|
innerScrollContainer.AddChild(playerInfoText);
|
||||||
}
|
}
|
||||||
|
|
||||||
VBox.AddChild(_playerList);
|
scrollContainer.AddChild(innerScrollContainer);
|
||||||
|
//Attach the entire ScrollContainer that holds all the playerinfo.
|
||||||
|
VBox.AddChild(scrollContainer);
|
||||||
|
|
||||||
|
//Finally, display the window.
|
||||||
OpenCentered();
|
OpenCentered();
|
||||||
MoveToFront();
|
MoveToFront();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user