Skip to content

Commit

Permalink
Merge branch 'upstream-merge' into 'arumoon-server'
Browse files Browse the repository at this point in the history
Upstream update (Security HUD visors)

See merge request Workbench-Team/space-station-14!103
  • Loading branch information
AruMoon committed Aug 3, 2023
2 parents 33fe372 + 5629488 commit e579090
Show file tree
Hide file tree
Showing 220 changed files with 20,231 additions and 15,384 deletions.
2 changes: 1 addition & 1 deletion Content.Client/Access/UI/AgentIDCardWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<LineEdit Name="NameLineEdit" />
<Label Name="CurrentJob" Text="{Loc 'agent-id-card-current-job'}" />
<LineEdit Name="JobLineEdit" />
<BoxContainer Orientation="Horizontal" Visible="False">
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'agent-id-card-job-icon-label'}"/>
<Control HorizontalExpand="True" MinSize="50 0"/>
<GridContainer Name="IconGrid" Columns="10">
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Administration/UI/BanPanel/BanPanel.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<LineEdit Name="PlayerNameLine" MinWidth="100" HorizontalExpand="True" PlaceHolder="{Loc ban-panel-player}" />
</BoxContainer>
<BoxContainer Orientation="Horizontal" Margin="2">
<CheckBox Name="IpCheckbox" MinWidth="100" Text="{Loc ban-panel-ip}" Pressed="False" />
<CheckBox Name="IpCheckbox" MinWidth="100" Text="{Loc ban-panel-ip}" Pressed="True" />
<Control MinWidth="50" />
<LineEdit Name="IpLine" MinWidth="100" HorizontalExpand="True" PlaceHolder="{Loc ban-panel-ip}" ToolTip="{Loc ban-panel-ip-hwid-tooltip}" Editable="False" />
</BoxContainer>
Expand Down
45 changes: 45 additions & 0 deletions Content.Client/Gateway/UI/GatewayBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using Content.Shared.Gateway;
using JetBrains.Annotations;
using Robust.Client.GameObjects;

namespace Content.Client.Gateway.UI;

[UsedImplicitly]
public sealed class GatewayBoundUserInterface : BoundUserInterface
{
private GatewayWindow? _window;

public GatewayBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}

protected override void Open()
{
base.Open();

_window = new GatewayWindow();
_window.OpenPortal += destination =>
{
SendMessage(new GatewayOpenPortalMessage(destination));
};
_window.OnClose += Close;
_window?.OpenCentered();
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
_window?.Dispose();
_window = null;
}

protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);

if (state is not GatewayBoundUserInterfaceState current)
return;

_window?.UpdateState(current);
}
}
22 changes: 22 additions & 0 deletions Content.Client/Gateway/UI/GatewayWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<controls:FancyWindow xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
Title="{Loc 'gateway-window-title'}"
MinSize="800 360">
<BoxContainer Orientation="Vertical">
<BoxContainer Orientation="Horizontal">
<Label Name="NextCloseLabel"
Text="{Loc 'gateway-window-portal-closing'}"
Margin="5"></Label>
<ProgressBar Name="NextCloseBar"
HorizontalExpand="True"
MinValue="0"
MaxValue="1"
SetHeight="25"/>
<Label Name="NextCloseText" Text="0" Margin="5"/>
</BoxContainer>
<controls:HLine Color="#404040" Thickness="2" Margin="0 5 0 5"/>
<BoxContainer Name="Container"
Orientation="Vertical"
Margin="5 0 5 0"/>
</BoxContainer>
</controls:FancyWindow>
180 changes: 180 additions & 0 deletions Content.Client/Gateway/UI/GatewayWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
using Content.Client.Computer;
using Content.Client.Stylesheets;
using Content.Client.UserInterface.Controls;
using Content.Shared.Gateway;
using Content.Shared.Shuttles.BUIStates;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Timing;

namespace Content.Client.Gateway.UI;

[GenerateTypedNameReferences]
public sealed partial class GatewayWindow : FancyWindow,
IComputerWindow<EmergencyConsoleBoundUserInterfaceState>
{
private readonly IGameTiming _timing;

public event Action<EntityUid>? OpenPortal;
private List<(EntityUid, string, TimeSpan, bool)> _destinations = default!;
private EntityUid? _current;
private TimeSpan _nextClose;
private TimeSpan _lastOpen;
private List<Label> _readyLabels = default!;
private List<Button> _openButtons = default!;

public GatewayWindow()
{
RobustXamlLoader.Load(this);
_timing = IoCManager.Resolve<IGameTiming>();
}

public void UpdateState(GatewayBoundUserInterfaceState state)
{
_destinations = state.Destinations;
_current = state.Current;
_nextClose = state.NextClose;
_lastOpen = state.LastOpen;

Container.DisposeAllChildren();
_readyLabels = new List<Label>(_destinations.Count);
_openButtons = new List<Button>(_destinations.Count);

if (_destinations.Count == 0)
{
Container.AddChild(new BoxContainer()
{
HorizontalExpand = true,
VerticalExpand = true,
Children =
{
new Label()
{
Text = Loc.GetString("gateway-window-no-destinations"),
HorizontalAlignment = HAlignment.Center
}
}
});
return;
}

var now = _timing.CurTime;
foreach (var dest in _destinations)
{
var uid = dest.Item1;
var name = dest.Item2;
var nextReady = dest.Item3;
var busy = dest.Item4;

var box = new BoxContainer()
{
Orientation = BoxContainer.LayoutOrientation.Horizontal,
Margin = new Thickness(5f, 5f)
};

box.AddChild(new Label()
{
Text = name
});

var readyLabel = new Label
{
Text = ReadyText(now, nextReady),
Margin = new Thickness(10f, 0f, 0f, 0f)
};
_readyLabels.Add(readyLabel);
box.AddChild(readyLabel);

var openButton = new Button()
{
Text = Loc.GetString("gateway-window-open-portal"),
Pressed = uid == _current,
ToggleMode = true,
Disabled = _current != null || busy || now < nextReady
};

openButton.OnPressed += args =>
{
OpenPortal?.Invoke(uid);
};

if (uid == state.Current)
{
openButton.AddStyleClass(StyleBase.ButtonCaution);
}

_openButtons.Add(openButton);
box.AddChild(new BoxContainer()
{
HorizontalExpand = true,
Align = BoxContainer.AlignMode.End,
Children =
{
openButton
}
});

Container.AddChild(new PanelContainer()
{
PanelOverride = new StyleBoxFlat(new Color(30, 30, 34)),
Margin = new Thickness(10f, 5f),
Children =
{
box
}
});
}
}

protected override void FrameUpdate(FrameEventArgs args)
{
base.FrameUpdate(args);

var now = _timing.CurTime;

// if its not going to close then show it as empty
if (_current == null)
{
NextCloseBar.Value = 0f;
NextCloseText.Text = "00:00";
}
else
{
var remaining = _nextClose - _timing.CurTime;
if (remaining < TimeSpan.Zero)
{
NextCloseBar.Value = 1f;
NextCloseText.Text = "00:00";
}
else
{
var openTime = _nextClose - _lastOpen;
NextCloseBar.Value = 1f - (float) (remaining / openTime);
NextCloseText.Text = $"{remaining.Minutes:00}:{remaining.Seconds:00}";
}
}

for (var i = 0; i < _destinations.Count; i++)
{
var dest = _destinations[i];
var nextReady = dest.Item3;
var busy = dest.Item4;
_readyLabels[i].Text = ReadyText(now, nextReady);
_openButtons[i].Disabled = _current != null || busy || now < nextReady;
}
}

private string ReadyText(TimeSpan now, TimeSpan nextReady)
{
if (now < nextReady)
{
var time = nextReady - now;
return Loc.GetString("gateway-window-ready-in", ("time", $"{time.Minutes:00}:{time.Seconds:00}"));
}

return Loc.GetString("gateway-window-ready");
}
}
28 changes: 24 additions & 4 deletions Content.Client/Lobby/LobbyState.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
using Content.Client.Chat.Managers;
using Content.Client.GameTicking.Managers;
using Content.Client.LateJoin;
using Content.Client.Lobby.UI;
using Content.Client.Message;
using Content.Client.Preferences;
using Content.Client.Preferences.UI;
using Content.Client.UserInterface.Systems.Chat;
using Content.Client.Voting;
using Robust.Client;
using Robust.Client.Console;
using Robust.Client.Input;
using Robust.Client.Player;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Configuration;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using Content.Client.UserInterface.Systems.EscapeMenu;


namespace Content.Client.Lobby
Expand Down Expand Up @@ -199,6 +196,29 @@ private void UpdateLobbyUi()
{
_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()
Expand Down
5 changes: 4 additions & 1 deletion Content.Client/Lobby/UI/LobbyGui.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@
<!-- Vertical Padding-->
<Control VerticalExpand="True"/>
<!-- 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"/>
<PanelContainer StyleClasses="AngleRect">
<RichTextLabel Name="LobbySong" Access="Public" HorizontalAlignment="Center" />
</PanelContainer>
</BoxContainer>
</Control>
<!-- Character setup state -->
Expand Down
Loading

0 comments on commit e579090

Please sign in to comment.