Files
tbd-station-14/Content.Shared/Store/StoreUi.cs
keronshb 257909fd97 Adds a refund button & action upgrades for stores (#24518)
* adds refunds to stores

* Adds method to check for starting map

* comments, datafields, some requested changes

* turns event into ref event

* Adds datafields

* Switches to entity terminating event

* Changes store entity to be nullable and checks if store is terminating to remove reference.

* Tryadd instead of containskey

* Adds a refund disable method, disables refund on bought ent container changes if not an action

* Removes datafield specification

* Readds missing using statement

* Removes unused using statements

* What the heck is listing data

---------

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2024-02-04 11:48:51 +11:00

87 lines
1.9 KiB
C#

using Content.Shared.FixedPoint;
using Robust.Shared.Serialization;
namespace Content.Shared.Store;
[Serializable, NetSerializable]
public enum StoreUiKey : byte
{
Key
}
[Serializable, NetSerializable]
public sealed class StoreUpdateState : BoundUserInterfaceState
{
public readonly HashSet<ListingData> Listings;
public readonly Dictionary<string, FixedPoint2> Balance;
public readonly bool ShowFooter;
public readonly bool AllowRefund;
public StoreUpdateState(HashSet<ListingData> listings, Dictionary<string, FixedPoint2> balance, bool showFooter, bool allowRefund)
{
Listings = listings;
Balance = balance;
ShowFooter = showFooter;
AllowRefund = allowRefund;
}
}
/// <summary>
/// initializes miscellaneous data about the store.
/// </summary>
[Serializable, NetSerializable]
public sealed class StoreInitializeState : BoundUserInterfaceState
{
public readonly string Name;
public StoreInitializeState(string name)
{
Name = name;
}
}
[Serializable, NetSerializable]
public sealed class StoreRequestUpdateInterfaceMessage : BoundUserInterfaceMessage
{
public StoreRequestUpdateInterfaceMessage()
{
}
}
[Serializable, NetSerializable]
public sealed class StoreBuyListingMessage : BoundUserInterfaceMessage
{
public ListingData Listing;
public StoreBuyListingMessage(ListingData listing)
{
Listing = listing;
}
}
[Serializable, NetSerializable]
public sealed class StoreRequestWithdrawMessage : BoundUserInterfaceMessage
{
public string Currency;
public int Amount;
public StoreRequestWithdrawMessage(string currency, int amount)
{
Currency = currency;
Amount = amount;
}
}
/// <summary>
/// Used when the refund button is pressed
/// </summary>
[Serializable, NetSerializable]
public sealed class StoreRequestRefundMessage : BoundUserInterfaceMessage
{
}