Makes accept cloning message use Eui (#2910)
This commit is contained in:
committed by
GitHub
parent
c04a0270e1
commit
9c2aaef73a
@@ -1,45 +0,0 @@
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects.Components.UserInterface;
|
||||
|
||||
namespace Content.Client.GameObjects.Components
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public class AcceptCloningBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
|
||||
public AcceptCloningBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
||||
{
|
||||
}
|
||||
|
||||
private AcceptCloningWindow _window;
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
|
||||
_window = new AcceptCloningWindow();
|
||||
_window.OnClose += Close;
|
||||
_window.DenyButton.OnPressed += _ => _window.Close();
|
||||
_window.ConfirmButton.OnPressed += _ =>
|
||||
{
|
||||
SendMessage(
|
||||
new SharedAcceptCloningComponent.UiButtonPressedMessage(
|
||||
SharedAcceptCloningComponent.UiButton.Accept));
|
||||
_window.Close();
|
||||
};
|
||||
_window.OpenCentered();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
||||
if (disposing)
|
||||
{
|
||||
_window?.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using Content.Client.Eui;
|
||||
using Content.Shared.GameObjects.Components.Medical;
|
||||
using Content.Shared.GameObjects.Components.Observer;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Observer
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public class AcceptCloningEui : BaseEui
|
||||
{
|
||||
private readonly AcceptCloningWindow _window;
|
||||
|
||||
public AcceptCloningEui()
|
||||
{
|
||||
_window = new AcceptCloningWindow();
|
||||
|
||||
_window.DenyButton.OnPressed += _ =>
|
||||
{
|
||||
SendMessage(new AcceptCloningChoiceMessage(AcceptCloningUiButton.Deny));
|
||||
_window.Close();
|
||||
};
|
||||
|
||||
_window.AcceptButton.OnPressed += _ =>
|
||||
{
|
||||
SendMessage(new AcceptCloningChoiceMessage(AcceptCloningUiButton.Accept));
|
||||
_window.Close();
|
||||
};
|
||||
}
|
||||
|
||||
public override void Opened()
|
||||
{
|
||||
_window.OpenCentered();
|
||||
}
|
||||
|
||||
public override void Closed()
|
||||
{
|
||||
_window.Close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,15 @@
|
||||
#nullable enable
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.Localization;
|
||||
|
||||
namespace Content.Client.GameObjects.Components
|
||||
namespace Content.Client.GameObjects.Components.Observer
|
||||
{
|
||||
public sealed class AcceptCloningWindow : SS14Window
|
||||
{
|
||||
public readonly Button DenyButton;
|
||||
public readonly Button ConfirmButton;
|
||||
public readonly Button AcceptButton;
|
||||
|
||||
public AcceptCloningWindow()
|
||||
{
|
||||
@@ -23,18 +24,25 @@ namespace Content.Client.GameObjects.Components
|
||||
{
|
||||
Children =
|
||||
{
|
||||
(new Label
|
||||
(new Label()
|
||||
{
|
||||
Text = Loc.GetString("You are being cloned! Transfer your soul to the clone body?")
|
||||
Text = Loc.GetString("You are being cloned!\nTransfer your soul to the clone body?")
|
||||
}),
|
||||
new HBoxContainer
|
||||
{
|
||||
Align = BoxContainer.AlignMode.Center,
|
||||
Children =
|
||||
{
|
||||
(ConfirmButton = new Button
|
||||
(AcceptButton = new Button
|
||||
{
|
||||
Text = Loc.GetString("Yes"),
|
||||
}),
|
||||
|
||||
(new Control()
|
||||
{
|
||||
CustomMinimumSize = (20, 0)
|
||||
}),
|
||||
|
||||
(DenyButton = new Button
|
||||
{
|
||||
Text = Loc.GetString("No"),
|
||||
Reference in New Issue
Block a user