- add: new lobby and ui tweaks. (#7)

* base

* arrow pointer for buttons

* some progress for text buttons, need cleaning

* fixed observe button, remove fraction

* just for now

* ui tweaks

* more ui tweaks

* feat: ченджлог в лобби

---------

Co-authored-by: Remuchi <RemuchiOfficial@gmail.com>
This commit is contained in:
rhailrake
2024-01-31 12:54:38 +00:00
committed by GitHub
parent 7c6beaa70f
commit 7872502bf8
97 changed files with 1187 additions and 339 deletions

View File

@@ -1,9 +1,14 @@
using System.Linq;
using System.Numerics;
using Content.Client._Ohio.Buttons;
using Content.Client.Changelog;
using Content.Client.GameTicking.Managers;
using Content.Client.LateJoin;
using Content.Client.Lobby.UI;
using Content.Client.Message;
using Content.Client.Preferences;
using Content.Client.Preferences.UI;
using Content.Client.Resources;
using Content.Client.UserInterface.Systems.Chat;
using Content.Client.Voting;
using Robust.Client;
@@ -14,7 +19,7 @@ using Robust.Client.UserInterface.Controls;
using Robust.Shared.Configuration;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
namespace Content.Client.Lobby
{
@@ -30,12 +35,14 @@ namespace Content.Client.Lobby
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IVoteManager _voteManager = default!;
[Dependency] private readonly IConfigurationManager _configurationManager = default!;
[Dependency] private readonly ChangelogManager _changelog = default!;
[ViewVariables] private CharacterSetupGui? _characterSetup;
private ClientGameTicker _gameTicker = default!;
protected override Type? LinkedScreenType { get; } = typeof(LobbyGui);
private LobbyGui? _lobby;
protected override void Startup()
@@ -48,12 +55,16 @@ namespace Content.Client.Lobby
_lobby = (LobbyGui) _userInterfaceManager.ActiveScreen;
var chatController = _userInterfaceManager.GetUIController<ChatUIController>();
_gameTicker = _entityManager.System<ClientGameTicker>();
_characterSetup = new CharacterSetupGui(_entityManager, _resourceCache, _preferencesManager,
_prototypeManager, _configurationManager);
LayoutContainer.SetAnchorPreset(_characterSetup, LayoutContainer.LayoutPreset.Wide);
_lobby.CharacterSetupState.AddChild(_characterSetup);
chatController.SetMainChat(true);
_voteManager.SetPopupContainer(_lobby.VoteContainer);
@@ -66,14 +77,16 @@ namespace Content.Client.Lobby
_characterSetup.SaveButton.OnPressed += _ =>
{
_characterSetup.Save();
_lobby.CharacterPreview.UpdateUI();
//_lobby.CharacterPreview.UpdateUI();
};
LayoutContainer.SetAnchorPreset(_lobby, LayoutContainer.LayoutPreset.Wide);
_lobby.ServerName.Text = _baseClient.GameInfo?.ServerName; //The eye of refactor gazes upon you...
UpdateLobbyUi();
_lobby.CharacterPreview.CharacterSetupButton.OnPressed += OnSetupPressed;
_lobby.CharacterSetupButton.OnPressed += OnSetupPressed;
_lobby.ReadyButton.OnPressed += OnReadyPressed;
_lobby.ReadyButton.OnToggled += OnReadyToggled;
@@ -83,20 +96,23 @@ namespace Content.Client.Lobby
_preferencesManager.OnServerDataLoaded += PreferencesDataLoaded;
_lobby.CharacterPreview.UpdateUI();
//_lobby.CharacterPreview.UpdateUI();
PopulateChangelog();
}
protected override void Shutdown()
{
var chatController = _userInterfaceManager.GetUIController<ChatUIController>();
chatController.SetMainChat(false);
_gameTicker.InfoBlobUpdated -= UpdateLobbyUi;
_gameTicker.LobbyStatusUpdated -= LobbyStatusUpdated;
_gameTicker.LobbyLateJoinStatusUpdated -= LobbyLateJoinStatusUpdated;
_voteManager.ClearPopupContainer();
_lobby!.CharacterPreview.CharacterSetupButton.OnPressed -= OnSetupPressed;
_lobby!.CharacterSetupButton.OnPressed -= OnSetupPressed;
_lobby!.ReadyButton.OnPressed -= OnReadyPressed;
_lobby!.ReadyButton.OnToggled -= OnReadyToggled;
@@ -110,7 +126,7 @@ namespace Content.Client.Lobby
private void PreferencesDataLoaded()
{
_lobby?.CharacterPreview.UpdateUI();
//_lobby?.CharacterPreview.UpdateUI();
}
private void OnSetupPressed(BaseButton.ButtonEventArgs args)
@@ -140,11 +156,12 @@ namespace Content.Client.Lobby
{
_lobby!.StartTime.Text = string.Empty;
var roundTime = _gameTiming.CurTime.Subtract(_gameTicker.RoundStartTimeSpan);
_lobby!.StationTime.Text = Loc.GetString("lobby-state-player-status-round-time", ("hours", roundTime.Hours), ("minutes", roundTime.Minutes));
_lobby!.StationTime.Text = Loc.GetString("lobby-state-player-status-round-time",
("hours", roundTime.Hours), ("minutes", roundTime.Minutes));
return;
}
_lobby!.StationTime.Text = Loc.GetString("lobby-state-player-status-round-not-started");
string text;
if (_gameTicker.Paused)
@@ -162,7 +179,9 @@ namespace Content.Client.Lobby
var seconds = difference.TotalSeconds;
if (seconds < 0)
{
text = Loc.GetString(seconds < -5 ? "lobby-state-right-now-question" : "lobby-state-right-now-confirmation");
text = Loc.GetString(seconds < -5
? "lobby-state-right-now-question"
: "lobby-state-right-now-confirmation");
}
else
{
@@ -175,7 +194,6 @@ namespace Content.Client.Lobby
private void LobbyStatusUpdated()
{
UpdateLobbyBackground();
UpdateLobbyUi();
}
@@ -188,7 +206,7 @@ namespace Content.Client.Lobby
{
if (_gameTicker.IsGameStarted)
{
_lobby!.ReadyButton.Text = Loc.GetString("lobby-state-ready-button-join-state");
MakeButtonJoinGame(_lobby!.ReadyButton);
_lobby!.ReadyButton.ToggleMode = false;
_lobby!.ReadyButton.Pressed = false;
_lobby!.ObserveButton.Disabled = false;
@@ -196,7 +214,12 @@ namespace Content.Client.Lobby
else
{
_lobby!.StartTime.Text = string.Empty;
_lobby!.ReadyButton.Text = Loc.GetString(_lobby!.ReadyButton.Pressed ? "lobby-state-player-status-ready": "lobby-state-player-status-not-ready");
if (_lobby!.ReadyButton.Pressed)
MakeButtonReady(_lobby!.ReadyButton);
else
MakeButtonUnReady(_lobby!.ReadyButton);
_lobby!.ReadyButton.ToggleMode = true;
_lobby!.ReadyButton.Disabled = false;
_lobby!.ReadyButton.Pressed = _gameTicker.AreWeReady;
@@ -208,41 +231,9 @@ namespace Content.Client.Lobby
_lobby!.ServerInfo.SetInfoBlob(_gameTicker.ServerInfoBlob);
}
if (_gameTicker.LobbySong == null)
{
_lobby!.LobbySong.SetMarkup(Loc.GetString("lobby-state-song-no-song-text"));
}
else if (_resourceCache.TryGetResource<AudioResource>(_gameTicker.LobbySong, out var lobbySongResource))
{
var lobbyStream = lobbySongResource.AudioStream;
var title = string.IsNullOrEmpty(lobbyStream.Title) ?
Loc.GetString("lobby-state-song-unknown-title") :
lobbyStream.Title;
var artist = string.IsNullOrEmpty(lobbyStream.Artist) ?
Loc.GetString("lobby-state-song-unknown-artist") :
lobbyStream.Artist;
var markup = Loc.GetString("lobby-state-song-text",
("songTitle", title),
("songArtist", artist));
_lobby!.LobbySong.SetMarkup(markup);
}
}
private void UpdateLobbyBackground()
{
if (_gameTicker.LobbyBackground != null)
{
_lobby!.Background.Texture = _resourceCache.GetResource<TextureResource>(_gameTicker.LobbyBackground );
}
else
{
_lobby!.Background.Texture = null;
}
_lobby!.LabelName.SetMarkup("[font=\"Bedstead\" size=20] Green Miracle [/font]");
_lobby!.Version.SetMarkup("Version: 1.0");
_lobby!.ChangelogLabel.SetMarkup("Список изменений:");
}
private void SetReady(bool newReady)
@@ -254,5 +245,100 @@ namespace Content.Client.Lobby
_consoleHost.ExecuteCommand($"toggleready {newReady}");
}
private void MakeButtonReady(OhioLobbyTextButton button)
{
button.ButtonText = "Ready";
}
private void MakeButtonUnReady(OhioLobbyTextButton button)
{
button.ButtonText = "Not Ready";
}
private void MakeButtonJoinGame(OhioLobbyTextButton button)
{
button.ButtonText = "Join Game";
}
private async void PopulateChangelog()
{
_lobby!.ChangelogContainer.Children.Clear();
var changelogs = await _changelog.LoadChangelog();
var whiteChangelog = changelogs.Find(cl => cl.Name == "ChangelogWhite");
if (whiteChangelog is null)
{
_lobby!.ChangelogContainer.Children.Add(
new RichTextLabel().SetMarkup("Не удалось загрузить список изменений"));
return;
}
var entries = whiteChangelog.Entries
.OrderByDescending(c => c.Time)
.Take(5);
foreach (var entry in entries)
{
var box = new BoxContainer
{
Orientation = BoxContainer.LayoutOrientation.Vertical,
HorizontalAlignment = Control.HAlignment.Left,
Children =
{
new Label
{
Align = Label.AlignMode.Left,
Text = $"{entry.Author} {entry.Time.ToShortDateString()}",
FontColorOverride = Color.FromHex("#888"),
Margin = new Thickness(0, 10)
}
}
};
foreach (var change in entry.Changes)
{
var container = new BoxContainer
{
Orientation = BoxContainer.LayoutOrientation.Horizontal,
HorizontalAlignment = Control.HAlignment.Left
};
var text = new RichTextLabel();
text.SetMessage(FormattedMessage.FromMarkup(change.Message));
text.MaxWidth = 350;
container.AddChild(GetIcon(change.Type));
container.AddChild(text);
box.AddChild(container);
}
_lobby!.ChangelogContainer.AddChild(box);
}
}
private TextureRect GetIcon(ChangelogManager.ChangelogLineType type)
{
var (file, color) = type switch
{
ChangelogManager.ChangelogLineType.Add => ("plus.svg.192dpi.png", "#6ED18D"),
ChangelogManager.ChangelogLineType.Remove => ("minus.svg.192dpi.png", "#D16E6E"),
ChangelogManager.ChangelogLineType.Fix => ("bug.svg.192dpi.png", "#D1BA6E"),
ChangelogManager.ChangelogLineType.Tweak => ("wrench.svg.192dpi.png", "#6E96D1"),
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null)
};
return new TextureRect
{
Texture = _resourceCache.GetTexture(new ResPath($"/Textures/Interface/Changelog/{file}")),
VerticalAlignment = Control.VAlignment.Top,
TextureScale = new Vector2(0.5f, 0.5f),
Margin = new Thickness(2, 4, 6, 2),
ModulateSelfOverride = Color.FromHex(color)
};
}
}
}

View File

@@ -1,16 +1,13 @@
using System.Linq;
using System.Numerics;
using Content.Client.Alerts;
using Content.Client.Humanoid;
using Content.Client.Inventory;
using Content.Client.Preferences;
using Content.Client.UserInterface.Controls;
using Content.Shared.GameTicking;
using Content.Shared.Humanoid.Prototypes;
using Content.Shared.Inventory;
using Content.Shared.Preferences;
using Content.Shared.Roles;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Map;
@@ -40,12 +37,12 @@ namespace Content.Client.Lobby.UI
Text = Loc.GetString("lobby-character-preview-panel-header")
};
CharacterSetupButton = new Button
{
Text = Loc.GetString("lobby-character-preview-panel-character-setup-button"),
HorizontalAlignment = HAlignment.Center,
Margin = new Thickness(0, 5, 0, 0),
};
// CharacterSetupButton = new Button
// {
// Text = Loc.GetString("lobby-character-preview-panel-character-setup-button"),
// HorizontalAlignment = HAlignment.Center,
// Margin = new Thickness(0, 5, 0, 0),
// };
_summaryLabel = new Label
{
@@ -69,12 +66,12 @@ namespace Content.Client.Lobby.UI
Orientation = LayoutOrientation.Horizontal,
HorizontalAlignment = HAlignment.Center,
};
var _vSpacer = new VSpacer();
var vSpacer = new VSpacer();
_loaded.AddChild(_summaryLabel);
_loaded.AddChild(_viewBox);
_loaded.AddChild(_vSpacer);
_loaded.AddChild(CharacterSetupButton);
_loaded.AddChild(vSpacer);
//_loaded.AddChild(CharacterSetupButton);
vBox.AddChild(header);
vBox.AddChild(_loaded);
@@ -84,14 +81,18 @@ namespace Content.Client.Lobby.UI
UpdateUI();
}
public Button CharacterSetupButton { get; }
// public Button CharacterSetupButton { get; }
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing) return;
if (_previewDummy != null) _entityManager.DeleteEntity(_previewDummy.Value);
if (!disposing)
return;
if (_previewDummy != null)
_entityManager.DeleteEntity(_previewDummy.Value);
_previewDummy = default;
}
@@ -134,7 +135,7 @@ namespace Content.Client.Lobby.UI
{
var protoMan = IoCManager.Resolve<IPrototypeManager>();
var entMan = IoCManager.Resolve<IEntityManager>();
var invSystem = EntitySystem.Get<ClientInventorySystem>();
var invSystem = entMan.System<ClientInventorySystem>();
var highPriorityJob = profile.JobPriorities.FirstOrDefault(p => p.Value == JobPriority.High).Key;

View File

@@ -1,116 +1,183 @@
<lobbyUi:LobbyGui
xmlns="https://spacestation14.io"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:maths="clr-namespace:Robust.Shared.Maths;assembly=Robust.Shared.Maths"
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
xmlns:vote="clr-namespace:Content.Client.Voting.UI"
xmlns:style="clr-namespace:Content.Client.Stylesheets"
xmlns:lobbyUi="clr-namespace:Content.Client.Lobby.UI"
xmlns:info="clr-namespace:Content.Client.Info"
xmlns:widgets="clr-namespace:Content.Client.UserInterface.Systems.Chat.Widgets">
<lobbyUi:LobbyGui xmlns="https://spacestation14.io"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:maths="clr-namespace:Robust.Shared.Maths;assembly=Robust.Shared.Maths"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
xmlns:style="clr-namespace:Content.Client.Stylesheets"
xmlns:lobbyUi="clr-namespace:Content.Client.Lobby.UI"
xmlns:info="clr-namespace:Content.Client.Info"
xmlns:widgets="clr-namespace:Content.Client.UserInterface.Systems.Chat.Widgets"
xmlns:ui="clr-namespace:Content.Client._Ohio.UI"
xmlns:buttons="clr-namespace:Content.Client._Ohio.Buttons">
<!-- Background -->
<TextureRect Access="Public" VerticalExpand="True" HorizontalExpand="True" Name="Background"
Stretch="KeepAspectCovered" />
<ui:AnimatedBackgroundControl Name="Background" VerticalExpand="True" HorizontalExpand="True"
Stretch="KeepAspectCovered" />
<!-- Main Container -->
<BoxContainer Name="MainContainer" VerticalExpand="True" HorizontalExpand="True" Orientation="Horizontal"
Margin="10 10 10 10" SeparationOverride="2">
<SplitContainer State="Auto" HorizontalExpand="True">
<!-- LHS Controls -->
<BoxContainer Name="LeftSide" Orientation="Vertical" SeparationOverride="4" HorizontalExpand="True">
<Control Name="DefaultState" VerticalExpand="True">
<BoxContainer Name="TopLeft" Orientation="Vertical">
<!-- Left Top Panel -->
<PanelContainer StyleClasses="AngleRect" HorizontalAlignment="Left" Name="LeftSideTop"
VerticalAlignment="Top">
<BoxContainer Orientation="Vertical" HorizontalAlignment="Center" MaxWidth="800">
<info:LinkBanner Name="LinkBanner" VerticalExpand="false" HorizontalAlignment="Center"
Margin="3 3 3 3" />
<controls:StripeBack>
<BoxContainer Orientation="Horizontal" SeparationOverride="6" Margin="3 3 3 3">
<cc:UICommandButton Command="observe" Name="ObserveButton" Access="Public"
Text="{Loc 'ui-lobby-observe-button'}"
StyleClasses="ButtonBig"
WindowType="{x:Type lobbyUi:ObserveWarningWindow}" />
<Label Name="StartTime"
Access="Public"
Align="Left"
FontColorOverride="{x:Static maths:Color.DarkGray}"
StyleClasses="LabelBig" HorizontalExpand="True" />
<Button Name="ReadyButton" Access="Public" ToggleMode="True"
Text="{Loc 'ui-lobby-ready-up-button'}"
StyleClasses="ButtonBig" MinWidth="137" />
</BoxContainer>
</controls:StripeBack>
</BoxContainer>
</PanelContainer>
<BoxContainer Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Top">
<PanelContainer Name="TopRightContainer" MinHeight="350" MinWidth="469" StyleClasses="LobbyGayBackground">
<info:ServerListBox Name="ServerListBox" Access="Public" MinSize="0 30" VerticalExpand="True" HorizontalExpand="True" Margin="3 3 3 3" HorizontalAlignment="Stretch"/>
</PanelContainer>
<!-- Split Container -->
<SplitContainer State="Auto" ResizeMode="NotResizable" HorizontalExpand="True">
<!-- Left Side -->
<BoxContainer Name="LeftSide" Orientation="Vertical" SeparationOverride="4" HorizontalExpand="True">
<!-- Default State -->
<Control Name="DefaultState" VerticalExpand="True">
<!-- Character Setup State -->
<Control Access="Public" Visible="False" Name="CharacterSetupState" VerticalExpand="True" />
<!-- Top Left Panel -->
<PanelContainer Name="TopPanel" MinWidth="722" StyleClasses="LobbyGayBackground"
VerticalExpand="True" HorizontalExpand="True" HorizontalAlignment="Stretch"
VerticalAlignment="Top" Visible="False">
<BoxContainer Orientation="Vertical" HorizontalExpand="True" HorizontalAlignment="Stretch"
Margin="8 8 8 8">
<BoxContainer Orientation="Horizontal" MinSize="0 40" HorizontalAlignment="Center">
<info:LinkBanner Name="LinkBanner" VerticalExpand="True" HorizontalAlignment="Center" />
<Button Name="AHelpButton" Access="Public" Text="{Loc 'ui-lobby-ahelp-button'}"
StyleClasses="Button" />
</BoxContainer>
</BoxContainer>
</PanelContainer>
<!-- Voting Popups -->
<BoxContainer Orientation="Vertical" SeparationOverride="4" Name="VoteContainer"
Access="Public" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0 8" />
</BoxContainer>
<!-- Vertical Padding-->
<!-- Vote Container -->
<BoxContainer Orientation="Vertical" SeparationOverride="4" Name="VoteContainer" Access="Public"
HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0 8" />
<!-- Vertical Padding -->
<Control VerticalExpand="True" />
<!-- Left Bot Panel -->
<ui:OhioRichTextLabel Name="LabelName" Access="Public" HorizontalAlignment="Left"
VerticalAlignment="Center" Margin="0 0 0 350" />
<!-- Ohio Container -->
<PanelContainer HorizontalAlignment="Left" Name="Center" VerticalAlignment="Center">
<BoxContainer Name="OhioContainer" Orientation="Vertical" HorizontalAlignment="Center"
VerticalAlignment="Center" Margin="40 0 0 150">
<buttons:OhioLobbyTextButton
Name="ReadyButton"
Access="Public"
ToggleMode="True"
ButtonText="Ready"
Margin="0 0 0 10" />
<buttons:OhioUICommandButton
Name="ObserveButton"
WindowType="{x:Type lobbyUi:ObserveWarningWindow}"
Access="Public"
ButtonText="Observe"
Margin="0 10 0 10" />
<buttons:OhioLobbyTextButton
Name="CharacterSetupButton"
Access="Public"
ButtonText="Character Setup"
Margin="0 10 0 10" />
<buttons:OhioLobbyTextButton
Name="OptionsButton"
Access="Public"
ButtonText="Options"
Margin="0 10 0 0" />
</BoxContainer>
</PanelContainer>
<BoxContainer Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Bottom">
<info:DevInfoBanner Name="DevInfoBanner" VerticalExpand="false" Margin="3 3 3 3" />
<PanelContainer StyleClasses="AngleRect">
<RichTextLabel Name="LobbySong" Access="Public" HorizontalAlignment="Center" />
<PanelContainer StyleClasses="LobbyGayBackground">
<RichTextLabel Name="Version" Access="Public" HorizontalAlignment="Center" />
</PanelContainer>
</BoxContainer>
<!-- Changelog -->
<PanelContainer Name="Changelog" StyleClasses="LobbyGayBackground" HorizontalAlignment="Right"
VerticalAlignment="Top">
<BoxContainer Orientation="Vertical">
<RichTextLabel Name="ChangelogLabel" Access="Public" HorizontalAlignment="Center" />
<!-- Auto populated via code -->
<BoxContainer Name="ChangelogContainer" Access="Public" Orientation="Vertical"
StyleClasses="LobbyGayBackground" />
</BoxContainer>
</PanelContainer>
</Control>
<!-- Character setup state -->
<!-- This is injected on startup. Funky! -->
<Control Access="Public" Visible="False" Name="CharacterSetupState" VerticalExpand="True" />
</BoxContainer>
<!-- Right Panel -->
<PanelContainer Name="RightSide" StyleClasses="AngleRect" HorizontalAlignment="Right" VerticalExpand="True"
VerticalAlignment="Stretch">
<PanelContainer Name="RightSide" StyleClasses="LobbyGayBackground" HorizontalAlignment="Right"
VerticalExpand="True" VerticalAlignment="Stretch">
<BoxContainer Orientation="Vertical" HorizontalExpand="True">
<!-- Top row -->
<!-- Header -->
<BoxContainer Orientation="Horizontal" MinSize="0 40" Name="HeaderContainer" Access="Public"
SeparationOverride="4">
<Label Margin="8 0 0 0" StyleClasses="LabelHeadingBigger" VAlign="Center"
Text="{Loc 'ui-lobby-title'}" />
<Label Name="ServerName" Access="Public" StyleClasses="LabelHeadingBigger" VAlign="Center"
HorizontalExpand="True" HorizontalAlignment="Center" />
</BoxContainer>
<!-- Gold line -->
<!-- Gold Line -->
<controls:HLine Color="{x:Static style:StyleNano.NanoGold}" Thickness="2" />
<controls:HSpacer Spacing="10" />
<!-- Voting & misc button bar -->
<BoxContainer Orientation="Horizontal" MinSize="0 40" HorizontalAlignment="Right">
<Button Name="AHelpButton" Access="Public" Text="{Loc 'ui-lobby-ahelp-button'}"
StyleClasses="ButtonBig" />
<vote:VoteCallMenuButton Name="CallVoteButton" StyleClasses="ButtonBig" />
<Button Name="OptionsButton" Access="Public" StyleClasses="ButtonBig"
Text="{Loc 'ui-lobby-options-button'}" />
<Button Name="LeaveButton" Access="Public" StyleClasses="ButtonBig"
Text="{Loc 'ui-lobby-leave-button'}" />
</BoxContainer>
<controls:HSpacer Spacing="10" />
<!-- Server info -->
<!-- Server Info -->
<controls:NanoHeading Text="{Loc 'ui-lobby-server-info-block'}" />
<info:ServerInfo Name="ServerInfo" Access="Public" MinSize="0 30" VerticalExpand="false"
Margin="3 3 3 3" MaxWidth="400" HorizontalAlignment="Left" />
<Label Name="StationTime" Access="Public" FontColorOverride="{x:Static maths:Color.LightGray}"
Margin="3 3 3 3" HorizontalAlignment="Left" />
<info:ServerInfo Name="ServerInfo" Access="Public" MinSize="0 100" VerticalExpand="false"
Margin="3" MaxWidth="400" HorizontalAlignment="Left" />
<Label Name="StationTime" Access="Public"
FontColorOverride="{x:Static maths:Color.MediumVioletRed}" Margin="3"
HorizontalAlignment="Left" />
<Label Name="StartTime" Access="Public" FontColorOverride="{x:Static maths:Color.MediumVioletRed}"
Margin="3" StyleClasses="Label" HorizontalExpand="True" />
<controls:HSpacer Spacing="5" />
<lobbyUi:LobbyCharacterPreviewPanel Name="CharacterPreview" Access="Public" />
<!--
<lobbyUi:LobbyCharacterPreviewPanel Name="CharacterPreview" Access="Public"/>
-->
<controls:HSpacer Spacing="5" />
<BoxContainer MinHeight="10" />
<!-- Gold line -->
<!-- Gold Line -->
<controls:HLine Color="{x:Static style:StyleNano.NanoGold}" Thickness="2" Access="Public" />
<controls:HSpacer Spacing="10" />
<widgets:ChatBox Name="Chat" Access="Public" VerticalExpand="True" Margin="3 3 3 3" MinHeight="50" />
<widgets:ChatBox Name="Chat" Access="Public" VerticalExpand="True" Margin="3" MinHeight="50" />
</BoxContainer>
</PanelContainer>
</SplitContainer>
</BoxContainer>
</lobbyUi:LobbyGui>

View File

@@ -1,29 +1,13 @@
using Content.Client.Chat.UI;
using Content.Client.Info;
using Content.Client.Preferences;
using Content.Client.Preferences.UI;
using Content.Client.UserInterface.Screens;
using Content.Client.UserInterface.Systems.Chat.Widgets;
using Content.Client.UserInterface.Systems.EscapeMenu;
using Robust.Client.AutoGenerated;
using Robust.Client.Console;
using Robust.Client.Graphics;
using Robust.Client.State;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
using static Robust.Client.UserInterface.Controls.BoxContainer;
namespace Content.Client.Lobby.UI
{
[GenerateTypedNameReferences]
internal sealed partial class LobbyGui : UIScreen
{
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
public LobbyGui()
@@ -33,32 +17,28 @@ namespace Content.Client.Lobby.UI
SetAnchorPreset(MainContainer, LayoutPreset.Wide);
SetAnchorPreset(Background, LayoutPreset.Wide);
LeaveButton.OnPressed += _ => _consoleHost.ExecuteCommand("disconnect");
OptionsButton.OnPressed += _ => _userInterfaceManager.GetUIController<OptionsUIController>().ToggleWindow();
}
public void SwitchState(LobbyGuiState state)
{
DefaultState.Visible = false;
CharacterSetupState.Visible = false;
switch (state)
{
case LobbyGuiState.Default:
DefaultState.Visible = true;
CharacterSetupState.Visible = false;
Center.Visible = true;
RightSide.Visible = true;
Version.Visible = true;
LabelName.Visible = true;
Changelog.Visible = true;
break;
case LobbyGuiState.CharacterSetup:
CharacterSetupState.Visible = true;
var actualWidth = (float) _userInterfaceManager.RootControl.PixelWidth;
var setupWidth = (float) LeftSide.PixelWidth;
if (1 - (setupWidth / actualWidth) > 0.30)
{
RightSide.Visible = false;
}
Center.Visible = false;
RightSide.Visible = false;
Version.Visible = false;
LabelName.Visible = false;
Changelog.Visible = false;
break;
}
}