Add song name support (#18433)

This commit is contained in:
Vordenburg
2023-08-02 05:36:27 -04:00
committed by GitHub
parent 2de3fa0ca1
commit cbbed773b4
3 changed files with 32 additions and 5 deletions

View File

@@ -1,22 +1,19 @@
using Content.Client.Chat.Managers;
using Content.Client.GameTicking.Managers; using Content.Client.GameTicking.Managers;
using Content.Client.LateJoin; using Content.Client.LateJoin;
using Content.Client.Lobby.UI; using Content.Client.Lobby.UI;
using Content.Client.Message;
using Content.Client.Preferences; using Content.Client.Preferences;
using Content.Client.Preferences.UI; using Content.Client.Preferences.UI;
using Content.Client.UserInterface.Systems.Chat; using Content.Client.UserInterface.Systems.Chat;
using Content.Client.Voting; using Content.Client.Voting;
using Robust.Client; using Robust.Client;
using Robust.Client.Console; using Robust.Client.Console;
using Robust.Client.Input;
using Robust.Client.Player;
using Robust.Client.ResourceManagement; using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface; using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.Controls;
using Robust.Shared.Configuration; using Robust.Shared.Configuration;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.Timing; using Robust.Shared.Timing;
using Content.Client.UserInterface.Systems.EscapeMenu;
namespace Content.Client.Lobby namespace Content.Client.Lobby
@@ -199,6 +196,29 @@ namespace Content.Client.Lobby
{ {
_lobby!.ServerInfo.SetInfoBlob(_gameTicker.ServerInfoBlob); _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() private void UpdateLobbyBackground()

View File

@@ -40,8 +40,11 @@
<!-- Vertical Padding--> <!-- Vertical Padding-->
<Control VerticalExpand="True"/> <Control VerticalExpand="True"/>
<!-- Left Bot Panel --> <!-- Left Bot Panel -->
<BoxContainer Orientation="Vertical" HorizontalAlignment="Left" VerticalAlignment="Bottom" MaxWidth="620"> <BoxContainer Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Bottom">
<info:DevInfoBanner Name="DevInfoBanner" VerticalExpand="false" Margin="3 3 3 3"/> <info:DevInfoBanner Name="DevInfoBanner" VerticalExpand="false" Margin="3 3 3 3"/>
<PanelContainer StyleClasses="AngleRect">
<RichTextLabel Name="LobbySong" Access="Public" HorizontalAlignment="Center" />
</PanelContainer>
</BoxContainer> </BoxContainer>
</Control> </Control>
<!-- Character setup state --> <!-- Character setup state -->

View File

@@ -10,3 +10,7 @@ lobby-state-player-status-ready = Ready
lobby-state-player-status-observer = Observer lobby-state-player-status-observer = Observer
lobby-state-player-status-round-not-started = The round hasn't started yet lobby-state-player-status-round-not-started = The round hasn't started yet
lobby-state-player-status-round-time = The round time is: {$hours} hours and {$minutes} minutes lobby-state-player-status-round-time = The round time is: {$hours} hours and {$minutes} minutes
lobby-state-song-text = Playing: [color=white]{$songTitle}[/color] by [color=white]{$songArtist}[/color]
lobby-state-song-no-song-text = No lobby song playing.
lobby-state-song-unknown-title = [color=dimgray]Unknown title[/color]
lobby-state-song-unknown-artist = [color=dimgray]Unknown artist[/color]