* Basic voting * Rewrite lobby in XAML. Working lobby voting. * Escape menu is now XAML. * Vote menu works, custom votes, gamemode votes. * Vote timeouts & administration. Basically done now. * I will now pretend I was never planning to code voting hotkeys. * Make vote call UI a bit... funny. * Fix exception on round restart. * Fix some vote command definitions.
125 lines
3.9 KiB
C#
125 lines
3.9 KiB
C#
using Content.Client.Chat;
|
|
using Content.Client.Interfaces;
|
|
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.Graphics;
|
|
using Robust.Client.UserInterface;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Client.UserInterface.XAML;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Maths;
|
|
|
|
namespace Content.Client.UserInterface
|
|
{
|
|
[GenerateTypedNameReferences]
|
|
internal sealed partial class LobbyGui : Control
|
|
{
|
|
public Label ServerName => CServerName;
|
|
public Label StartTime => CStartTime;
|
|
public Button ReadyButton => CReadyButton;
|
|
public Button ObserveButton => CObserveButton;
|
|
public Button OptionsButton => COptionsButton;
|
|
public Button LeaveButton => CLeaveButton;
|
|
public ChatBox Chat => CChat;
|
|
public VBoxContainer VoteContainer => CVoteContainer;
|
|
public LobbyPlayerList OnlinePlayerList => COnlinePlayerList;
|
|
public ServerInfo ServerInfo => CServerInfo;
|
|
public LobbyCharacterPreviewPanel CharacterPreview { get; }
|
|
|
|
public LobbyGui(IEntityManager entityManager,
|
|
IClientPreferencesManager preferencesManager)
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
|
|
ServerName.SizeFlagsHorizontal = SizeFlags.Expand | SizeFlags.ShrinkCenter;
|
|
|
|
CharacterPreview = new LobbyCharacterPreviewPanel(
|
|
entityManager,
|
|
preferencesManager)
|
|
{
|
|
SizeFlagsHorizontal = SizeFlags.None
|
|
};
|
|
|
|
CLeftPanelContainer.AddChild(CharacterPreview);
|
|
CharacterPreview.SetPositionFirst();
|
|
}
|
|
}
|
|
|
|
public class LobbyPlayerList : Control
|
|
{
|
|
private readonly ScrollContainer _scroll;
|
|
private readonly VBoxContainer _vBox;
|
|
|
|
public LobbyPlayerList()
|
|
{
|
|
var panel = new PanelContainer()
|
|
{
|
|
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#202028")},
|
|
};
|
|
_vBox = new VBoxContainer();
|
|
_scroll = new ScrollContainer();
|
|
_scroll.AddChild(_vBox);
|
|
panel.AddChild(_scroll);
|
|
AddChild(panel);
|
|
}
|
|
|
|
// Adds a row
|
|
public void AddItem(string name, string status)
|
|
{
|
|
var hbox = new HBoxContainer
|
|
{
|
|
SizeFlagsHorizontal = SizeFlags.FillExpand,
|
|
};
|
|
|
|
// Player Name
|
|
hbox.AddChild(new PanelContainer()
|
|
{
|
|
PanelOverride = new StyleBoxFlat
|
|
{
|
|
BackgroundColor = Color.FromHex("#373744"),
|
|
ContentMarginBottomOverride = 2,
|
|
ContentMarginLeftOverride = 4,
|
|
ContentMarginRightOverride = 4,
|
|
ContentMarginTopOverride = 2
|
|
},
|
|
Children =
|
|
{
|
|
new Label
|
|
{
|
|
Text = name
|
|
}
|
|
},
|
|
SizeFlagsHorizontal = SizeFlags.FillExpand
|
|
});
|
|
// Status
|
|
hbox.AddChild(new PanelContainer()
|
|
{
|
|
PanelOverride = new StyleBoxFlat
|
|
{
|
|
BackgroundColor = Color.FromHex("#373744"),
|
|
ContentMarginBottomOverride = 2,
|
|
ContentMarginLeftOverride = 4,
|
|
ContentMarginRightOverride = 4,
|
|
ContentMarginTopOverride = 2
|
|
},
|
|
Children =
|
|
{
|
|
new Label
|
|
{
|
|
Text = status
|
|
}
|
|
},
|
|
SizeFlagsHorizontal = SizeFlags.FillExpand,
|
|
SizeFlagsStretchRatio = 0.2f,
|
|
});
|
|
|
|
_vBox.AddChild(hbox);
|
|
}
|
|
|
|
// Deletes all rows
|
|
public void Clear()
|
|
{
|
|
_vBox.RemoveAllChildren();
|
|
}
|
|
}
|
|
}
|