[Sci] Non-destructive XenoArch Research (#15398)
* Non-destructive XenoArch research * nerf the price * Points -> Extract
This commit is contained in:
@@ -23,19 +23,19 @@ public sealed class AnalysisConsoleBoundUserInterface : BoundUserInterface
|
||||
_consoleMenu.OnClose += Close;
|
||||
_consoleMenu.OpenCentered();
|
||||
|
||||
_consoleMenu.OnServerSelectionButtonPressed += _ =>
|
||||
_consoleMenu.OnServerSelectionButtonPressed += () =>
|
||||
{
|
||||
SendMessage(new AnalysisConsoleServerSelectionMessage());
|
||||
};
|
||||
_consoleMenu.OnScanButtonPressed += _ =>
|
||||
_consoleMenu.OnScanButtonPressed += () =>
|
||||
{
|
||||
SendMessage(new AnalysisConsoleScanButtonPressedMessage());
|
||||
};
|
||||
_consoleMenu.OnPrintButtonPressed += _ =>
|
||||
_consoleMenu.OnPrintButtonPressed += () =>
|
||||
{
|
||||
SendMessage(new AnalysisConsolePrintButtonPressedMessage());
|
||||
};
|
||||
_consoleMenu.OnDestroyButtonPressed += _ =>
|
||||
_consoleMenu.OnDestroyButtonPressed += () =>
|
||||
{
|
||||
SendMessage(new AnalysisConsoleDestroyButtonPressedMessage());
|
||||
};
|
||||
@@ -61,7 +61,6 @@ public sealed class AnalysisConsoleBoundUserInterface : BoundUserInterface
|
||||
|
||||
if (!disposing)
|
||||
return;
|
||||
_consoleMenu?.AnalysisDestroyWindow?.Close();
|
||||
_consoleMenu?.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ using Content.Client.UserInterface.Controls;
|
||||
using Content.Shared.Xenoarchaeology.Equipment;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -13,42 +12,20 @@ namespace Content.Client.Xenoarchaeology.Ui;
|
||||
public sealed partial class AnalysisConsoleMenu : FancyWindow
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _ent = default!;
|
||||
|
||||
public AnalysisDestroyWindow? AnalysisDestroyWindow;
|
||||
|
||||
public event Action<BaseButton.ButtonEventArgs>? OnServerSelectionButtonPressed;
|
||||
public event Action<BaseButton.ButtonEventArgs>? OnScanButtonPressed;
|
||||
public event Action<BaseButton.ButtonEventArgs>? OnPrintButtonPressed;
|
||||
public event Action<BaseButton.ButtonEventArgs>? OnDestroyButtonPressed;
|
||||
public event Action? OnServerSelectionButtonPressed;
|
||||
public event Action? OnScanButtonPressed;
|
||||
public event Action? OnPrintButtonPressed;
|
||||
public event Action? OnDestroyButtonPressed;
|
||||
|
||||
public AnalysisConsoleMenu()
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
IoCManager.InjectDependencies(this);
|
||||
|
||||
ServerSelectionButton.OnPressed += a => OnServerSelectionButtonPressed?.Invoke(a);
|
||||
ScanButton.OnPressed += a => OnScanButtonPressed?.Invoke(a);
|
||||
PrintButton.OnPressed += a => OnPrintButtonPressed?.Invoke(a);
|
||||
DestroyButton.OnPressed += _ => OnDestroyButton();
|
||||
}
|
||||
|
||||
private void OnDestroyButton()
|
||||
{
|
||||
// check if window is already open
|
||||
if (AnalysisDestroyWindow is { IsOpen: true })
|
||||
{
|
||||
AnalysisDestroyWindow.MoveToFront();
|
||||
return;
|
||||
}
|
||||
|
||||
// open a new one
|
||||
AnalysisDestroyWindow = new ();
|
||||
AnalysisDestroyWindow.OpenCentered();
|
||||
|
||||
AnalysisDestroyWindow.OnYesButton += a =>
|
||||
{
|
||||
OnDestroyButtonPressed?.Invoke(a);
|
||||
};
|
||||
ServerSelectionButton.OnPressed += _ => OnServerSelectionButtonPressed?.Invoke();
|
||||
ScanButton.OnPressed += _ => OnScanButtonPressed?.Invoke();
|
||||
PrintButton.OnPressed += _ => OnPrintButtonPressed?.Invoke();
|
||||
DestroyButton.OnPressed += _ => OnDestroyButtonPressed?.Invoke();
|
||||
}
|
||||
|
||||
public void SetButtonsDisabled(AnalysisConsoleScanUpdateState state)
|
||||
@@ -56,7 +33,7 @@ public sealed partial class AnalysisConsoleMenu : FancyWindow
|
||||
ScanButton.Disabled = !state.CanScan;
|
||||
PrintButton.Disabled = !state.CanPrint;
|
||||
|
||||
var disabled = !state.ServerConnected || !state.CanScan;
|
||||
var disabled = !state.ServerConnected || !state.CanScan || state.PointAmount <= 0;
|
||||
|
||||
DestroyButton.Disabled = disabled;
|
||||
|
||||
@@ -128,12 +105,5 @@ public sealed partial class AnalysisConsoleMenu : FancyWindow
|
||||
("seconds", (int) state.TotalTime.TotalSeconds - (int) state.TimeRemaining.TotalSeconds));
|
||||
ProgressBar.Value = (float) state.TimeRemaining.Divide(state.TotalTime);
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
{
|
||||
base.Close();
|
||||
|
||||
AnalysisDestroyWindow?.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
<controls:FancyWindow
|
||||
xmlns="https://spacestation14.io"
|
||||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
|
||||
Title="{Loc 'analysis-destroy-window-title'}"
|
||||
MinSize="256 100">
|
||||
<BoxContainer
|
||||
Margin="10 10"
|
||||
HorizontalExpand="True"
|
||||
Orientation="Vertical"
|
||||
VerticalExpand="True">
|
||||
<Label Text="{Loc 'analysis-destroy-window-text'}" />
|
||||
<BoxContainer
|
||||
Margin="10 10 10 10"
|
||||
VerticalAlignment="Bottom"
|
||||
Orientation="Horizontal"
|
||||
HorizontalExpand="True">
|
||||
<Button Name="YesButton" Text="{Loc 'analysis-destroy-window-yes'}" HorizontalExpand="True"></Button>
|
||||
<BoxContainer SetSize="10 10"></BoxContainer>
|
||||
<Button Name="NoButton" Text="{Loc 'analysis-destroy-window-no'}" HorizontalExpand="True"></Button>
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
</controls:FancyWindow>
|
||||
@@ -1,26 +0,0 @@
|
||||
using Content.Client.Stylesheets;
|
||||
using Content.Client.UserInterface.Controls;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
|
||||
namespace Content.Client.Xenoarchaeology.Ui;
|
||||
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class AnalysisDestroyWindow : FancyWindow
|
||||
{
|
||||
public event Action<BaseButton.ButtonEventArgs>? OnYesButton;
|
||||
|
||||
public AnalysisDestroyWindow()
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
|
||||
YesButton.AddStyleClass(StyleBase.ButtonCaution);
|
||||
YesButton.OnPressed += a =>
|
||||
{
|
||||
OnYesButton?.Invoke(a);
|
||||
Close();
|
||||
};
|
||||
NoButton.OnPressed += _ => Close();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user