using Content.Shared._CP14.Cargo; using Robust.Client.AutoGenerated; using Robust.Client.GameObjects; using Robust.Client.UserInterface; using Robust.Client.UserInterface.XAML; using Robust.Shared.Utility; namespace Content.Client._CP14.TravelingStoreShip; [GenerateTypedNameReferences] public sealed partial class CP14StoreProductControl : Control { [Dependency] private readonly IEntityManager _entity = default!; private readonly SpriteSystem _sprite; public CP14StoreProductControl(CP14StoreUiProductEntry entry) { RobustXamlLoader.Load(this); IoCManager.InjectDependencies(this); _sprite = _entity.System(); UpdateName(entry.Name); UpdateView(entry.Icon); UpdatePrice(entry.Price); } private void UpdatePrice(int price) { PriceHolder.RemoveAllChildren(); PriceHolder.AddChild(new CP14PriceControl(price)); } private void UpdateName(string name) { ProductName.Text = $"[bold]{name}[/bold]"; } private void UpdateView(SpriteSpecifier spriteSpecifier) { View.Texture = _sprite.Frame0(spriteSpecifier); } }