Random lobby screens (#142)

* - add: Random lobby screens

* - add: animatedLobbyScreen prototypes
This commit is contained in:
Martell
2024-02-29 18:52:07 +03:00
committed by GitHub
parent 6180bc3b15
commit bbe2935f84
17 changed files with 191 additions and 2 deletions

View File

@@ -95,6 +95,7 @@ namespace Content.Client.Lobby
_gameTicker.LobbyLateJoinStatusUpdated += LobbyLateJoinStatusUpdated;
_preferencesManager.OnServerDataLoaded += PreferencesDataLoaded;
_lobby.Background.RandomizeBackground();
//_lobby.CharacterPreview.UpdateUI();
PopulateChangelog();

View File

@@ -10,7 +10,7 @@
xmlns:buttons="clr-namespace:Content.Client._Ohio.Buttons">
<!-- Background -->
<ui:AnimatedBackgroundControl Name="Background" VerticalExpand="True" HorizontalExpand="True"
<ui:AnimatedBackgroundControl Access="Public" Name="Background" VerticalExpand="True" HorizontalExpand="True"
Stretch="KeepAspectCovered" />
<!-- Main Container -->

View File

@@ -1,7 +1,10 @@
using System.Linq;
using Content.Shared._White;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Graphics.RSI;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
namespace Content.Client._Ohio.UI;
@@ -10,8 +13,9 @@ public sealed class AnimatedBackgroundControl : TextureRect
{
[Dependency] private readonly IResourceCache _resourceCache = default!;
[Dependency] private readonly IClyde _clyde = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
private const string RsiPath = "/Textures/Ohio/Lobby/anim.rsi";
private string RsiPath = "/Textures/Ohio/Lobby/backgrounds/native.rsi";
private const int States = 1;
private IRenderTexture? _buffer;
@@ -88,4 +92,13 @@ public sealed class AnimatedBackgroundControl : TextureRect
base.Dispose(disposing);
_buffer?.Dispose();
}
public void RandomizeBackground()
{
var backgroundsProto = _prototypeManager.EnumeratePrototypes<AnimatedLobbyScreenPrototype>().ToList();
var random = new Random();
int index = random.Next(backgroundsProto.Count);
RsiPath = $"/Textures/{backgroundsProto[index].Path}";
InitializeStates();
}
}

View File

@@ -0,0 +1,17 @@
using Robust.Shared.Prototypes;
namespace Content.Shared._White;
/// <summary>
/// This is a prototype for...
/// </summary>
[Prototype("animatedLobbyScreen")]
public sealed partial class AnimatedLobbyScreenPrototype : IPrototype
{
/// <inheritdoc/>
[IdDataField]
public string ID { get; } = default!;
[DataField("path")]
public string Path { get; private set; } = string.Empty;
}

View File

@@ -0,0 +1,23 @@
- type: animatedLobbyScreen
id: NativeLobbyScreen
path: Ohio/Lobby/backgrounds/native.rsi
- type: animatedLobbyScreen
id: MilkywayLobbyScreen
path: Ohio/Lobby/backgrounds/milkyway.rsi
- type: animatedLobbyScreen
id: SusLobbyScreen
path: Ohio/Lobby/backgrounds/sus.rsi
- type: animatedLobbyScreen
id: ThirdLobbyScreen
path: Ohio/Lobby/backgrounds/3.rsi
- type: animatedLobbyScreen
id: FourthLobbyScreen
path: Ohio/Lobby/backgrounds/4.rsi
- type: animatedLobbyScreen
id: FifthLobbyScreen
path: Ohio/Lobby/backgrounds/5.rsi

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

@@ -0,0 +1,19 @@
{
"version": 1,
"license": null,
"copyright": null,
"size": {
"x": 1920,
"y": 875
},
"states": [
{
"name": "1",
"delays": [
[
0.1
]
]
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

View File

@@ -0,0 +1,38 @@
{
"version": 1,
"license": null,
"copyright": null,
"size": {
"x": 901,
"y": 676
},
"states": [
{
"name": "1",
"delays": [
[
0.015,
0.015,
0.015,
0.015,
0.015,
0.015,
0.015,
0.015,
0.015,
0.015,
0.015,
0.015,
0.015,
0.015,
0.015,
0.015,
0.015,
0.015,
0.015,
0.015
]
]
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

View File

@@ -0,0 +1,19 @@
{
"version": 1,
"license": null,
"copyright": null,
"size": {
"x": 1135,
"y": 800
},
"states": [
{
"name": "1",
"delays": [
[
0.1
]
]
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 KiB

View File

@@ -0,0 +1,19 @@
{
"version": 1,
"license": null,
"copyright": null,
"size": {
"x": 640,
"y": 365
},
"states": [
{
"name": "1",
"delays": [
[
0.1
]
]
}
]
}

View File

Before

Width:  |  Height:  |  Size: 909 KiB

After

Width:  |  Height:  |  Size: 909 KiB

View File

@@ -0,0 +1,21 @@
{
"version": 1,
"license": null,
"copyright": null,
"size": {
"x": 480,
"y": 480
},
"states": [
{
"name": "1",
"delays": [
[
0.1,
0.1,
0.1
]
]
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 664 KiB

View File

@@ -0,0 +1,19 @@
{
"version": 1,
"license": null,
"copyright": null,
"size": {
"x": 1920,
"y": 875
},
"states": [
{
"name": "1",
"delays": [
[
0.1
]
]
}
]
}