2024-10-15 15:22:06 +03:00
|
|
|
using Robust.Client.AutoGenerated;
|
|
|
|
|
using Robust.Client.GameObjects;
|
|
|
|
|
using Robust.Client.UserInterface;
|
|
|
|
|
using Robust.Client.UserInterface.XAML;
|
|
|
|
|
using Robust.Shared.Prototypes;
|
|
|
|
|
using Robust.Shared.Utility;
|
|
|
|
|
|
2025-05-29 00:22:47 +03:00
|
|
|
namespace Content.Client._CP14.UserInterface;
|
2024-10-15 15:22:06 +03:00
|
|
|
|
|
|
|
|
[GenerateTypedNameReferences]
|
|
|
|
|
public sealed partial class CP14PriceControl : Control
|
|
|
|
|
{
|
|
|
|
|
[Dependency] private readonly IEntityManager _entity = default!;
|
|
|
|
|
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
|
|
|
|
|
|
|
|
|
private readonly SpriteSystem _sprite;
|
|
|
|
|
|
|
|
|
|
public CP14PriceControl(int price)
|
|
|
|
|
{
|
|
|
|
|
RobustXamlLoader.Load(this);
|
|
|
|
|
IoCManager.InjectDependencies(this);
|
|
|
|
|
|
|
|
|
|
_sprite = _entity.System<SpriteSystem>();
|
|
|
|
|
|
|
|
|
|
var rsiPath = new ResPath("_CP14/Interface/Misc/coins.rsi");
|
|
|
|
|
|
|
|
|
|
var total = price;
|
|
|
|
|
|
|
|
|
|
var gp = total / 100;
|
|
|
|
|
total %= 100;
|
|
|
|
|
|
|
|
|
|
var sp = total / 10;
|
|
|
|
|
total %= 10;
|
|
|
|
|
|
|
|
|
|
var cp = total;
|
|
|
|
|
|
|
|
|
|
CopperView.Texture = _sprite.Frame0(new SpriteSpecifier.Rsi(rsiPath, "c"));
|
|
|
|
|
CopperText.Text = cp.ToString();
|
|
|
|
|
|
|
|
|
|
SilverView.Texture = _sprite.Frame0(new SpriteSpecifier.Rsi(rsiPath, "s"));
|
|
|
|
|
SilverText.Text = sp.ToString();
|
|
|
|
|
|
|
|
|
|
GoldView.Texture = _sprite.Frame0(new SpriteSpecifier.Rsi(rsiPath, "g"));
|
|
|
|
|
GoldText.Text = gp.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|