Option to delay uplink item purchase (#20214)

* Time delay for certain uplink stock.

* Remove glitchy timer and add refresh button.
This commit is contained in:
Repo
2023-09-20 11:51:15 +12:00
committed by GitHub
parent 6db59967bd
commit 41139bf2b2
5 changed files with 64 additions and 3 deletions

View File

@@ -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();
}