diff --git a/Content.Client/Access/UI/IdCardConsoleWindow.xaml.cs b/Content.Client/Access/UI/IdCardConsoleWindow.xaml.cs index 3825b06cea8..4a72c149e32 100644 --- a/Content.Client/Access/UI/IdCardConsoleWindow.xaml.cs +++ b/Content.Client/Access/UI/IdCardConsoleWindow.xaml.cs @@ -57,9 +57,9 @@ public IdCardConsoleWindow(IdCardConsoleBoundUserInterface owner, IPrototypeMana }; JobTitleSaveButton.OnPressed += _ => SubmitData(); - ShipNameLineEdit.OnTextChanged += _ => EnsureValidShuttleName(); - ShipSuffixLineEdit.OnTextChanged += _ => EnsureValidShuttleName(); - ShipNameSaveButton.OnPressed += _ => SubmitShuttleData(); + ShipNameLineEdit.OnTextChanged += _ => EnsureValidShuttleName(); // Frontier + ShipSuffixLineEdit.OnTextChanged += _ => EnsureValidShuttleName(); // Frontier + ShipNameSaveButton.OnPressed += _ => SubmitShuttleData(); // Frontier var jobs = _prototypeManager.EnumeratePrototypes().ToList(); jobs.Sort((x, y) => string.Compare(x.LocalizedName, y.LocalizedName, StringComparison.CurrentCulture)); diff --git a/Content.Client/_NF/ShuttleRecords/BUI/ShuttleRecordsConsoleBoundUserInterface.cs b/Content.Client/_NF/ShuttleRecords/BUI/ShuttleRecordsConsoleBoundUserInterface.cs new file mode 100644 index 00000000000..75c6fed3c3f --- /dev/null +++ b/Content.Client/_NF/ShuttleRecords/BUI/ShuttleRecordsConsoleBoundUserInterface.cs @@ -0,0 +1,55 @@ +using Content.Client._NF.ShuttleRecords.UI; +using Content.Shared._NF.ShuttleRecords; +using Content.Shared._NF.ShuttleRecords.Components; +using Content.Shared._NF.ShuttleRecords.Events; +using Content.Shared.Containers.ItemSlots; + +namespace Content.Client._NF.ShuttleRecords.BUI; + +public sealed class ShuttleRecordsConsoleBoundUserInterface( + EntityUid owner, + Enum uiKey +) : BoundUserInterface(owner, uiKey) +{ + private ShuttleRecordsWindow? _window; + + protected override void Open() + { + base.Open(); + _window ??= new ShuttleRecordsWindow(); + _window.OnCopyDeed += CopyDeed; + _window.TargetIdButton.OnPressed += _ => SendMessage(new ItemSlotButtonPressedEvent(ShuttleRecordsConsoleComponent.TargetIdCardSlotId)); + + _window.OpenCentered(); + } + + protected override void UpdateState(BoundUserInterfaceState state) + { + base.UpdateState(state); + + if (_window == null || state is not ShuttleRecordsConsoleInterfaceState shuttleRecordsConsoleInterfaceState) + return; + + _window?.UpdateState(shuttleRecordsConsoleInterfaceState); + } + + /* + * This black magic code prevents multiple pop ups of the window from appearing. + */ + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + if (!disposing) + return; + _window?.Dispose(); + } + + private void CopyDeed(ShuttleRecord shuttleRecord) + { + if (!EntMan.GetEntity(shuttleRecord.EntityUid).Valid) + return; + + SendMessage(new CopyDeedMessage(shuttleRecord.EntityUid)); + } + +} diff --git a/Content.Client/_NF/ShuttleRecords/UI/ShuttleRecordDetailsControl.xaml b/Content.Client/_NF/ShuttleRecords/UI/ShuttleRecordDetailsControl.xaml new file mode 100644 index 00000000000..e9f5d4b6f84 --- /dev/null +++ b/Content.Client/_NF/ShuttleRecords/UI/ShuttleRecordDetailsControl.xaml @@ -0,0 +1,26 @@ + + + + diff --git a/Content.Client/_NF/ShuttleRecords/UI/ShuttleRecordDetailsControl.xaml.cs b/Content.Client/_NF/ShuttleRecords/UI/ShuttleRecordDetailsControl.xaml.cs new file mode 100644 index 00000000000..9d6656d295b --- /dev/null +++ b/Content.Client/_NF/ShuttleRecords/UI/ShuttleRecordDetailsControl.xaml.cs @@ -0,0 +1,42 @@ +using Content.Client.Message; +using Robust.Client.AutoGenerated; +using Robust.Client.UserInterface.Controls; +using Robust.Client.UserInterface.XAML; + +namespace Content.Client._NF.ShuttleRecords.UI; + +[GenerateTypedNameReferences] +public sealed partial class ShuttleRecordDetailsControl : PanelContainer +{ + public sealed class ViewState(string shuttleName, string shuttleOwnerName, string activity, string toolTip, string timeOfPurchase, string voucherStatus, string transactionCost, string shuttlePrice) + { + public string ShuttleName { get; } = shuttleName; + + public string ShuttleOwnerName { get; } = shuttleOwnerName; + + public string Activity { get; } = activity; + + public string ShuttlePrice { get; } = shuttlePrice; + + public string ToolTip { get; } = toolTip; + + public string TimeOfPurchase { get; } = timeOfPurchase; + + public string VoucherStatus { get; } = voucherStatus; + + public string TransactionCost { get; } = transactionCost; + } + + public ShuttleRecordDetailsControl(ViewState state) + { + RobustXamlLoader.Load(this); + ShuttleName.Text = state.ShuttleName; + ShuttleOwner.Text = state.ShuttleOwnerName; + ShuttleActivity.Text = state.Activity; + ShuttlePrice.Text = state.ShuttlePrice; + VoucherStatus.Text = state.VoucherStatus; + TimeOfPurchase.SetMarkup(state.TimeOfPurchase); + TransactionCostLabel.Text = state.TransactionCost; + ToolTip = state.ToolTip; + } +} diff --git a/Content.Client/_NF/ShuttleRecords/UI/ShuttleRecordListItem.xaml b/Content.Client/_NF/ShuttleRecords/UI/ShuttleRecordListItem.xaml new file mode 100644 index 00000000000..d6dae9d64f2 --- /dev/null +++ b/Content.Client/_NF/ShuttleRecords/UI/ShuttleRecordListItem.xaml @@ -0,0 +1,5 @@ + diff --git a/Content.Client/_NF/ShuttleRecords/UI/ShuttleRecordListItem.xaml.cs b/Content.Client/_NF/ShuttleRecords/UI/ShuttleRecordListItem.xaml.cs new file mode 100644 index 00000000000..e7e9a2b7941 --- /dev/null +++ b/Content.Client/_NF/ShuttleRecords/UI/ShuttleRecordListItem.xaml.cs @@ -0,0 +1,26 @@ +using Robust.Client.AutoGenerated; +using Robust.Client.UserInterface.Controls; +using Robust.Client.UserInterface.XAML; + +namespace Content.Client._NF.ShuttleRecords.UI; + +[GenerateTypedNameReferences] +public sealed partial class ShuttleRecordListItem : Button +{ + public sealed class ViewState(string shuttleName, string toolTip = "", bool disabled = false) + { + public string ShuttleName { get; } = shuttleName; + + public bool Disabled { get; } = disabled; + + public string ToolTip { get; } = toolTip; + } + + public ShuttleRecordListItem(ViewState state) + { + RobustXamlLoader.Load(this); + ShuttleName.Text = state.ShuttleName; + ToolTip = state.ToolTip; + Disabled = state.Disabled; + } +} diff --git a/Content.Client/_NF/ShuttleRecords/UI/ShuttleRecordsWindow.xaml b/Content.Client/_NF/ShuttleRecords/UI/ShuttleRecordsWindow.xaml new file mode 100644 index 00000000000..b41a11a0524 --- /dev/null +++ b/Content.Client/_NF/ShuttleRecords/UI/ShuttleRecordsWindow.xaml @@ -0,0 +1,66 @@ + + + + + + + + + + +