2020-04-08 06:07:54 -05:00
using Robust.Client.Graphics ;
using Robust.Client.Interfaces.Input ;
using Robust.Client.Interfaces.ResourceManagement ;
using Robust.Client.ResourceManagement ;
using Robust.Client.UserInterface.Controls ;
using Robust.Client.UserInterface.CustomControls ;
using Robust.Shared.IoC ;
using Robust.Shared.Localization ;
using Robust.Shared.Maths ;
using Content.Client.Utility ;
2020-04-08 23:51:49 -05:00
using Robust.Client.Player ;
using System.Linq ;
2020-04-10 01:37:14 -05:00
using System.Collections.Generic ;
2020-04-08 23:51:49 -05:00
using static Robust . Client . UserInterface . Controls . ItemList ;
2020-04-10 01:37:14 -05:00
using static Content . Shared . SharedGameTicker ;
2020-04-14 23:26:37 -05:00
using System ;
2020-04-08 06:07:54 -05:00
namespace Content.Client.UserInterface
{
public sealed class RoundEndSummaryWindow : SS14Window
{
2020-04-12 00:59:44 -05:00
private VBoxContainer RoundEndSummaryTab { get ; }
private VBoxContainer PlayerManifestoTab { get ; }
private TabContainer RoundEndWindowTabs { get ; }
2020-04-08 06:07:54 -05:00
protected override Vector2 ? CustomSize = > ( 520 , 580 ) ;
2020-04-14 23:26:37 -05:00
public RoundEndSummaryWindow ( string gm , TimeSpan roundTimeSpan , List < RoundEndPlayerInfo > info )
2020-04-08 06:07:54 -05:00
{
2020-04-12 00:59:44 -05:00
2020-04-08 19:09:02 -05:00
Title = Loc . GetString ( "Round End Summary" ) ;
2020-04-12 00:59:44 -05:00
//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.
RoundEndSummaryTab = new VBoxContainer ( )
{
Name = Loc . GetString ( "Round Information" )
} ;
//Tab for listing unique info per player.
PlayerManifestoTab = new VBoxContainer ( )
{
Name = Loc . GetString ( "Player Manifesto" )
} ;
RoundEndWindowTabs = new TabContainer ( ) ;
RoundEndWindowTabs . AddChild ( RoundEndSummaryTab ) ;
RoundEndWindowTabs . AddChild ( PlayerManifestoTab ) ;
Contents . AddChild ( RoundEndWindowTabs ) ;
2020-04-08 06:07:54 -05:00
//Gamemode Name
var gamemodeLabel = new RichTextLabel ( ) ;
2020-04-08 23:51:49 -05:00
gamemodeLabel . SetMarkup ( Loc . GetString ( "Round of [color=white]{0}[/color] has ended." , gm ) ) ;
2020-04-12 00:59:44 -05:00
RoundEndSummaryTab . AddChild ( gamemodeLabel ) ;
2020-04-08 06:07:54 -05:00
2020-04-14 23:26:37 -05:00
//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 ) ;
2020-04-08 23:51:49 -05:00
2020-04-11 10:31:44 -05:00
//Initialize what will be the list of players display.
var scrollContainer = new ScrollContainer ( ) ;
scrollContainer . SizeFlagsVertical = SizeFlags . FillExpand ;
var innerScrollContainer = new VBoxContainer ( ) ;
2020-04-08 23:51:49 -05:00
2020-04-12 00:59:44 -05:00
//Put antags on top of the list.
var manifestSortedList = info . OrderBy ( p = > ! p . Antag ) ;
2020-04-11 10:31:44 -05:00
//Create labels for each player info.
2020-04-12 00:59:44 -05:00
foreach ( var plyinfo in manifestSortedList )
2020-04-08 23:51:49 -05:00
{
2020-04-11 10:31:44 -05:00
2020-04-12 00:59:44 -05:00
var playerInfoText = new RichTextLabel ( )
{
SizeFlagsVertical = SizeFlags . Fill
} ;
//TODO: On Hover display a popup detailing more play info.
//For example: their antag goals and if they completed them sucessfully.
var icNameColor = plyinfo . Antag ? "red" : "white" ;
playerInfoText . SetMarkup (
Loc . GetString ( $"[color=gray]{plyinfo.PlayerOOCName}[/color] was [color={icNameColor}]{plyinfo.PlayerICName}[/color] playing role of [color=orange]{plyinfo.Role}[/color]." ) ) ;
2020-04-11 10:31:44 -05:00
innerScrollContainer . AddChild ( playerInfoText ) ;
2020-04-08 23:51:49 -05:00
}
2020-04-10 01:37:14 -05:00
2020-04-11 10:31:44 -05:00
scrollContainer . AddChild ( innerScrollContainer ) ;
//Attach the entire ScrollContainer that holds all the playerinfo.
2020-04-12 00:59:44 -05:00
PlayerManifestoTab . AddChild ( scrollContainer ) ;
2020-04-11 10:31:44 -05:00
//Finally, display the window.
2020-04-08 06:07:54 -05:00
OpenCentered ( ) ;
MoveToFront ( ) ;
}
2020-04-12 00:59:44 -05:00
2020-04-08 06:07:54 -05:00
}
2020-04-08 23:51:49 -05:00
2020-04-08 06:07:54 -05:00
}