ОБР работает
This commit is contained in:
@@ -17,9 +17,9 @@ public sealed class AuthPanelBoundUserInterface : BoundUserInterface
|
||||
|
||||
_menu = new AuthPanelMenu();
|
||||
|
||||
_menu.OnRedButtonPressed(_=>SendButtonPressed(AuthPanelAction.ERTRecruit));
|
||||
_menu.OnAccessButtonPressed(_=>SendButtonPressed(AuthPanelAction.AddAccess));
|
||||
_menu.OnBluespaceWeaponButtonPressed(_=>SendButtonPressed(AuthPanelAction.BluespaceWeapon));
|
||||
_menu.OnRedButtonPressed(_ => SendButtonPressed(AuthPanelAction.ERTRecruit));
|
||||
// _menu.OnAccessButtonPressed(_ => SendButtonPressed(AuthPanelAction.AddAccess));
|
||||
// _menu.OnBluespaceWeaponButtonPressed(_ => SendButtonPressed(AuthPanelAction.BluespaceWeapon));
|
||||
|
||||
_menu.OnClose += Close;
|
||||
_menu.OpenCentered();
|
||||
@@ -27,26 +27,27 @@ public sealed class AuthPanelBoundUserInterface : BoundUserInterface
|
||||
|
||||
public void SendButtonPressed(AuthPanelAction button)
|
||||
{
|
||||
SendMessage(new AuthPanelButtonPressedMessage(button,_menu?.GetReason()));
|
||||
SendMessage(new AuthPanelButtonPressedMessage(button, _menu?.GetReason()));
|
||||
}
|
||||
|
||||
|
||||
protected override void UpdateState(BoundUserInterfaceState state)
|
||||
{
|
||||
if(state is not AuthPanelConfirmationActionState confirmationActionState)
|
||||
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);
|
||||
// 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);
|
||||
|
||||
if (action.ConfirmedPeopleCount == 0)
|
||||
_menu?.UnlockReason();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<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">
|
||||
Title="{Loc 'auth-panel-name'}"
|
||||
MinSize="500 300"
|
||||
SetSize="500 300">
|
||||
<BoxContainer Orientation="Vertical"
|
||||
HorizontalExpand="True"
|
||||
VerticalExpand="True"
|
||||
@@ -21,10 +21,10 @@
|
||||
<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"/>
|
||||
<Label Name="RedCount" Margin="25 0 4 0" HorizontalAlignment="Right" Visible="true"/>
|
||||
</BoxContainer>
|
||||
|
||||
<BoxContainer HorizontalExpand="True" Name="AccessContainer">
|
||||
<!-- <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>
|
||||
@@ -32,7 +32,7 @@
|
||||
<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> -->
|
||||
</BoxContainer>
|
||||
</controls:StripeBack>
|
||||
|
||||
|
||||
@@ -7,23 +7,22 @@ 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 OnAccessButtonPressed(Action<BaseButton.ButtonEventArgs> func)
|
||||
// {
|
||||
// AccessButton.OnPressed += func;
|
||||
// }
|
||||
|
||||
public void OnBluespaceWeaponButtonPressed(Action<BaseButton.ButtonEventArgs> func)
|
||||
{
|
||||
BluespaceWeaponButton.OnPressed += func;
|
||||
}
|
||||
// public void OnBluespaceWeaponButtonPressed(Action<BaseButton.ButtonEventArgs> func)
|
||||
// {
|
||||
// BluespaceWeaponButton.OnPressed += func;
|
||||
// }
|
||||
|
||||
public void SetCount(Label label,int conf, int maxconf)
|
||||
public void SetCount(Label label, int conf, int maxconf)
|
||||
{
|
||||
label.Visible = conf != 0;
|
||||
label.Text = conf + "/" + maxconf;
|
||||
@@ -31,27 +30,27 @@ public sealed partial class AuthPanelMenu : FancyWindow
|
||||
|
||||
public void SetRedCount(int conf, int maxconf)
|
||||
{
|
||||
SetCount(RedCount,conf,maxconf);
|
||||
SetCount(RedCount, conf, maxconf);
|
||||
RedButton.Disabled = conf >= maxconf;
|
||||
AccessContainer.Visible = false;
|
||||
BluespaceWeaponContainer.Visible = false;
|
||||
// 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 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 void SetWeaponCount(int conf, int maxconf)
|
||||
// {
|
||||
// SetCount(BluespaceWeaponCount, conf, maxconf);
|
||||
// BluespaceWeaponButton.Disabled = conf >= maxconf;
|
||||
// RedContainer.Visible = false;
|
||||
// AccessContainer.Visible = false;
|
||||
// }
|
||||
|
||||
public string GetReason()
|
||||
{
|
||||
@@ -63,4 +62,9 @@ public sealed partial class AuthPanelMenu : FancyWindow
|
||||
Reason.Text = reason;
|
||||
Reason.Editable = false;
|
||||
}
|
||||
|
||||
public void UnlockReason()
|
||||
{
|
||||
Reason.Editable = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user