перенос файлов клиента из папки White в _White
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
using Content.Shared.White.AuthPanel;
|
||||
|
||||
namespace Content.Client._White.AuthPanel;
|
||||
|
||||
public sealed class AuthPanelBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
private AuthPanelMenu? _menu;
|
||||
|
||||
public AuthPanelBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
|
||||
_menu = new AuthPanelMenu();
|
||||
|
||||
_menu.OnRedButtonPressed(_=>SendButtonPressed(AuthPanelAction.ERTRecruit));
|
||||
_menu.OnAccessButtonPressed(_=>SendButtonPressed(AuthPanelAction.AddAccess));
|
||||
_menu.OnBluespaceWeaponButtonPressed(_=>SendButtonPressed(AuthPanelAction.BluespaceWeapon));
|
||||
|
||||
_menu.OnClose += Close;
|
||||
_menu.OpenCentered();
|
||||
}
|
||||
|
||||
public void SendButtonPressed(AuthPanelAction button)
|
||||
{
|
||||
SendMessage(new AuthPanelButtonPressedMessage(button,_menu?.GetReason()));
|
||||
}
|
||||
|
||||
|
||||
protected override void UpdateState(BoundUserInterfaceState state)
|
||||
{
|
||||
if(state is not AuthPanelConfirmationActionState confirmationActionState)
|
||||
return;
|
||||
|
||||
var action = confirmationActionState.Action;
|
||||
|
||||
if(action.Action is AuthPanelAction.AddAccess)
|
||||
_menu?.SetAccessCount(action.ConfirmedPeopleCount,action.MaxConfirmedPeopleCount);
|
||||
if(action.Action is AuthPanelAction.ERTRecruit)
|
||||
_menu?.SetRedCount(action.ConfirmedPeopleCount,action.MaxConfirmedPeopleCount);
|
||||
if(action.Action is AuthPanelAction.BluespaceWeapon)
|
||||
_menu?.SetWeaponCount(action.ConfirmedPeopleCount,action.MaxConfirmedPeopleCount);
|
||||
|
||||
_menu?.SetReason(action.Reason);
|
||||
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
if (!disposing)
|
||||
return;
|
||||
_menu?.Close();
|
||||
}
|
||||
}
|
||||
40
Content.Client/_White/AuthPanel/AuthPanelMenu.xaml
Normal file
40
Content.Client/_White/AuthPanel/AuthPanelMenu.xaml
Normal file
@@ -0,0 +1,40 @@
|
||||
<controls:FancyWindow xmlns="https://spacestation14.io"
|
||||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
|
||||
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
|
||||
Title="Auth panel"
|
||||
MinSize="500 350"
|
||||
SetSize="500 350">
|
||||
<BoxContainer Orientation="Vertical"
|
||||
HorizontalExpand="True"
|
||||
VerticalExpand="True"
|
||||
Margin="5 0 5 0">
|
||||
|
||||
<controls:StripeBack HasBottomEdge="True" HasMargins="False" HorizontalExpand="True">
|
||||
<Label Align="Center" Text="{Loc 'auth-panel-attention'}"/>
|
||||
</controls:StripeBack>
|
||||
<Label Margin="0 10 0 2" Align="Center" Text="{Loc 'auth-panel-critical-only'}"/>
|
||||
<Label Margin="0 2 0 2" Align="Center" Text="{Loc 'auth-panel-reason-write'}"/>
|
||||
<LineEdit Margin="0 2 0 10" Name="Reason" PlaceHolder="{Loc 'auth-panel-reason'}"/>
|
||||
<customControls:HSeparator/>
|
||||
|
||||
<controls:StripeBack HasBottomEdge="True" HasMargins="False" HorizontalExpand="True">
|
||||
<BoxContainer Orientation="Vertical">
|
||||
<BoxContainer HorizontalExpand="True" Name="RedContainer">
|
||||
<Button Name="RedButton" MinWidth="410" Margin="0 5 0 0" HorizontalAlignment="Left" Text="{Loc 'auth-panel-red-button'}"/>
|
||||
<Label Name="RedCount" Margin="25 0 4 0" HorizontalAlignment="Right" Visible="False"/>
|
||||
</BoxContainer>
|
||||
|
||||
<BoxContainer HorizontalExpand="True" Name="AccessContainer">
|
||||
<Button Name="AccessButton" MinWidth="410" Margin="0 5 0 0" HorizontalAlignment="Left" Text="{Loc 'auth-panel-access-button'}" Disabled="True"/>
|
||||
<Label Name="AccessCount" Margin="25 0 4 0" HorizontalAlignment="Right" Visible="False"/>
|
||||
</BoxContainer>
|
||||
|
||||
<BoxContainer HorizontalExpand="True" Name="BluespaceWeaponContainer">
|
||||
<Button Name="BluespaceWeaponButton" MinWidth="410" Margin="0 5 0 5" HorizontalAlignment="Left" Text="{Loc 'auth-panel-unlock-weapon'}" Disabled="True"/>
|
||||
<Label Name="BluespaceWeaponCount" Margin="25 0 4 0" HorizontalAlignment="Right" Visible="False"/>
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
</controls:StripeBack>
|
||||
|
||||
</BoxContainer>
|
||||
</controls:FancyWindow>
|
||||
66
Content.Client/_White/AuthPanel/AuthPanelMenu.xaml.cs
Normal file
66
Content.Client/_White/AuthPanel/AuthPanelMenu.xaml.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using Content.Client.UserInterface.Controls;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
|
||||
namespace Content.Client._White.AuthPanel;
|
||||
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class AuthPanelMenu : FancyWindow
|
||||
{
|
||||
|
||||
public void OnRedButtonPressed(Action<BaseButton.ButtonEventArgs> func)
|
||||
{
|
||||
RedButton.OnPressed += func;
|
||||
}
|
||||
|
||||
public void OnAccessButtonPressed(Action<BaseButton.ButtonEventArgs> func)
|
||||
{
|
||||
AccessButton.OnPressed += func;
|
||||
}
|
||||
|
||||
public void OnBluespaceWeaponButtonPressed(Action<BaseButton.ButtonEventArgs> func)
|
||||
{
|
||||
BluespaceWeaponButton.OnPressed += func;
|
||||
}
|
||||
|
||||
public void SetCount(Label label,int conf, int maxconf)
|
||||
{
|
||||
label.Visible = conf != 0;
|
||||
label.Text = conf + "/" + maxconf;
|
||||
}
|
||||
|
||||
public void SetRedCount(int conf, int maxconf)
|
||||
{
|
||||
SetCount(RedCount,conf,maxconf);
|
||||
RedButton.Disabled = conf >= maxconf;
|
||||
AccessContainer.Visible = false;
|
||||
BluespaceWeaponContainer.Visible = false;
|
||||
}
|
||||
|
||||
public void SetAccessCount(int conf, int maxconf)
|
||||
{
|
||||
SetCount(AccessCount,conf,maxconf);
|
||||
AccessButton.Disabled = conf >= maxconf;
|
||||
RedContainer.Visible = false;
|
||||
BluespaceWeaponContainer.Visible = false;
|
||||
}
|
||||
|
||||
public void SetWeaponCount(int conf, int maxconf)
|
||||
{
|
||||
SetCount(BluespaceWeaponCount,conf,maxconf);
|
||||
BluespaceWeaponButton.Disabled = conf >= maxconf;
|
||||
RedContainer.Visible = false;
|
||||
AccessContainer.Visible = false;
|
||||
}
|
||||
|
||||
public string GetReason()
|
||||
{
|
||||
return Reason.Text;
|
||||
}
|
||||
|
||||
public void SetReason(string reason)
|
||||
{
|
||||
Reason.Text = reason;
|
||||
Reason.Editable = false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user