mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-05-02 21:17:30 +03:00
# Description This ports Playing Cards from: Estacao Pirata... Frontier... and GoobStation... More specifically, ports https://github.com/Goob-Station/Goob-Station/pull/1215 and https://github.com/Goob-Station/Goob-Station/pull/1311 sequentially. In short... - Adds 3 skins of the playing cards: Nanotrasen, Syndicate, and Black. - NT can be obtained as an item in your loadout but is locked behind a command job. - Syndicate can be obtained as a pointless item in the uplink for 1 TC. - Black can be obtained both as an item in your loadout and from the Games Vendor. --- # TODO before review <!-- A list of everything you have to do before this PR is "complete" You probably won't have to complete everything before merging but it's good to leave future references --> - [X] De-namespace all of (_)EstacaoPirata? (not required, it is an EE fork) - [X] **_TO MAINTAINERS/CONTRIBS, NEED YOUR INPUT!!!_**: See `Content.Client/Inventory/StrippableBoundUserInterface.cs:220`'s "DRAFT TODO". Basically its me asking how to involve the thieving trait in the omission of the playing cards in the strip menu. Currently, it does not take into account the trait and simply obscures. (prolly dont take the trait into account, obscure regardless) - [X] Figure out what to do with the Nanotrasen deck variant: should it remain free like the black deck or restricted like the syndicate? Locked behind any command job? (prolly this) - [X] Get media actually filled in --- <!-- This is default collapsed, readers click to expand it and see all your media The PR media section can get very large at times, so this is a good way to keep it clean The title is written using HTML tags The title must be within the <summary> tags or you won't see it --> <details><summary><h1>Media</h1></summary> <p>  </p> </details> --- # Changelog <!-- You can add an author after the `🆑` to change the name that appears in the changelog (ex: `🆑 Death`) Leaving it blank will default to your GitHub display name This includes all available types for the changelog --> 🆑 - add: Playing Cards. You may get one in the Games Vendor or as an item in your loadout. --------- Co-authored-by: VMSolidus <evilexecutive@gmail.com> (cherry picked from commit 9b5cce20f185d8da3cdddd2fa6cad14ccd38db77)
98 lines
2.9 KiB
C#
98 lines
2.9 KiB
C#
using Content.Client.UserInterface.Controls;
|
|
using Content.Shared.Popups;
|
|
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Client.Player;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Client.UserInterface.XAML;
|
|
using System.Numerics;
|
|
using Content.Shared._EstacaoPirata.Cards.Card;
|
|
using Content.Shared._EstacaoPirata.Cards.Stack;
|
|
|
|
namespace Content.Client._EstacaoPirata.Cards.Hand.UI;
|
|
|
|
[GenerateTypedNameReferences]
|
|
public sealed partial class CardHandMenu : RadialMenu
|
|
{
|
|
[Dependency] private readonly EntityManager _entManager = default!;
|
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
|
|
|
private readonly SpriteSystem _spriteSystem;
|
|
private readonly SharedPopupSystem _popup;
|
|
|
|
public event Action<NetEntity>? CardHandDrawMessageAction;
|
|
|
|
private EntityUid _owner;
|
|
|
|
public CardHandMenu(EntityUid owner, CardHandMenuBoundUserInterface bui)
|
|
{
|
|
IoCManager.InjectDependencies(this);
|
|
RobustXamlLoader.Load(this);
|
|
|
|
_spriteSystem = _entManager.System<SpriteSystem>();
|
|
_popup = _entManager.System<SharedPopupSystem>();
|
|
|
|
_owner = owner;
|
|
|
|
// Find the main radial container
|
|
var main = FindControl<RadialContainer>("Main");
|
|
|
|
if (!_entManager.TryGetComponent<CardStackComponent>(owner, out var stack))
|
|
return;
|
|
|
|
foreach (var card in stack.Cards)
|
|
{
|
|
if (_playerManager.LocalSession == null
|
|
|| !_entManager.TryGetComponent<CardComponent>(card, out var cardComp))
|
|
return;
|
|
|
|
string cardName;
|
|
if (cardComp.Flipped && _entManager.TryGetComponent<MetaDataComponent>(card, out var metadata))
|
|
cardName = metadata.EntityName;
|
|
else
|
|
cardName = Loc.GetString(cardComp.Name);
|
|
|
|
var button = new CardMenuButton()
|
|
{
|
|
StyleClasses = { "RadialMenuButton" },
|
|
SetSize = new Vector2(64f, 64f),
|
|
ToolTip = cardName,
|
|
};
|
|
|
|
if (_entManager.TryGetComponent<SpriteComponent>(card, out var sprite))
|
|
{
|
|
if (sprite.Icon == null)
|
|
continue;
|
|
|
|
var tex = new TextureRect()
|
|
{
|
|
VerticalAlignment = VAlignment.Center,
|
|
HorizontalAlignment = HAlignment.Center,
|
|
Texture = sprite.Icon?.Default,
|
|
TextureScale = new Vector2(2f, 2f),
|
|
};
|
|
|
|
button.AddChild(tex);
|
|
}
|
|
|
|
main.AddChild(button);
|
|
|
|
button.OnButtonUp += _ =>
|
|
{
|
|
CardHandDrawMessageAction?.Invoke(_entManager.GetNetEntity(card));
|
|
Close();
|
|
};
|
|
}
|
|
|
|
CardHandDrawMessageAction += bui.SendCardHandDrawMessage;
|
|
}
|
|
}
|
|
|
|
public sealed class CardMenuButton : RadialMenuTextureButton
|
|
{
|
|
public CardMenuButton()
|
|
{
|
|
|
|
}
|
|
}
|