From e5df8dbee347f9777b8beabb479bfae3ceb8b7f7 Mon Sep 17 00:00:00 2001 From: Alex Evgrashin Date: Sun, 3 Oct 2021 07:05:52 +0300 Subject: [PATCH] Moving PDA to ECS (#4538) * Moved pen slot to separate component * Moved it all to more generic item slot class * Add sounds * Item slots now supports many slots * Some clean-up * Refactored slots a bit * Moving ID card out * Moving pda to system * Moving PDA owner to ECS * Moved PDA flashlight to separate component * Toggle lights work through events * Fixing UI * Moving uplink to separate component * Continue moving uplink to separate component * More cleaning * Removing pda shared * Nuked shared pda component * Fixed flashlight * Pen slot now showed in UI * Light toggle now shows correctly in UI * Small refactoring of item slots * Added contained entity * Fixed tests * Finished with PDA * Moving PDA uplink to separate window * Adding-removing uplink should show new button * Working on a better debug * Debug command to add uplink * Uplink send state to UI * Almost working UI * Uplink correcty updates when you buy-sell items * Ups * Moved localization to separate file * Minor fixes * Removed item slots methods events * Removed PDA owner name * Removed one uplink event * Deleted all uplink events * Removed flashlight events * Update Content.Shared/Traitor/Uplink/UplinkVisuals.cs Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Update Content.Server/Containers/ItemSlot/ItemSlotsSystem.cs Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Update Content.Server/Containers/ItemSlot/ItemSlotsSystem.cs Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Update Content.Server/GameTicking/Presets/PresetTraitorDeathMatch.cs Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Item slots system review * Flashlight review * PDA to XAML * Move UplinkMenu to seperate class, fix WeightedColors methods * Move UI to XAML * Moved events to entity id * Address review * Removed uplink extensions * Minor fix * Moved item slots to shared * My bad Robust... * Fixed pda sound * Fixed pda tests * Fixed pda test again Co-authored-by: Alexander Evgrashin Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: Visne --- Content.Client/Entry/IgnoredComponents.cs | 3 + Content.Client/PDA/PDABoundUserInterface.cs | 478 +------------- Content.Client/PDA/PDAComponent.cs | 39 -- Content.Client/PDA/PDAMenu.xaml | 32 + Content.Client/PDA/PDAMenu.xaml.cs | 28 + Content.Client/PDA/PDAVisualizer.cs | 7 +- .../Uplink/UplinkBoundUserInterface.cs | 112 ++++ Content.Client/Traitor/Uplink/UplinkMenu.xaml | 43 ++ .../Traitor/Uplink/UplinkMenu.xaml.cs | 166 +++++ .../Tests/PDA/PDAExtensionsTests.cs | 18 +- Content.Server/Entry/EntryPoint.cs | 2 +- .../GameTicking/GameTicker.Spawning.cs | 3 +- .../GameTicking/Presets/PresetSuspicion.cs | 37 +- .../GameTicking/Presets/PresetTraitor.cs | 27 +- .../Presets/PresetTraitorDeathMatch.cs | 28 +- Content.Server/IoC/ServerContentIoC.cs | 2 +- .../UnpoweredFlashlightComponent.cs | 44 ++ .../UnpoweredFlashlightSystem.cs | 31 + .../Light/Events/LightToggleEvent.cs | 14 + Content.Server/PDA/PDAComponent.cs | 597 +++--------------- Content.Server/PDA/PDASystem.cs | 183 ++++++ Content.Server/PDA/PdaAccessSet.cs | 118 ++++ Content.Server/Sandbox/SandboxManager.cs | 8 +- .../Uplink/Commands/AddUplinkCommand.cs | 93 +++ .../Uplink/Managers/IUplinkManager.cs} | 5 +- .../Uplink/Managers/UplinkManager.cs} | 17 +- .../Traitor/Uplink/UplinkComponent.cs | 24 + Content.Server/Traitor/Uplink/UplinkEvents.cs | 21 + Content.Server/Traitor/Uplink/UplinkSystem.cs | 166 +++++ .../TraitorDeathMatchRedemptionComponent.cs | 17 +- .../Containers/ItemSlot/ItemSlotEvents.cs | 23 + .../ItemSlot/SharedItemSlotsComponent.cs | 39 ++ .../ItemSlot/SharedItemSlotsSystem.cs | 187 ++++++ .../Light/SharedUnpoweredFlashlightVisuals.cs | 11 + Content.Shared/PDA/PDAMessagesUI.cs | 52 ++ Content.Shared/PDA/PDAUpdateState.cs | 33 + Content.Shared/PDA/PDAVisuals.cs | 18 + Content.Shared/PDA/SharedPDAComponent.cs | 197 ------ .../Traitor/Uplink/UplinkAccount.cs | 32 + .../Traitor/Uplink/UplinkAccountData.cs | 19 + .../Traitor/Uplink/UplinkListingData.cs | 38 ++ .../Traitor/Uplink/UplinkMessagesUI.cs | 26 + .../Traitor/Uplink/UplinkNetworkEvents.cs | 16 + .../Traitor/Uplink/UplinkUpdateState.cs | 19 + .../Traitor/Uplink/UplinkVisuals.cs | 11 + .../en-US/containers/item-slots-component.ftl | 4 + .../unpowered-flashlight-component.ftl | 2 + Resources/Locale/en-US/pda/pda-component.ftl | 16 - .../en-US/traitor/uplink/uplink-component.ftl | 3 + .../Entities/Objects/Devices/pda.yml | 19 + 50 files changed, 1815 insertions(+), 1313 deletions(-) delete mode 100644 Content.Client/PDA/PDAComponent.cs create mode 100644 Content.Client/PDA/PDAMenu.xaml create mode 100644 Content.Client/PDA/PDAMenu.xaml.cs create mode 100644 Content.Client/Traitor/Uplink/UplinkBoundUserInterface.cs create mode 100644 Content.Client/Traitor/Uplink/UplinkMenu.xaml create mode 100644 Content.Client/Traitor/Uplink/UplinkMenu.xaml.cs create mode 100644 Content.Server/Light/Components/UnpoweredFlashlightComponent.cs create mode 100644 Content.Server/Light/EntitySystems/UnpoweredFlashlightSystem.cs create mode 100644 Content.Server/Light/Events/LightToggleEvent.cs create mode 100644 Content.Server/PDA/PDASystem.cs create mode 100644 Content.Server/PDA/PdaAccessSet.cs create mode 100644 Content.Server/Traitor/Uplink/Commands/AddUplinkCommand.cs rename Content.Server/{PDA/Managers/IPDAUplinkManager.cs => Traitor/Uplink/Managers/IUplinkManager.cs} (81%) rename Content.Server/{PDA/Managers/PDAUplinkManager.cs => Traitor/Uplink/Managers/UplinkManager.cs} (84%) create mode 100644 Content.Server/Traitor/Uplink/UplinkComponent.cs create mode 100644 Content.Server/Traitor/Uplink/UplinkEvents.cs create mode 100644 Content.Server/Traitor/Uplink/UplinkSystem.cs create mode 100644 Content.Shared/Containers/ItemSlot/ItemSlotEvents.cs create mode 100644 Content.Shared/Containers/ItemSlot/SharedItemSlotsComponent.cs create mode 100644 Content.Shared/Containers/ItemSlot/SharedItemSlotsSystem.cs create mode 100644 Content.Shared/Light/SharedUnpoweredFlashlightVisuals.cs create mode 100644 Content.Shared/PDA/PDAMessagesUI.cs create mode 100644 Content.Shared/PDA/PDAUpdateState.cs create mode 100644 Content.Shared/PDA/PDAVisuals.cs delete mode 100644 Content.Shared/PDA/SharedPDAComponent.cs create mode 100644 Content.Shared/Traitor/Uplink/UplinkAccount.cs create mode 100644 Content.Shared/Traitor/Uplink/UplinkAccountData.cs create mode 100644 Content.Shared/Traitor/Uplink/UplinkListingData.cs create mode 100644 Content.Shared/Traitor/Uplink/UplinkMessagesUI.cs create mode 100644 Content.Shared/Traitor/Uplink/UplinkNetworkEvents.cs create mode 100644 Content.Shared/Traitor/Uplink/UplinkUpdateState.cs create mode 100644 Content.Shared/Traitor/Uplink/UplinkVisuals.cs create mode 100644 Resources/Locale/en-US/containers/item-slots-component.ftl create mode 100644 Resources/Locale/en-US/light/components/unpowered-flashlight-component.ftl create mode 100644 Resources/Locale/en-US/traitor/uplink/uplink-component.ftl diff --git a/Content.Client/Entry/IgnoredComponents.cs b/Content.Client/Entry/IgnoredComponents.cs index a25353f798..a1575636cd 100644 --- a/Content.Client/Entry/IgnoredComponents.cs +++ b/Content.Client/Entry/IgnoredComponents.cs @@ -275,6 +275,9 @@ namespace Content.Client.Entry "Advertise", "PowerNetworkBattery", "BatteryCharger", + "UnpoweredFlashlight", + "Uplink", + "PDA", "SpawnItemsOnUse", "Wieldable", "IncreaseDamageOnWield", diff --git a/Content.Client/PDA/PDABoundUserInterface.cs b/Content.Client/PDA/PDABoundUserInterface.cs index b445d16358..23b4ae1166 100644 --- a/Content.Client/PDA/PDABoundUserInterface.cs +++ b/Content.Client/PDA/PDABoundUserInterface.cs @@ -1,19 +1,13 @@ -using System; -using Content.Client.Examine; using Content.Client.Message; using Content.Shared.PDA; using JetBrains.Annotations; using Robust.Client.GameObjects; -using Robust.Client.Graphics; -using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.CustomControls; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; -using Robust.Shared.Maths; using Robust.Shared.Prototypes; -using static Robust.Client.UserInterface.Controls.BaseButton; using static Robust.Client.UserInterface.Controls.BoxContainer; namespace Content.Client.PDA @@ -21,11 +15,7 @@ namespace Content.Client.PDA [UsedImplicitly] public class PDABoundUserInterface : BoundUserInterface { - [Dependency] private readonly IPrototypeManager _prototypeManager = default!; - [Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!; - private PDAMenu? _menu; - private PDAMenuPopup? _failPopup; public PDABoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey) { @@ -35,7 +25,7 @@ namespace Content.Client.PDA { base.Open(); SendMessage(new PDARequestUpdateInterfaceMessage()); - _menu = new PDAMenu(this, _prototypeManager); + _menu = new PDAMenu(); _menu.OpenToLeft(); _menu.OnClose += Close; _menu.FlashLightToggleButton.OnToggled += _ => @@ -43,7 +33,7 @@ namespace Content.Client.PDA SendMessage(new PDAToggleFlashlightMessage()); }; - _menu.EjectIDButton.OnPressed += _ => + _menu.EjectIdButton.OnPressed += _ => { SendMessage(new PDAEjectIDMessage()); }; @@ -53,37 +43,11 @@ namespace Content.Client.PDA SendMessage(new PDAEjectPenMessage()); }; - _menu.MasterTabContainer.OnTabChanged += i => + _menu.ActivateUplinkButton.OnPressed += _ => { - var tab = _menu.MasterTabContainer.GetChild(i); - if (tab == _menu.UplinkTabContainer) - { - SendMessage(new PDARequestUpdateInterfaceMessage()); - } + SendMessage(new PDAShowUplinkMessage()); }; - _menu.OnListingButtonPressed += (_, listing) => - { - if (_menu.CurrentLoggedInAccount?.DataBalance < listing.Price) - { - _failPopup = new PDAMenuPopup(Loc.GetString("pda-bound-user-interface-insufficient-funds-popup")); - _userInterfaceManager.ModalRoot.AddChild(_failPopup); - _failPopup.Open(UIBox2.FromDimensions(_menu.Position.X + 150, _menu.Position.Y + 60, 156, 24)); - _menu.OnClose += () => - { - _failPopup.Dispose(); - }; - } - - SendMessage(new PDAUplinkBuyListingMessage(listing.ItemId)); - }; - - _menu.OnCategoryButtonPressed += (_, category) => - { - _menu.CurrentFilterCategory = category; - SendMessage(new PDARequestUpdateInterfaceMessage()); - - }; } protected override void UpdateState(BoundUserInterfaceState state) @@ -103,45 +67,26 @@ namespace Content.Client.PDA if (msg.PDAOwnerInfo.ActualOwnerName != null) { - _menu.PDAOwnerLabel.SetMarkup(Loc.GetString("comp-pda-ui-owner", + _menu.PdaOwnerLabel.SetMarkup(Loc.GetString("comp-pda-ui-owner", ("ActualOwnerName", msg.PDAOwnerInfo.ActualOwnerName))); } if (msg.PDAOwnerInfo.IdOwner != null || msg.PDAOwnerInfo.JobTitle != null) { - _menu.IDInfoLabel.SetMarkup(Loc.GetString("comp-pda-ui", + _menu.IdInfoLabel.SetMarkup(Loc.GetString("comp-pda-ui", ("Owner",msg.PDAOwnerInfo.IdOwner ?? "Unknown"), ("JobTitle",msg.PDAOwnerInfo.JobTitle ?? "Unassigned"))); } else { - _menu.IDInfoLabel.SetMarkup(Loc.GetString("comp-pda-ui-blank")); + _menu.IdInfoLabel.SetMarkup(Loc.GetString("comp-pda-ui-blank")); } - _menu.EjectIDButton.Visible = msg.PDAOwnerInfo.IdOwner != null || msg.PDAOwnerInfo.JobTitle != null; + _menu.EjectIdButton.Visible = msg.PDAOwnerInfo.IdOwner != null || msg.PDAOwnerInfo.JobTitle != null; _menu.EjectPenButton.Visible = msg.HasPen; + _menu.ActivateUplinkButton.Visible = msg.HasUplink; - if (msg.Account != null) - { - _menu.CurrentLoggedInAccount = msg.Account; - var balance = msg.Account.DataBalance; - var weightedColor = GetWeightedColorString(balance); - _menu.BalanceInfo.SetMarkup(Loc.GetString("pda-bound-user-interface-tc-balance-popup", - ("weightedColor",weightedColor), - ("balance",balance))); - } - - if (msg.Listings != null) - { - _menu.ClearListings(); - foreach (var item in msg.Listings) //Should probably chunk these out instead. to-do if this clogs the internet tubes. - { - _menu.AddListingGui(item); - } - } - - _menu.MasterTabContainer.SetTabVisible(1, msg.Account != null); break; } } @@ -156,410 +101,5 @@ namespace Content.Client.PDA _menu?.Dispose(); } - - /// - /// This is shitcode. It is, however, "PJB-approved shitcode". - /// - /// - /// - public static Color GetWeightedColor(int x) - { - var weightedColor = Color.Gray; - if (x <= 0) - { - return weightedColor; - } - if (x <= 5) - { - weightedColor = Color.LimeGreen; - } - else if (x > 5 && x < 10) - { - weightedColor = Color.Yellow; - } - else if (x > 10 && x <= 20) - { - weightedColor = Color.Orange; - } - else if (x > 20 && x <= 50) - { - weightedColor = Color.Purple; - } - - return weightedColor; - } - - public static string GetWeightedColorString(int x) - { - var weightedColor = "gray"; - if (x <= 0) - { - return weightedColor; - } - - if (x <= 5) - { - weightedColor = "green"; - } - else if (x > 5 && x < 10) - { - weightedColor = "yellow"; - } - else if (x > 10 && x <= 20) - { - weightedColor = "yellow"; - } - else if (x > 20 && x <= 50) - { - weightedColor = "purple"; - } - return weightedColor; - } - - public sealed class PDAMenuPopup : Popup - { - public PDAMenuPopup(string text) - { - var label = new RichTextLabel(); - label.SetMessage(text); - AddChild(new PanelContainer - { - StyleClasses = { ExamineSystem.StyleClassEntityTooltip }, - Children = { label } - }); - } - } - - private class PDAMenu : SS14Window - { - private PDABoundUserInterface _owner { get; } - - public Button FlashLightToggleButton { get; } - public Button EjectIDButton { get; } - public Button EjectPenButton { get; } - - public readonly TabContainer MasterTabContainer; - - public RichTextLabel PDAOwnerLabel { get; } - public PanelContainer IDInfoContainer { get; } - public RichTextLabel IDInfoLabel { get; } - - public BoxContainer UplinkTabContainer { get; } - - protected readonly SplitContainer CategoryAndListingsContainer; - - private readonly IPrototypeManager _prototypeManager; - - public readonly BoxContainer UplinkListingsContainer; - - public readonly BoxContainer CategoryListContainer; - public readonly RichTextLabel BalanceInfo; - public event Action? OnListingButtonPressed; - public event Action? OnCategoryButtonPressed; - - public UplinkCategory CurrentFilterCategory - { - get => _currentFilter; - set - { - if (value.GetType() != typeof(UplinkCategory)) - { - return; - } - - _currentFilter = value; - } - } - - public UplinkAccountData? CurrentLoggedInAccount - { - get => _loggedInUplinkAccount; - set => _loggedInUplinkAccount = value; - } - - private UplinkCategory _currentFilter; - private UplinkAccountData? _loggedInUplinkAccount; - - public PDAMenu(PDABoundUserInterface owner, IPrototypeManager prototypeManager) - { - MinSize = SetSize = (512, 256); - - _owner = owner; - _prototypeManager = prototypeManager; - Title = Loc.GetString("comp-pda-ui-menu-title"); - - #region MAIN_MENU_TAB - //Main menu - PDAOwnerLabel = new RichTextLabel - { - }; - - IDInfoLabel = new RichTextLabel() - { - HorizontalExpand = true, - }; - - EjectIDButton = new Button - { - Text = Loc.GetString("comp-pda-ui-eject-id-button"), - HorizontalAlignment = HAlignment.Center, - VerticalAlignment = VAlignment.Center - }; - EjectPenButton = new Button - { - Text = Loc.GetString("comp-pda-ui-eject-pen-button"), - HorizontalAlignment = HAlignment.Center, - VerticalAlignment = VAlignment.Center - }; - - var innerHBoxContainer = new BoxContainer - { - Orientation = LayoutOrientation.Horizontal, - Children = - { - IDInfoLabel, - EjectIDButton, - EjectPenButton - } - }; - - IDInfoContainer = new PanelContainer - { - Children = - { - innerHBoxContainer, - } - }; - - FlashLightToggleButton = new Button - { - Text = Loc.GetString("comp-pda-ui-toggle-flashlight-button"), - ToggleMode = true, - }; - - var mainMenuTabContainer = new BoxContainer - { - Orientation = LayoutOrientation.Vertical, - VerticalExpand = true, - HorizontalExpand = true, - MinSize = (50, 50), - - Children = - { - PDAOwnerLabel, - IDInfoContainer, - FlashLightToggleButton - } - }; - - #endregion - - #region UPLINK_TAB - //Uplink Tab - CategoryListContainer = new BoxContainer - { - Orientation = LayoutOrientation.Vertical - }; - - BalanceInfo = new RichTextLabel - { - HorizontalAlignment = HAlignment.Center, - }; - - //Red background container. - var masterPanelContainer = new PanelContainer - { - PanelOverride = new StyleBoxFlat { BackgroundColor = Color.Black }, - VerticalExpand = true - }; - - //This contains both the panel of the category buttons and the listings box. - CategoryAndListingsContainer = new SplitContainer - { - Orientation = SplitContainer.SplitOrientation.Horizontal, - VerticalExpand = true, - }; - - - var uplinkShopScrollContainer = new ScrollContainer - { - HorizontalExpand = true, - VerticalExpand = true, - SizeFlagsStretchRatio = 2, - }; - - //Add the category list to the left side. The store items to center. - var categoryListContainerBackground = new PanelContainer - { - PanelOverride = new StyleBoxFlat { BackgroundColor = Color.Gray.WithAlpha(0.02f) }, - VerticalExpand = true, - Children = - { - CategoryListContainer - } - }; - - CategoryAndListingsContainer.AddChild(categoryListContainerBackground); - CategoryAndListingsContainer.AddChild(uplinkShopScrollContainer); - masterPanelContainer.AddChild(CategoryAndListingsContainer); - - //Actual list of buttons for buying a listing from the uplink. - UplinkListingsContainer = new BoxContainer - { - Orientation = LayoutOrientation.Vertical, - HorizontalExpand = true, - VerticalExpand = true, - SizeFlagsStretchRatio = 2, - MinSize = (100, 256), - }; - uplinkShopScrollContainer.AddChild(UplinkListingsContainer); - - var innerVboxContainer = new BoxContainer - { - Orientation = LayoutOrientation.Vertical, - VerticalExpand = true, - - Children = - { - BalanceInfo, - masterPanelContainer - } - }; - - UplinkTabContainer = new BoxContainer - { - Orientation = LayoutOrientation.Vertical, - Children = - { - innerVboxContainer - } - }; - PopulateUplinkCategoryButtons(); - #endregion - - //The master menu that contains all of the tabs. - MasterTabContainer = new TabContainer - { - Children = - { - mainMenuTabContainer, - } - }; - - //Add all the tabs to the Master container. - MasterTabContainer.SetTabTitle(0, Loc.GetString("pda-bound-user-interface-main-menu-tab-title")); - MasterTabContainer.AddChild(UplinkTabContainer); - MasterTabContainer.SetTabTitle(1, Loc.GetString("pda-bound-user-interface-uplink-tab-title")); - Contents.AddChild(MasterTabContainer); - } - - private void PopulateUplinkCategoryButtons() - { - - foreach (UplinkCategory cat in Enum.GetValues(typeof(UplinkCategory))) - { - - var catButton = new PDAUplinkCategoryButton - { - Text = Loc.GetString(cat.ToString()), - ButtonCategory = cat - - }; - //It'd be neat if it could play a cool tech ping sound when you switch categories, - //but right now there doesn't seem to be an easy way to do client-side audio without still having to round trip to the server and - //send to a specific client INetChannel. - catButton.OnPressed += args => OnCategoryButtonPressed?.Invoke(args, catButton.ButtonCategory); - - CategoryListContainer.AddChild(catButton); - } - - } - - public void AddListingGui(UplinkListingData listing) - { - if (!_prototypeManager.TryIndex(listing.ItemId, out EntityPrototype? prototype) || listing.Category != CurrentFilterCategory) - { - return; - } - var weightedColor = GetWeightedColor(listing.Price); - var itemLabel = new Label - { - Text = listing.ListingName == string.Empty ? prototype.Name : listing.ListingName, - ToolTip = listing.Description == string.Empty ? prototype.Description : listing.Description, - HorizontalExpand = true, - Modulate = _loggedInUplinkAccount?.DataBalance >= listing.Price - ? Color.White - : Color.Gray.WithAlpha(0.30f) - }; - - var priceLabel = new Label - { - Text = $"{listing.Price} TC", - HorizontalAlignment = HAlignment.Right, - Modulate = _loggedInUplinkAccount?.DataBalance >= listing.Price - ? weightedColor - : Color.Gray.WithAlpha(0.30f) - }; - - //Padding for the price lable. - var pricePadding = new BoxContainer - { - Orientation = LayoutOrientation.Horizontal, - MinSize = (32, 1), - }; - - //Contains the name of the item and its price. Used for spacing item name and price. - var listingButtonHbox = new BoxContainer - { - Orientation = LayoutOrientation.Horizontal, - Children = - { - itemLabel, - priceLabel, - pricePadding - } - }; - - var listingButtonPanelContainer = new PanelContainer - { - Children = - { - listingButtonHbox - } - }; - - var pdaUplinkListingButton = new PDAUplinkItemButton(listing) - { - Children = - { - listingButtonPanelContainer - } - }; - pdaUplinkListingButton.OnPressed += args - => OnListingButtonPressed?.Invoke(args, pdaUplinkListingButton.ButtonListing); - UplinkListingsContainer.AddChild(pdaUplinkListingButton); - } - - public void ClearListings() - { - UplinkListingsContainer.Children.Clear(); - } - - private sealed class PDAUplinkItemButton : ContainerButton - { - public PDAUplinkItemButton(UplinkListingData data) - { - ButtonListing = data; - } - - public UplinkListingData ButtonListing { get; } - } - - private sealed class PDAUplinkCategoryButton : Button - { - public UplinkCategory ButtonCategory; - - } - } } } diff --git a/Content.Client/PDA/PDAComponent.cs b/Content.Client/PDA/PDAComponent.cs deleted file mode 100644 index 353e9675a5..0000000000 --- a/Content.Client/PDA/PDAComponent.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Content.Shared.PDA; -using Content.Shared.Sound; -using Robust.Shared.Audio; -using Robust.Shared.GameObjects; -using Robust.Shared.Network; -using Robust.Shared.Player; -using Robust.Shared.Players; -using Robust.Shared.Serialization.Manager.Attributes; -using Robust.Shared.ViewVariables; - -namespace Content.Client.PDA -{ - [RegisterComponent] - public class PDAComponent : SharedPDAComponent - { - [ViewVariables] - [DataField("buySuccessSound")] - private SoundSpecifier BuySuccessSound { get; } = new SoundPathSpecifier("/Audio/Effects/kaching.ogg"); - - [ViewVariables] - [DataField("insufficientFundsSound")] - private SoundSpecifier InsufficientFundsSound { get; } = new SoundPathSpecifier("/Audio/Effects/error.ogg"); - - public override void HandleNetworkMessage(ComponentMessage message, INetChannel netChannel, ICommonSession? session = null) - { - base.HandleNetworkMessage(message, netChannel, session); - switch (message) - { - case PDAUplinkBuySuccessMessage: - SoundSystem.Play(Filter.Local(), BuySuccessSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2f)); - break; - - case PDAUplinkInsufficientFundsMessage: - SoundSystem.Play(Filter.Local(), InsufficientFundsSound.GetSound(), Owner, AudioParams.Default); - break; - } - } - } -} diff --git a/Content.Client/PDA/PDAMenu.xaml b/Content.Client/PDA/PDAMenu.xaml new file mode 100644 index 0000000000..e477c94577 --- /dev/null +++ b/Content.Client/PDA/PDAMenu.xaml @@ -0,0 +1,32 @@ + + + + + + + +