Cloning Rework (#8972)

Co-authored-by: fishfish458 <fishfish458>
This commit is contained in:
Rane
2022-08-04 00:05:17 -04:00
committed by GitHub
parent 37f9e825ea
commit 2f4849eae1
41 changed files with 928 additions and 1227 deletions

View File

@@ -1,51 +0,0 @@
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using static Content.Shared.MedicalScanner.SharedMedicalScannerComponent;
namespace Content.Client.MedicalScanner.UI
{
[UsedImplicitly]
public sealed class MedicalScannerBoundUserInterface : BoundUserInterface
{
private MedicalScannerWindow? _window;
public MedicalScannerBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
{
}
protected override void Open()
{
base.Open();
_window = new MedicalScannerWindow
{
Title = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Owner).EntityName,
};
_window.OnClose += Close;
_window.ScanButton.OnPressed += _ => SendMessage(new ScanButtonPressedMessage());
_window.OpenCentered();
}
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
if (state is not MedicalScannerBoundUserInterfaceState cast)
return;
_window?.Populate(cast);
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing)
return;
if (_window != null)
_window.OnClose -= Close;
_window?.Dispose();
}
}
}

View File

@@ -1,11 +0,0 @@
<DefaultWindow xmlns="https://spacestation14.io"
MinSize="200 100"
SetSize="200 100">
<BoxContainer Orientation="Vertical">
<Label Name="OccupantName"/>
<Button Name="ScanButton"
Disabled="True"
Access="Public"
Text="{Loc 'medical-scanner-window-save-button-text'}" />
</BoxContainer>
</DefaultWindow>

View File

@@ -1,22 +0,0 @@
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using static Content.Shared.MedicalScanner.SharedMedicalScannerComponent;
namespace Content.Client.MedicalScanner.UI
{
[GenerateTypedNameReferences]
public sealed partial class MedicalScannerWindow : DefaultWindow
{
public MedicalScannerWindow()
{
RobustXamlLoader.Load(this);
}
public void Populate(MedicalScannerBoundUserInterfaceState state)
{
ScanButton.Disabled = !state.IsScannable;
}
}
}