diff --git a/Content.Client/Lobby/LobbyState.cs b/Content.Client/Lobby/LobbyState.cs index 15b946d1e7..b23986ccc9 100644 --- a/Content.Client/Lobby/LobbyState.cs +++ b/Content.Client/Lobby/LobbyState.cs @@ -61,7 +61,7 @@ namespace Content.Client.Lobby private ClientGameTicker _gameTicker = default!; private ContentAudioSystem _contentAudioSystem = default!; private ISawmill _sawmill = default!; - + // Track loaded resources for unloading private ResPath? _currentAnimationPath; private ResPath? _currentArtPath; @@ -72,7 +72,7 @@ namespace Content.Client.Lobby protected override void Startup() { _sawmill = _logManager.GetSawmill("lobby"); - + if (_userInterfaceManager.ActiveScreen == null) { return; @@ -276,12 +276,12 @@ namespace Content.Client.Lobby { backgroundType = _gameTicker.LobbyType; } - + if (!Enum.TryParse(backgroundType, out LobbyBackgroundType lobbyBackgroundType)) { lobbyBackgroundType = LobbyBackgroundType.Parallax; // Default } - + switch (lobbyBackgroundType) { case LobbyBackgroundType.Parallax: @@ -410,16 +410,22 @@ namespace Content.Client.Lobby Lobby!.LobbyAnimation.Visible = false; Lobby!.LobbyArt.Visible = false; Lobby!.ShowParallax = true; + // Load parallax background + UpdateLobbyParallax(); break; case LobbyBackgroundType.Art: Lobby!.LobbyAnimation.Visible = false; Lobby!.LobbyArt.Visible = true; Lobby!.ShowParallax = false; + // Load art background + UpdateLobbyArt(); break; case LobbyBackgroundType.Animation: Lobby!.LobbyAnimation.Visible = true; Lobby!.LobbyArt.Visible = false; Lobby!.ShowParallax = false; + // Load animation background + UpdateLobbyAnimation(); break; } } @@ -462,14 +468,14 @@ namespace Content.Client.Lobby { backgroundType = _gameTicker.LobbyType; } - - if (!Enum.TryParse(backgroundType, out LobbyBackgroundType lobbyBackgroundType) || + + if (!Enum.TryParse(backgroundType, out LobbyBackgroundType lobbyBackgroundType) || lobbyBackgroundType != LobbyBackgroundType.Animation) { // Animation is not the selected background type, don't load it return; } - + if (!_protoMan.TryIndex(lobbyAnimation, out var lobbyAnimationPrototype)) return; @@ -478,7 +484,7 @@ namespace Content.Client.Lobby _sawmill.Error("Error in SetLobbyAnimation. Lobby is null"); return; } - + // Unload previous animation if CVar is enabled if (_cfg.GetCVar(SunriseCCVars.LobbyUnloadResources) && _currentAnimationPath.HasValue) { @@ -527,7 +533,7 @@ namespace Content.Client.Lobby return; } } - + // Try to get the resource - this will load it if not cached if (_resourceCache.TryGetResource(targetPath, out var rsiResource)) { @@ -554,15 +560,15 @@ namespace Content.Client.Lobby { backgroundType = _gameTicker.LobbyType; } - - if (!Enum.TryParse(backgroundType, out LobbyBackgroundType lobbyBackgroundType) || + + if (!Enum.TryParse(backgroundType, out LobbyBackgroundType lobbyBackgroundType) || lobbyBackgroundType != LobbyBackgroundType.Art) { // Art is not the selected background type, don't load it return; } - - if (!_protoMan.TryIndex(lobbyArt, out var lobbyArtPrototype)) + + if (!_protoMan.TryIndex(lobbyArt, out var lobbyArtPrototype)) return; if (Lobby == null) @@ -570,14 +576,14 @@ namespace Content.Client.Lobby _sawmill.Error("Error in SetLobbyArt. Lobby is null"); return; } - + // Unload previous art if CVar is enabled if (_cfg.GetCVar(SunriseCCVars.LobbyUnloadResources) && _currentArtPath.HasValue) { UnloadResource(_currentArtPath.Value); } - var imagePath = lobbyArtPrototype.Background.ToString(); + var imagePath = lobbyArtPrototype.Background; // Check if resource is available, request if not var isAvailable = _netTexturesManager.EnsureResource(imagePath); @@ -633,14 +639,14 @@ namespace Content.Client.Lobby { backgroundType = _gameTicker.LobbyType; } - - if (!Enum.TryParse(backgroundType, out LobbyBackgroundType lobbyBackgroundType) || + + if (!Enum.TryParse(backgroundType, out LobbyBackgroundType lobbyBackgroundType) || lobbyBackgroundType != LobbyBackgroundType.Parallax) { // Parallax is not the selected background type, don't load it return; } - + if (!_protoMan.TryIndex(lobbyParallax, out var lobbyParallaxPrototype)) return; @@ -664,26 +670,56 @@ namespace Content.Client.Lobby private void UpdateLobbyAnimation() { - if (_cfg.GetCVar(SunriseCCVars.LobbyAnimation) != "Random") - return; - - SetLobbyAnimation(_gameTicker.LobbyAnimation!); + var animationSetting = _cfg.GetCVar(SunriseCCVars.LobbyAnimation); + if (animationSetting == "Random") + { + // For Random, use the game ticker's selected animation + if (_gameTicker.LobbyAnimation != null) + { + SetLobbyAnimation(_gameTicker.LobbyAnimation); + } + } + else + { + // For specific animation, use the setting + SetLobbyAnimation(animationSetting); + } } private void UpdateLobbyArt() { - if (_cfg.GetCVar(SunriseCCVars.LobbyArt) != "Random") - return; - - SetLobbyArt(_gameTicker.LobbyArt!); + var artSetting = _cfg.GetCVar(SunriseCCVars.LobbyArt); + if (artSetting == "Random") + { + // For Random, use the game ticker's selected art + if (_gameTicker.LobbyArt != null) + { + SetLobbyArt(_gameTicker.LobbyArt); + } + } + else + { + // For specific art, use the setting + SetLobbyArt(artSetting); + } } private void UpdateLobbyParallax() { - if (_cfg.GetCVar(SunriseCCVars.LobbyParallax) != "Random") - return; - - SetLobbyParallax(_gameTicker.LobbyParallax!); + var parallaxSetting = _cfg.GetCVar(SunriseCCVars.LobbyParallax); + if (parallaxSetting == "Random") + { + // For Random, use the game ticker's selected parallax + if (_gameTicker.LobbyParallax != null) + { + SetLobbyParallax(_gameTicker.LobbyParallax); + } + } + else + { + // For specific parallax, use the setting + SetLobbyParallax(parallaxSetting); + } } private void OnNetworkResourceLoaded(string resourcePath) @@ -694,12 +730,12 @@ namespace Content.Client.Lobby { backgroundType = _gameTicker.LobbyType; } - + if (!Enum.TryParse(backgroundType, out LobbyBackgroundType lobbyBackgroundType)) { lobbyBackgroundType = LobbyBackgroundType.Parallax; // Default } - + // Only load the resource for the currently selected background type switch (lobbyBackgroundType) { @@ -722,7 +758,7 @@ namespace Content.Client.Lobby } } break; - + case LobbyBackgroundType.Art: var currentArt = _cfg.GetCVar(SunriseCCVars.LobbyArt); if (currentArt != null) @@ -734,7 +770,7 @@ namespace Content.Client.Lobby } } break; - + case LobbyBackgroundType.Parallax: // Parallax doesn't need network resources, it uses local resources // But we can update it if needed @@ -764,7 +800,7 @@ namespace Content.Client.Lobby try { bool unloaded = false; - + // Try to unload RSI resource if (_resourceCache.TryGetResource(resourcePath, out var rsiResource)) { @@ -779,7 +815,7 @@ namespace Content.Client.Lobby unloaded = true; _sawmill.Debug($"Disposed texture resource: {resourcePath} (still in cache due to sandbox limitations)"); } - + if (!unloaded) { _sawmill.Debug($"Resource not found in cache: {resourcePath}"); diff --git a/Content.Client/Options/UI/Tabs/ExtraTab.xaml.cs b/Content.Client/Options/UI/Tabs/ExtraTab.xaml.cs index e252738814..5a23eafdf1 100644 --- a/Content.Client/Options/UI/Tabs/ExtraTab.xaml.cs +++ b/Content.Client/Options/UI/Tabs/ExtraTab.xaml.cs @@ -72,7 +72,7 @@ public sealed partial class ExtraTab : Control var layoutLoc = Loc.GetString($"lobby-parallax-{lobbyParallax.ID}"); lobbyParallaxes.Add(new OptionDropDownCVar.ValueOption(lobbyParallax.ID, layoutLoc)); } - var lobbyArtsPrototypes = _prototypeManager.EnumeratePrototypes(); + var lobbyArtsPrototypes = _prototypeManager.EnumeratePrototypes(); foreach (var lobbyArt in lobbyArtsPrototypes) { var layoutLoc = Loc.GetString($"lobby-art-{lobbyArt.ID}"); diff --git a/Content.Server/GameTicking/GameTicker.LobbyBackground.cs b/Content.Server/GameTicking/GameTicker.LobbyBackground.cs index 1148ec3446..a6baf94a25 100644 --- a/Content.Server/GameTicking/GameTicker.LobbyBackground.cs +++ b/Content.Server/GameTicking/GameTicker.LobbyBackground.cs @@ -29,7 +29,7 @@ public sealed partial class GameTicker private void InitializeLobbyBackground() { - _lobbyArts = _prototypeManager.EnumeratePrototypes() + _lobbyArts = _prototypeManager.EnumeratePrototypes() .Select(x => x.ID) .ToList(); diff --git a/Content.Shared/_Sunrise/Lobby/LobbyArtPrototype.cs b/Content.Shared/_Sunrise/Lobby/LobbyArtPrototype.cs new file mode 100644 index 0000000000..6ce18e39e3 --- /dev/null +++ b/Content.Shared/_Sunrise/Lobby/LobbyArtPrototype.cs @@ -0,0 +1,30 @@ +using Robust.Shared.Prototypes; + +namespace Content.Shared._Sunrise.Lobby; + +[Prototype] +public sealed partial class LobbyArtPrototype : IPrototype +{ + /// + [IdDataField] + public string ID { get; set; } = default!; + + /// + /// The sprite path to use as the background. This should ideally be 1920x1080. + /// + [DataField("background", required: true)] + public string Background = default!; + + /// + /// The title of the background to be displayed in the lobby. + /// + [DataField] + public LocId Title = "lobby-state-background-unknown-title"; + + /// + /// The artist who made the art for the background. + /// + [DataField] + public LocId Artist = "lobby-state-background-unknown-artist"; +} + diff --git a/Resources/NetTextures/Parallaxes/layer1.png b/Resources/NetTextures/Parallaxes/layer1.png new file mode 100644 index 0000000000..c5f7954630 Binary files /dev/null and b/Resources/NetTextures/Parallaxes/layer1.png differ diff --git a/Resources/Prototypes/_Sunrise/Lobby/arts.yml b/Resources/Prototypes/_Sunrise/Lobby/arts.yml index b6d21ac6f0..a575d8bfd8 100644 --- a/Resources/Prototypes/_Sunrise/Lobby/arts.yml +++ b/Resources/Prototypes/_Sunrise/Lobby/arts.yml @@ -1,191 +1,191 @@ -- type: lobbyBackground +- type: lobbyArt id: BarLife - background: NetTextures/Lobby/Arts/bar-life.webp + background: /NetTextures/Lobby/Arts/bar-life.webp -- type: lobbyBackground +- type: lobbyArt id: DeadInSpace - background: NetTextures/Lobby/Arts/dead-in-space.webp + background: /NetTextures/Lobby/Arts/dead-in-space.webp -- type: lobbyBackground +- type: lobbyArt id: Engineer - background: NetTextures/Lobby/Arts/engineer.webp + background: /NetTextures/Lobby/Arts/engineer.webp -- type: lobbyBackground +- type: lobbyArt id: BeerSlime - background: NetTextures/Lobby/Arts/beerslime.webp + background: /NetTextures/Lobby/Arts/beerslime.webp -- type: lobbyBackground +- type: lobbyArt id: Deadsquad - background: NetTextures/Lobby/Arts/deadsquad.webp + background: /NetTextures/Lobby/Arts/deadsquad.webp -- type: lobbyBackground +- type: lobbyArt id: EngineersChill - background: NetTextures/Lobby/Arts/engineers-chill.webp + background: /NetTextures/Lobby/Arts/engineers-chill.webp -- type: lobbyBackground +- type: lobbyArt id: IntoSpace - background: NetTextures/Lobby/Arts/into-space.webp + background: /NetTextures/Lobby/Arts/into-space.webp -- type: lobbyBackground +- type: lobbyArt id: Jailbreak - background: NetTextures/Lobby/Arts/jailbreak.webp + background: /NetTextures/Lobby/Arts/jailbreak.webp -- type: lobbyBackground +- type: lobbyArt id: Kosmologistika - background: NetTextures/Lobby/Arts/kosmologistika.webp + background: /NetTextures/Lobby/Arts/kosmologistika.webp -- type: lobbyBackground +- type: lobbyArt id: LizardBar - background: NetTextures/Lobby/Arts/lizard-bar.webp + background: /NetTextures/Lobby/Arts/lizard-bar.webp -- type: lobbyBackground +- type: lobbyArt id: Lofi - background: NetTextures/Lobby/Arts/lofi.webp + background: /NetTextures/Lobby/Arts/lofi.webp -- type: lobbyBackground +- type: lobbyArt id: MaintenanceClown - background: NetTextures/Lobby/Arts/maintenance-clown.webp + background: /NetTextures/Lobby/Arts/maintenance-clown.webp -- type: lobbyBackground +- type: lobbyArt id: NukiesHere - background: NetTextures/Lobby/Arts/nukies-here.webp + background: /NetTextures/Lobby/Arts/nukies-here.webp -- type: lobbyBackground +- type: lobbyArt id: RegularShift - background: NetTextures/Lobby/Arts/regular-shift.webp + background: /NetTextures/Lobby/Arts/regular-shift.webp -- type: lobbyBackground +- type: lobbyArt id: Singulord - background: NetTextures/Lobby/Arts/singulord.webp + background: /NetTextures/Lobby/Arts/singulord.webp -- type: lobbyBackground +- type: lobbyArt id: StarBow14 - background: NetTextures/Lobby/Arts/starbow14.webp + background: /NetTextures/Lobby/Arts/starbow14.webp -- type: lobbyBackground +- type: lobbyArt id: SpaceMudaki - background: NetTextures/Lobby/Arts/space-mudaki.webp + background: /NetTextures/Lobby/Arts/space-mudaki.webp -- type: lobbyBackground +- type: lobbyArt id: Traitor - background: NetTextures/Lobby/Arts/traitor.webp + background: /NetTextures/Lobby/Arts/traitor.webp -- type: lobbyBackground +- type: lobbyArt id: TeslaLoose - background: NetTextures/Lobby/Arts/tesla-loose.webp + background: /NetTextures/Lobby/Arts/tesla-loose.webp -- type: lobbyBackground +- type: lobbyArt id: TeslaLoose2 - background: NetTextures/Lobby/Arts/teslaloose.webp + background: /NetTextures/Lobby/Arts/teslaloose.webp -- type: lobbyBackground +- type: lobbyArt id: NukieDudes - background: NetTextures/Lobby/Arts/nukie-dudes.webp + background: /NetTextures/Lobby/Arts/nukie-dudes.webp -- type: lobbyBackground +- type: lobbyArt id: MenAtWork - background: NetTextures/Lobby/Arts/men-at-work.webp + background: /NetTextures/Lobby/Arts/men-at-work.webp -- type: lobbyBackground +- type: lobbyArt id: FleshAnom - background: NetTextures/Lobby/Arts/fleshanom.webp + background: /NetTextures/Lobby/Arts/fleshanom.webp -- type: lobbyBackground +- type: lobbyArt id: Revenant - background: NetTextures/Lobby/Arts/revenant.webp + background: /NetTextures/Lobby/Arts/revenant.webp -- type: lobbyBackground +- type: lobbyArt id: RedAlertMed - background: NetTextures/Lobby/Arts/red-alert-med.webp + background: /NetTextures/Lobby/Arts/red-alert-med.webp -- type: lobbyBackground +- type: lobbyArt id: DeathNettle - background: NetTextures/Lobby/Arts/deathnettle.webp + background: /NetTextures/Lobby/Arts/deathnettle.webp -- type: lobbyBackground +- type: lobbyArt id: Xeno - background: NetTextures/Lobby/Arts/xeno.webp + background: /NetTextures/Lobby/Arts/xeno.webp -- type: lobbyBackground +- type: lobbyArt id: ClownSpider - background: NetTextures/Lobby/Arts/clownspider.webp + background: /NetTextures/Lobby/Arts/clownspider.webp -- type: lobbyBackground +- type: lobbyArt id: XenoAttack - background: NetTextures/Lobby/Arts/xenosattack.webp + background: /NetTextures/Lobby/Arts/xenosattack.webp -- type: lobbyBackground +- type: lobbyArt id: SingulordCage - background: NetTextures/Lobby/Arts/singulord-cage.webp + background: /NetTextures/Lobby/Arts/singulord-cage.webp -- type: lobbyBackground +- type: lobbyArt id: GrayTide - background: NetTextures/Lobby/Arts/gray-tide.webp + background: /NetTextures/Lobby/Arts/gray-tide.webp -- type: lobbyBackground +- type: lobbyArt id: GutsGuts - background: NetTextures/Lobby/Arts/guts-guts.webp + background: /NetTextures/Lobby/Arts/guts-guts.webp -- type: lobbyBackground +- type: lobbyArt id: NewYearBar - background: NetTextures/Lobby/Arts/new-year-bar.webp + background: /NetTextures/Lobby/Arts/new-year-bar.webp -- type: lobbyBackground +- type: lobbyArt id: NewYearSec - background: NetTextures/Lobby/Arts/new-year-sec.webp + background: /NetTextures/Lobby/Arts/new-year-sec.webp -- type: lobbyBackground +- type: lobbyArt id: NewYearSave - background: NetTextures/Lobby/Arts/new-year-save.webp + background: /NetTextures/Lobby/Arts/new-year-save.webp -- type: lobbyBackground +- type: lobbyArt id: NewYearComfort - background: NetTextures/Lobby/Arts/new-year-comfort.webp + background: /NetTextures/Lobby/Arts/new-year-comfort.webp -- type: lobbyBackground +- type: lobbyArt id: NewYearParty - background: NetTextures/Lobby/Arts/new-year-party.webp + background: /NetTextures/Lobby/Arts/new-year-party.webp -- type: lobbyBackground +- type: lobbyArt id: NewYearPine - background: NetTextures/Lobby/Arts/new-year-pine.webp + background: /NetTextures/Lobby/Arts/new-year-pine.webp -- type: lobbyBackground +- type: lobbyArt id: NewYearExplosion - background: NetTextures/Lobby/Arts/new-year-explosion.webp + background: /NetTextures/Lobby/Arts/new-year-explosion.webp -- type: lobbyBackground +- type: lobbyArt id: SpaceNuke - background: NetTextures/Lobby/Arts/space-nuke.webp + background: /NetTextures/Lobby/Arts/space-nuke.webp -- type: lobbyBackground +- type: lobbyArt id: NewYearPenguins - background: NetTextures/Lobby/Arts/new-year-penguins.webp + background: /NetTextures/Lobby/Arts/new-year-penguins.webp -- type: lobbyBackground +- type: lobbyArt id: NewYearNuke - background: NetTextures/Lobby/Arts/new-year-nuke.webp + background: /NetTextures/Lobby/Arts/new-year-nuke.webp -- type: lobbyBackground +- type: lobbyArt id: ArnoldIntelligence - background: NetTextures/Lobby/Arts/arnold-intelligence.webp + background: /NetTextures/Lobby/Arts/arnold-intelligence.webp -- type: lobbyBackground +- type: lobbyArt id: MimesInTechs - background: NetTextures/Lobby/Arts/mimes-in-techs.webp + background: /NetTextures/Lobby/Arts/mimes-in-techs.webp -- type: lobbyBackground +- type: lobbyArt id: NukieWar - background: NetTextures/Lobby/Arts/nukie-war.webp + background: /NetTextures/Lobby/Arts/nukie-war.webp -- type: lobbyBackground +- type: lobbyArt id: EngineersVsZombies - background: NetTextures/Lobby/Arts/engineers-vs-zombies.webp + background: /NetTextures/Lobby/Arts/engineers-vs-zombies.webp -- type: lobbyBackground +- type: lobbyArt id: Reunion - background: NetTextures/Lobby/Arts/reunion.webp + background: /NetTextures/Lobby/Arts/reunion.webp -- type: lobbyBackground +- type: lobbyArt id: Prostchitalsanogde - background: NetTextures/Lobby/Arts/prostchitalsanogde.webp + background: /NetTextures/Lobby/Arts/prostchitalsanogde.webp diff --git a/Resources/Prototypes/_Sunrise/Parallaxes/delta.yml b/Resources/Prototypes/_Sunrise/Parallaxes/delta.yml index 755d1d37b4..dce832c379 100644 --- a/Resources/Prototypes/_Sunrise/Parallaxes/delta.yml +++ b/Resources/Prototypes/_Sunrise/Parallaxes/delta.yml @@ -3,7 +3,7 @@ layers: - texture: !type:ImageParallaxTextureSource - path: "/NetTextures/Parallaxes/NES/MirStationParallaxBG.png" + path: "/NetTextures/Parallaxes/MirStationParallaxBG.png" slowness: 0.998046875 scale: "1, 1" - texture: @@ -28,7 +28,7 @@ slowness: 0.984352 - texture: !type:ImageParallaxTextureSource - path: "/NetTextures/Parallaxes/NES/planet2.png" + path: "/NetTextures/Parallaxes/planet2.png" slowness: 0.998046875 scale: "1, 1" tiled: false