Files
riversong-code-showcase/Source/Riversong/Game/UI/Panels/BuildingPanel/HousePanelUpgradeMaterialModel.cs
2026-05-21 16:04:49 +02:00

42 lines
1014 B
C#

using Unity.Properties;
using UnityEngine;
namespace DanieleMarotta.RiversongCodeShowcase
{
public class HousePanelUpgradeMaterialModel : UIModel
{
private int _remaining;
private bool _done;
public HousePanelUpgradeMaterialModel(ProductDefinition product, int needed)
{
Product = product;
Needed = needed;
}
public HousePanelUpgradeMaterialModel(IProductAmount productAmount) : this(productAmount.Product, productAmount.Amount)
{
}
public ProductDefinition Product { get; }
[CreateProperty] public Sprite Icon => Product.Icon;
[CreateProperty]
public int Remaining
{
get => _remaining;
set => SetProperty(ref _remaining, value);
}
[CreateProperty] public int Needed { get; }
[CreateProperty]
public bool Done
{
get => _done;
set => SetProperty(ref _done, value);
}
}
}