Lobby chat width and custom lobby titles (#33783)

* lobby name cvar

* panel width

* skrek

* server name localization fix

* comment format fix

Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com>

* remove redundant newline

Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com>

* string.empty

Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com>

* use SetWidth

* Update Resources/Locale/en-US/lobby/lobby-gui.ftl

---------

Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com>
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
Errant
2025-01-05 21:56:01 +01:00
committed by GitHub
parent 6f16291557
commit a55dc4d3bb
4 changed files with 29 additions and 6 deletions

View File

@@ -5,19 +5,21 @@ using Content.Client.Lobby.UI;
using Content.Client.Message;
using Content.Client.UserInterface.Systems.Chat;
using Content.Client.Voting;
using Content.Shared.CCVar;
using Robust.Client;
using Robust.Client.Console;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Configuration;
using Robust.Shared.Timing;
namespace Content.Client.Lobby
{
public sealed class LobbyState : Robust.Client.State.State
{
[Dependency] private readonly IBaseClient _baseClient = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IResourceCache _resourceCache = default!;
@@ -49,7 +51,17 @@ namespace Content.Client.Lobby
_voteManager.SetPopupContainer(Lobby.VoteContainer);
LayoutContainer.SetAnchorPreset(Lobby, LayoutContainer.LayoutPreset.Wide);
Lobby.ServerName.Text = _baseClient.GameInfo?.ServerName; //The eye of refactor gazes upon you...
var lobbyNameCvar = _cfg.GetCVar(CCVars.ServerLobbyName);
var serverName = _baseClient.GameInfo?.ServerName ?? string.Empty;
Lobby.ServerName.Text = string.IsNullOrEmpty(lobbyNameCvar)
? Loc.GetString("ui-lobby-title", ("serverName", serverName))
: lobbyNameCvar;
var width = _cfg.GetCVar(CCVars.ServerLobbyRightPanelWidth);
Lobby.RightSide.SetWidth = width;
UpdateLobbyUi();
Lobby.CharacterPreview.CharacterSetupButton.OnPressed += OnSetupPressed;