-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into crawling-not-floating
- Loading branch information
Showing
2,598 changed files
with
464,098 additions
and
155,917 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
Content.Client/ADT/UI/AnimatedBackground/AnimatedBackgroundControl.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
using System.Linq; | ||
using Content.Shared.ADT; | ||
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.ADT.UI.AnimatedBackground; | ||
|
||
public sealed class AnimatedBackgroundControl : TextureRect | ||
{ | ||
[Dependency] private readonly IResourceCache _resourceCache = default!; | ||
[Dependency] private readonly IClyde _clyde = default!; | ||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; | ||
|
||
private string _rsiPath = "/Textures/ADT/LobbyScreens/backgrounds/native.rsi"; | ||
public RSI? _RSI; | ||
private const int States = 1; | ||
|
||
private IRenderTexture? _buffer; | ||
|
||
private readonly float[] _timer = new float[States]; | ||
private readonly float[][] _frameDelays = new float[States][]; | ||
private readonly int[] _frameCounter = new int[States]; | ||
private readonly Texture[][] _frames = new Texture[States][]; | ||
|
||
public AnimatedBackgroundControl() | ||
{ | ||
IoCManager.InjectDependencies(this); | ||
|
||
InitializeStates(); | ||
} | ||
|
||
private void InitializeStates() | ||
{ | ||
_RSI ??= _resourceCache.GetResource<RSIResource>(_rsiPath).RSI; | ||
|
||
for (var i = 0; i < States; i++) | ||
{ | ||
if (!_RSI.TryGetState((i + 1).ToString(), out var state)) | ||
continue; | ||
|
||
_frames[i] = state.GetFrames(RsiDirection.South); | ||
_frameDelays[i] = state.GetDelays(); | ||
_frameCounter[i] = 0; | ||
} | ||
} | ||
|
||
public void SetRSI(RSI? rsi) | ||
{ | ||
_RSI = rsi; | ||
InitializeStates(); | ||
} | ||
|
||
protected override void FrameUpdate(FrameEventArgs args) | ||
{ | ||
base.FrameUpdate(args); | ||
|
||
for (var i = 0; i < _frames.Length; i++) | ||
{ | ||
var delays = _frameDelays[i]; | ||
if (delays.Length == 0) | ||
continue; | ||
|
||
_timer[i] += args.DeltaSeconds; | ||
|
||
var currentFrameIndex = _frameCounter[i]; | ||
|
||
if (!(_timer[i] >= delays[currentFrameIndex])) | ||
continue; | ||
|
||
_timer[i] -= delays[currentFrameIndex]; | ||
_frameCounter[i] = (currentFrameIndex + 1) % _frames[i].Length; | ||
Texture = _frames[i][_frameCounter[i]]; | ||
} | ||
} | ||
|
||
protected override void Draw(DrawingHandleScreen handle) | ||
{ | ||
base.Draw(handle); | ||
|
||
if (_buffer is null) | ||
return; | ||
|
||
handle.DrawTextureRect(_buffer.Texture, PixelSizeBox); | ||
} | ||
|
||
protected override void Resized() | ||
{ | ||
base.Resized(); | ||
_buffer?.Dispose(); | ||
_buffer = _clyde.CreateRenderTarget(PixelSize, RenderTargetColorFormat.Rgba8Srgb); | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
base.Dispose(disposing); | ||
_buffer?.Dispose(); | ||
} | ||
|
||
public void RandomizeBackground() | ||
{ | ||
var backgroundsProto = _prototypeManager.EnumeratePrototypes<AnimatedLobbyScreenPrototype>().ToList(); | ||
var random = new Random(); | ||
var index = random.Next(backgroundsProto.Count); | ||
_rsiPath = $"/Textures/{backgroundsProto[index].Path}"; | ||
InitializeStates(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
Content.Client/Administration/UI/PlayerPanel/PlayerPanel.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<ui:FancyWindow | ||
xmlns="https://spacestation14.io" | ||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls" | ||
xmlns:ui="clr-namespace:Content.Client.UserInterface.Controls" | ||
Title="{Loc ban-panel-title}" MinSize="300 300"> | ||
<BoxContainer Orientation="Vertical"> | ||
<BoxContainer Orientation="Horizontal"> | ||
<Label Name="PlayerName"/> | ||
<Button Name="UsernameCopyButton" Text="{Loc player-panel-copy-username}"/> | ||
</BoxContainer> | ||
<BoxContainer Orientation="Horizontal"> | ||
<Label Name="Whitelisted"/> | ||
<controls:ConfirmButton Name="WhitelistToggle" Text="{Loc 'player-panel-false'}" Visible="False"></controls:ConfirmButton> | ||
</BoxContainer> | ||
<Label Name="Playtime"/> | ||
<Label Name="Notes"/> | ||
<Label Name="Bans"/> | ||
<Label Name="RoleBans"/> | ||
<Label Name="SharedConnections"/> | ||
|
||
<BoxContainer Align="Center"> | ||
<GridContainer Rows="5"> | ||
<Button Name="NotesButton" Text="{Loc player-panel-show-notes}" SetWidth="136" Disabled="True"/> | ||
<Button Name="AhelpButton" Text="{Loc player-panel-help}" Disabled="True"/> | ||
<Button Name="FreezeButton" Text = "{Loc player-panel-freeze}" Disabled="True"/> | ||
<controls:ConfirmButton Name="KickButton" Text="{Loc player-panel-kick}" Disabled="True"/> | ||
<controls:ConfirmButton Name="DeleteButton" Text="{Loc player-panel-delete}" Disabled="True"/> | ||
<Button Name="ShowBansButton" Text="{Loc player-panel-show-bans}" SetWidth="136" Disabled="True"/> | ||
<Button Name="LogsButton" Text="{Loc player-panel-logs}" Disabled="True"/> | ||
<Button Name="FreezeAndMuteToggleButton" Text="{Loc player-panel-freeze-and-mute}" Disabled="True"/> | ||
<Button Name="BanButton" Text="{Loc player-panel-ban}" Disabled="True"/> | ||
<controls:ConfirmButton Name="RejuvenateButton" Text="{Loc player-panel-rejuvenate}" Disabled="True"/> | ||
</GridContainer> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</ui:FancyWindow> |
Oops, something went wrong.