- 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,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;
}
}