Random lobby screens (#142)
* - add: Random lobby screens * - add: animatedLobbyScreen prototypes
@@ -95,6 +95,7 @@ namespace Content.Client.Lobby
|
||||
_gameTicker.LobbyLateJoinStatusUpdated += LobbyLateJoinStatusUpdated;
|
||||
|
||||
_preferencesManager.OnServerDataLoaded += PreferencesDataLoaded;
|
||||
_lobby.Background.RandomizeBackground();
|
||||
|
||||
//_lobby.CharacterPreview.UpdateUI();
|
||||
PopulateChangelog();
|
||||
|
||||
@@ -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 -->
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
17
Content.Shared/_White/AnimatedLobbyScreenPrototype.cs
Normal 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;
|
||||
}
|
||||
@@ -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
|
||||
BIN
Resources/Textures/Ohio/Lobby/backgrounds/3.rsi/1.png
Normal file
|
After Width: | Height: | Size: 1.4 MiB |
19
Resources/Textures/Ohio/Lobby/backgrounds/3.rsi/meta.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"version": 1,
|
||||
"license": null,
|
||||
"copyright": null,
|
||||
"size": {
|
||||
"x": 1920,
|
||||
"y": 875
|
||||
},
|
||||
"states": [
|
||||
{
|
||||
"name": "1",
|
||||
"delays": [
|
||||
[
|
||||
0.1
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
Resources/Textures/Ohio/Lobby/backgrounds/4.rsi/1.png
Normal file
|
After Width: | Height: | Size: 2.3 MiB |
38
Resources/Textures/Ohio/Lobby/backgrounds/4.rsi/meta.json
Normal 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
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
Resources/Textures/Ohio/Lobby/backgrounds/5.rsi/1.png
Normal file
|
After Width: | Height: | Size: 1.7 MiB |
19
Resources/Textures/Ohio/Lobby/backgrounds/5.rsi/meta.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"version": 1,
|
||||
"license": null,
|
||||
"copyright": null,
|
||||
"size": {
|
||||
"x": 1135,
|
||||
"y": 800
|
||||
},
|
||||
"states": [
|
||||
{
|
||||
"name": "1",
|
||||
"delays": [
|
||||
[
|
||||
0.1
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
Resources/Textures/Ohio/Lobby/backgrounds/milkyway.rsi/1.png
Normal file
|
After Width: | Height: | Size: 272 KiB |
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"version": 1,
|
||||
"license": null,
|
||||
"copyright": null,
|
||||
"size": {
|
||||
"x": 640,
|
||||
"y": 365
|
||||
},
|
||||
"states": [
|
||||
{
|
||||
"name": "1",
|
||||
"delays": [
|
||||
[
|
||||
0.1
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Before Width: | Height: | Size: 909 KiB After Width: | Height: | Size: 909 KiB |
@@ -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
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
Resources/Textures/Ohio/Lobby/backgrounds/sus.rsi/1.png
Normal file
|
After Width: | Height: | Size: 664 KiB |
19
Resources/Textures/Ohio/Lobby/backgrounds/sus.rsi/meta.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"version": 1,
|
||||
"license": null,
|
||||
"copyright": null,
|
||||
"size": {
|
||||
"x": 1920,
|
||||
"y": 875
|
||||
},
|
||||
"states": [
|
||||
{
|
||||
"name": "1",
|
||||
"delays": [
|
||||
[
|
||||
0.1
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||