From 41139bf2b2afa0166d6774e8001a18baef662b96 Mon Sep 17 00:00:00 2001
From: Repo <47093363+Titian3@users.noreply.github.com>
Date: Wed, 20 Sep 2023 11:51:15 +1200
Subject: [PATCH] Option to delay uplink item purchase (#20214)
* Time delay for certain uplink stock.
* Remove glitchy timer and add refresh button.
---
.../Store/Ui/StoreBoundUserInterface.cs | 10 ++++-
Content.Client/Store/Ui/StoreMenu.xaml | 5 +++
Content.Client/Store/Ui/StoreMenu.xaml.cs | 44 ++++++++++++++++++-
Content.Shared/Store/ListingPrototype.cs | 7 +++
.../Prototypes/Catalog/uplink_catalog.yml | 1 +
5 files changed, 64 insertions(+), 3 deletions(-)
diff --git a/Content.Client/Store/Ui/StoreBoundUserInterface.cs b/Content.Client/Store/Ui/StoreBoundUserInterface.cs
index 0860abb9fa..6774ef35a0 100644
--- a/Content.Client/Store/Ui/StoreBoundUserInterface.cs
+++ b/Content.Client/Store/Ui/StoreBoundUserInterface.cs
@@ -2,6 +2,9 @@ using Content.Shared.Store;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using System.Linq;
+using System.Threading;
+using Serilog;
+using Timer = Robust.Shared.Timing.Timer;
namespace Content.Client.Store.Ui;
@@ -40,6 +43,11 @@ public sealed class StoreBoundUserInterface : BoundUserInterface
{
SendMessage(new StoreRequestWithdrawMessage(type, amount));
};
+
+ _menu.OnRefreshButtonPressed += (_) =>
+ {
+ SendMessage(new StoreRequestUpdateInterfaceMessage());
+ };
}
protected override void UpdateState(BoundUserInterfaceState state)
{
@@ -53,6 +61,7 @@ public sealed class StoreBoundUserInterface : BoundUserInterface
case StoreUpdateState msg:
_menu.UpdateBalance(msg.Balance);
_menu.PopulateStoreCategoryButtons(msg.Listings);
+
_menu.UpdateListing(msg.Listings.ToList());
_menu.SetFooterVisibility(msg.ShowFooter);
break;
@@ -71,7 +80,6 @@ public sealed class StoreBoundUserInterface : BoundUserInterface
base.Dispose(disposing);
if (!disposing)
return;
-
_menu?.Close();
_menu?.Dispose();
}
diff --git a/Content.Client/Store/Ui/StoreMenu.xaml b/Content.Client/Store/Ui/StoreMenu.xaml
index 824c153671..a454e3e2b7 100644
--- a/Content.Client/Store/Ui/StoreMenu.xaml
+++ b/Content.Client/Store/Ui/StoreMenu.xaml
@@ -12,6 +12,11 @@
HorizontalAlignment="Left"
Access="Public"
HorizontalExpand="True" />
+