2024-10-15 15:22:06 +03:00
|
|
|
using Content.Shared._CP14.Workbench;
|
|
|
|
|
using Robust.Shared.Prototypes;
|
|
|
|
|
using Robust.Shared.Serialization;
|
|
|
|
|
using Robust.Shared.Utility;
|
|
|
|
|
|
2024-10-29 12:18:35 +03:00
|
|
|
namespace Content.Shared._CP14.Cargo;
|
2024-10-15 15:22:06 +03:00
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public enum CP14StoreUiKey
|
|
|
|
|
{
|
|
|
|
|
Key,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public sealed class CP14StoreUiState : BoundUserInterfaceState
|
|
|
|
|
{
|
2025-03-06 12:01:43 +03:00
|
|
|
public readonly string ShopName;
|
2024-10-15 15:22:06 +03:00
|
|
|
public readonly HashSet<CP14StoreUiProductEntry> ProductsBuy;
|
|
|
|
|
public readonly HashSet<CP14StoreUiProductEntry> ProductsSell;
|
|
|
|
|
|
2025-03-06 12:01:43 +03:00
|
|
|
public CP14StoreUiState(string name, HashSet<CP14StoreUiProductEntry> productsBuy, HashSet<CP14StoreUiProductEntry> productsSell)
|
2024-10-15 15:22:06 +03:00
|
|
|
{
|
2025-03-06 12:01:43 +03:00
|
|
|
ShopName = name;
|
2024-10-15 15:22:06 +03:00
|
|
|
ProductsBuy = productsBuy;
|
|
|
|
|
ProductsSell = productsSell;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public readonly struct CP14StoreUiProductEntry : IEquatable<CP14StoreUiProductEntry>
|
|
|
|
|
{
|
|
|
|
|
public readonly string ProtoId;
|
2025-03-06 12:01:43 +03:00
|
|
|
public readonly SpriteSpecifier? Icon;
|
|
|
|
|
public readonly EntProtoId? EntityView;
|
2024-10-15 15:22:06 +03:00
|
|
|
public readonly string Name;
|
|
|
|
|
public readonly string Desc;
|
|
|
|
|
public readonly int Price;
|
2025-01-19 00:09:30 +03:00
|
|
|
public readonly bool Special;
|
2024-10-15 15:22:06 +03:00
|
|
|
|
2025-03-06 12:01:43 +03:00
|
|
|
public CP14StoreUiProductEntry(string protoId, SpriteSpecifier? icon, EntProtoId? entityView, string name, string desc, int price, bool special)
|
2024-10-15 15:22:06 +03:00
|
|
|
{
|
|
|
|
|
ProtoId = protoId;
|
|
|
|
|
Icon = icon;
|
2025-03-06 12:01:43 +03:00
|
|
|
EntityView = entityView;
|
2024-10-15 15:22:06 +03:00
|
|
|
Name = name;
|
|
|
|
|
Desc = desc;
|
|
|
|
|
Price = price;
|
2025-01-19 00:09:30 +03:00
|
|
|
Special = special;
|
2024-10-15 15:22:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool Equals(CP14StoreUiProductEntry other)
|
|
|
|
|
{
|
|
|
|
|
return ProtoId == other.ProtoId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool Equals(object? obj)
|
|
|
|
|
{
|
|
|
|
|
return obj is CP14StoreUiProductEntry other && Equals(other);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
|
{
|
|
|
|
|
return HashCode.Combine(ProtoId, Icon, Name, Desc, Price);
|
|
|
|
|
}
|
|
|
|
|
}
|