* fix: lobby music volume will be changed on options change without restart (also lobby music not looped anymore) * refactor: now lobby music is part of ContentAudioSystem. Lobby playlist is used instead of single track. Client now selects next lobby soundtrack after previous finished. * refactor: incapsulated info on current lobby track in simple record * refactor: fixed inconsistent naming between song and soundtrack for lobbymusic * refactor: xml-doc for LobbyPlaylistChangedEvent * fix: inverted invalid _audio.PlayGlobal check to return only if lobby soundtrack play call failed --------- Co-authored-by: pa.pecherskij <pa.pecherskij@interfax.ru>
82 lines
2.7 KiB
C#
82 lines
2.7 KiB
C#
using Content.Client.Chat.UI;
|
|
using Content.Client.Info;
|
|
using Content.Client.Message;
|
|
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()
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
IoCManager.InjectDependencies(this);
|
|
SetAnchorPreset(MainContainer, LayoutPreset.Wide);
|
|
SetAnchorPreset(Background, LayoutPreset.Wide);
|
|
|
|
LobbySong.SetMarkup(Loc.GetString("lobby-state-song-no-song-text"));
|
|
|
|
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;
|
|
RightSide.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;
|
|
}
|
|
|
|
break;
|
|
}
|
|
}
|
|
|
|
public enum LobbyGuiState : byte
|
|
{
|
|
/// <summary>
|
|
/// The default state, i.e., what's seen on launch.
|
|
/// </summary>
|
|
Default,
|
|
/// <summary>
|
|
/// The character setup state.
|
|
/// </summary>
|
|
CharacterSetup
|
|
}
|
|
}
|
|
}
|