Admin shuttle call button (#4859)

* shuttle call ui

* shuttle call ui

* Localize shuttle commands better.

* localization fix
This commit is contained in:
moonheart08
2021-10-13 12:15:28 -05:00
committed by GitHub
parent dfe500a8bb
commit 9250bd62cb
9 changed files with 128 additions and 11 deletions

View File

@@ -0,0 +1,14 @@
<SS14Window xmlns="https://spacestation14.io"
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls"
Title="{Loc 'admin-shuttle-title'}"
MinWidth="300">
<BoxContainer Orientation="Vertical">
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<LineEdit Name="_callShuttleTime" Text="4:00" PlaceHolder="m:ss" HorizontalExpand="True" SizeFlagsStretchRatio="2"/>
<Control HorizontalExpand="True" SizeFlagsStretchRatio="1"/>
<cc:CommandButton Command="callshuttle 4:00" Name="_callShuttleButton" Text="{Loc 'communicationsconsole-menu-call-shuttle'}" HorizontalExpand="True" SizeFlagsStretchRatio="2" />
</BoxContainer>
<cc:CommandButton Command="recallshuttle" Name="_recallShuttleButton" Text="{Loc 'communicationsconsole-menu-recall-shuttle'}" HorizontalAlignment="Center"/>
</BoxContainer>
</SS14Window>

View File

@@ -0,0 +1,31 @@
using System;
using Content.Shared.Localizations;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
namespace Content.Client.Administration.UI.Tabs.AdminTab
{
[GenerateTypedNameReferences]
public partial class AdminShuttleWindow : SS14Window
{
public AdminShuttleWindow()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
_callShuttleTime.OnTextChanged += CallShuttleTimeOnOnTextChanged;
}
private void CallShuttleTimeOnOnTextChanged(LineEdit.LineEditEventArgs obj)
{
var loc = IoCManager.Resolve<ILocalizationManager>();
_callShuttleButton.Disabled = !TimeSpan.TryParseExact(obj.Text, Localization.TimeSpanMinutesFormats, loc.DefaultCulture, out _);
_callShuttleButton.Command = $"callshuttle {obj.Text}";
}
}
}

View File

@@ -6,13 +6,14 @@
Margin="4"
MinSize="50 50">
<BoxContainer Orientation="Vertical">
<GridContainer Columns="4">
<GridContainer Columns="3">
<cc:UICommandButton Command="kick" Text="{Loc admin-player-actions-window-title}" WindowType="{x:Type at:PlayerActionsWindow}" />
<cc:UICommandButton Command="ban" Text="{Loc Ban}" WindowType="{x:Type at:BanWindow}" />
<cc:CommandButton Command="aghost" Text="{Loc Admin Ghost}" />
<cc:UICommandButton Command="tpto" Text="{Loc Teleport}" WindowType="{x:Type at:TeleportWindow}" />
<cc:CommandButton Command="permissions" Text="{Loc Permissions Panel}" />
<cc:CommandButton Command="announceui" Text="{Loc Announce}"/>
<cc:UICommandButton Command="callshuttle" Text="{Loc (Re)call Shuttle}" WindowType="{x:Type at:AdminShuttleWindow}"/>
</GridContainer>
</BoxContainer>
</Control>