diff --git a/Content.Client/_NF/Shipyard/BUI/ShipyardConsoleBoundUserInterface.cs b/Content.Client/_NF/Shipyard/BUI/ShipyardConsoleBoundUserInterface.cs index f4c251223bd..202b162b600 100644 --- a/Content.Client/_NF/Shipyard/BUI/ShipyardConsoleBoundUserInterface.cs +++ b/Content.Client/_NF/Shipyard/BUI/ShipyardConsoleBoundUserInterface.cs @@ -1,15 +1,16 @@ using Content.Client._NF.Shipyard.UI; -using Content.Shared.Containers.ItemSlots; using Content.Shared._NF.Shipyard.BUI; using Content.Shared._NF.Shipyard.Events; +using Content.Shared.Containers.ItemSlots; using static Robust.Client.UserInterface.Controls.BaseButton; +#pragma warning disable CS0618 // Type or member is obsolete namespace Content.Client._NF.Shipyard.BUI; public sealed class ShipyardConsoleBoundUserInterface : BoundUserInterface { private ShipyardConsoleMenu? _menu; - private ShipyardRulesPopup? _rulesWindow; + //private ShipyardRulesPopup? _rulesWindow; public int Balance { get; private set; } public int? ShipSellValue { get; private set; } @@ -40,7 +41,10 @@ protected override void Open() _menu.TargetIdButton.OnPressed += _ => SendMessage(new ItemSlotButtonPressedEvent("ShipyardConsole-targetId")); } - private void Populate(List availablePrototypes, List unavailablePrototypes, bool freeListings, bool validId) + private void Populate(List availablePrototypes, + List unavailablePrototypes, + bool freeListings, + bool validId) { if (_menu == null) return; @@ -60,8 +64,11 @@ protected override void UpdateState(BoundUserInterfaceState state) Balance = cState.Balance; ShipSellValue = cState.ShipSellValue; - var castState = (ShipyardConsoleInterfaceState) state; - Populate(castState.ShipyardPrototypes.available, castState.ShipyardPrototypes.unavailable, castState.FreeListings, castState.IsTargetIdPresent); + var castState = (ShipyardConsoleInterfaceState)state; + Populate(castState.ShipyardPrototypes.available, + castState.ShipyardPrototypes.unavailable, + castState.FreeListings, + castState.IsTargetIdPresent); _menu?.UpdateState(castState); } @@ -69,7 +76,8 @@ protected override void Dispose(bool disposing) { base.Dispose(disposing); - if (!disposing) return; + if (!disposing) + return; _menu?.Dispose(); } @@ -84,6 +92,7 @@ private void ApproveOrder(ButtonEventArgs args) var vesselId = row.Vessel.ID; SendMessage(new ShipyardConsolePurchaseMessage(vesselId)); } + private void SellShip(ButtonEventArgs args) { //reserved for a sanity check, but im not sure what since we check all the important stuffs on server already diff --git a/Content.Client/_Null/Nullith/BUI/NullithConsoleBoundUserInterface.cs b/Content.Client/_Null/Nullith/BUI/NullithConsoleBoundUserInterface.cs new file mode 100644 index 00000000000..3f8ef32182e --- /dev/null +++ b/Content.Client/_Null/Nullith/BUI/NullithConsoleBoundUserInterface.cs @@ -0,0 +1,81 @@ +using Content.Client._Null.Nullith.UI; +using Content.Shared._Null.Nullith; +using Content.Shared._Null.Nullith.Events; +using Content.Shared.Containers.ItemSlots; +using Robust.Client.UserInterface.Controls; + +#pragma warning disable CS0618 // Type or member is obsolete + +namespace Content.Client._Null.Nullith.BUI; + +/// +public sealed class NullithConsoleBoundUserInterface : BoundUserInterface +{ + private NullithConsoleMenu? _menu; + + public int Balance { get; private set; } + + public NullithConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) + { + } + + protected override void Open() + { + base.Open(); + _menu = new NullithConsoleMenu(this); + _menu.OpenCentered(); + // The Shipyard Console may be used as reference for rules menu popup, if it needs implementation. + // Else-wise, it shall NOT here as it isn't needed as of 20251201. + _menu.OnClose += Close; + _menu.OnOrderApproved += ApproveOrder; + _menu.TargetIdButton.OnPressed += _ => SendMessage(new ItemSlotButtonPressedEvent("ShipyardConsole-targetId")); + } + + private void Populate(List availablePrototypes, + List unavailablePrototypes, + bool freeListings, + bool validId) + { + if (_menu == null) + return; + + _menu.PopulateLocations(availablePrototypes, unavailablePrototypes, freeListings, validId); + _menu.PopulateCategories(availablePrototypes, unavailablePrototypes); + } + + protected override void UpdateState(BoundUserInterfaceState state) + { + base.UpdateState(state); + + if (state is not NullithConsoleInterfaceState consoleState) + return; + + Balance = consoleState.Balance; + Populate( + consoleState.ShipyardPrototypes.available, + consoleState.ShipyardPrototypes.unavailable, + consoleState.FreeListings, + consoleState.IsTargetIdPresent); + _menu?.UpdateState(consoleState); + } + + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + + if (!disposing) + return; + _menu?.Dispose(); + } + + private void ApproveOrder(BaseButton.ButtonEventArgs args) + { + if (args.Button.Parent?.Parent is not PoIRow row || row.PoI == null) + { + return; + } + + var pointOfInterestId = row.PoI.ID; + SendMessage(new NullithConsolePurchaseMessage(pointOfInterestId)); + } +} diff --git a/Content.Client/_Null/Nullith/UI/NullithConsoleMenu.xaml b/Content.Client/_Null/Nullith/UI/NullithConsoleMenu.xaml new file mode 100644 index 00000000000..4d7a09246a3 --- /dev/null +++ b/Content.Client/_Null/Nullith/UI/NullithConsoleMenu.xaml @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +