Add a warning dialog to the observe button. (#4794)

This commit is contained in:
moonheart08
2021-10-08 09:22:57 -05:00
committed by GitHub
parent cc7d4a40b8
commit a2b04482a4
5 changed files with 43 additions and 2 deletions

View File

@@ -84,7 +84,6 @@ namespace Content.Client.Lobby
_userInterfaceManager.StateRoot.AddChild(_characterSetup); _userInterfaceManager.StateRoot.AddChild(_characterSetup);
}; };
_lobby.ObserveButton.OnPressed += _ => _consoleHost.ExecuteCommand("observe");
_lobby.ReadyButton.OnPressed += _ => _lobby.ReadyButton.OnPressed += _ =>
{ {
if (!gameTicker.IsGameStarted) if (!gameTicker.IsGameStarted)

View File

@@ -2,6 +2,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client" xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
xmlns:maths="clr-namespace:Robust.Shared.Maths;assembly=Robust.Shared.Maths" xmlns:maths="clr-namespace:Robust.Shared.Maths;assembly=Robust.Shared.Maths"
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls"
xmlns:parallax="clr-namespace:Content.Client.Parallax" xmlns:parallax="clr-namespace:Content.Client.Parallax"
xmlns:ui="clr-namespace:Content.Client.Voting.UI" xmlns:ui="clr-namespace:Content.Client.Voting.UI"
xmlns:style="clr-namespace:Content.Client.Stylesheets" xmlns:style="clr-namespace:Content.Client.Stylesheets"
@@ -37,7 +38,7 @@
<BoxContainer Orientation="Vertical" Name="CLeftPanelContainer" HorizontalExpand="True"> <BoxContainer Orientation="Vertical" Name="CLeftPanelContainer" HorizontalExpand="True">
<hudUi:StripeBack> <hudUi:StripeBack>
<BoxContainer Orientation="Horizontal" SeparationOverride="6" Margin="3 3 3 3"> <BoxContainer Orientation="Horizontal" SeparationOverride="6" Margin="3 3 3 3">
<Button Name="CObserveButton" Text="{Loc 'Observe'}" StyleClasses="ButtonBig" /> <cc:UICommandButton Command="observe" Name="CObserveButton" Text="{Loc 'Observe'}" StyleClasses="ButtonBig" WindowType="{x:Type lobbyUi:ObserveWarningWindow}"/>
<Label Name="CStartTime" Align="Right" <Label Name="CStartTime" Align="Right"
FontColorOverride="{x:Static maths:Color.DarkGray}" FontColorOverride="{x:Static maths:Color.DarkGray}"
StyleClasses="LabelBig" HorizontalExpand="True" /> StyleClasses="LabelBig" HorizontalExpand="True" />

View File

@@ -0,0 +1,13 @@
<SS14Window
xmlns="https://spacestation14.io"
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls">
<BoxContainer Orientation="Vertical">
<Label Text="{Loc 'observe-warning-1'}"/>
<Label Text="{Loc 'observe-warning-2'}"/>
<BoxContainer Orientation="Horizontal" >
<Button Name="NevermindButton" Text="{Loc 'observe-nevermind'}" SizeFlagsStretchRatio="1"/>
<Control HorizontalExpand="True" SizeFlagsStretchRatio="2" />
<cc:CommandButton Command="observe" Name="ObserveButton" StyleClasses="Caution" Text="{Loc 'Observe'}" SizeFlagsStretchRatio="1"/>
</BoxContainer>
</BoxContainer>
</SS14Window>

View File

@@ -0,0 +1,24 @@
using JetBrains.Annotations;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
namespace Content.Client.Lobby.UI
{
[GenerateTypedNameReferences]
[UsedImplicitly]
internal sealed partial class ObserveWarningWindow : SS14Window
{
public ObserveWarningWindow()
{
Title = Loc.GetString("observe-warning-window-title");
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
ObserveButton.OnPressed += _ => { this.Close(); };
NevermindButton.OnPressed += _ => { this.Close(); };
}
}
}

View File

@@ -0,0 +1,4 @@
observe-nevermind = Nevermind
observe-warning-1 = Are you sure you want to observe?
observe-warning-2 = You cannot play in the round if you do so.
observe-warning-window-title = Warning