using Cysharp.Threading.Tasks; using SepCore.CustomUtility; using SepCore.Definition; using SepCore.Entity; using UnityEngine; namespace SepCore.UI { public class GoodsItemContext : UIContext { public string Name; public Rarity Rarity; public Sprite Icon; public ItemType ItemType; public string Description; public int Price; public GoodsItemContext() { Name = string.Empty; Description = string.Empty; Rarity = Rarity.White; Price = 0; Icon = null; ItemType = ItemType.Weapon; } public GoodsItemContext(GoodsItemRawData rawData) : this() { Price = rawData.Price; Rarity = rawData.Rarity; ItemType = rawData.ItemType; if (ItemType == ItemType.Weapon) { if (rawData.DataRow is WeaponConfig weaponConfig) { Name = weaponConfig.WeaponType.ToString(); Description = ItemDescUtility.CreateWeaponDescription(weaponConfig); } else if (rawData.DataRow is WeaponData weaponData) { Name = weaponData.Title; Description = ItemDescUtility.CreateWeaponDescription(weaponData); } } else { var prop = (PropConfig)rawData.DataRow; Name = prop.Name; Description = ItemDescUtility.CreatePropDescription(prop.Modifiers); } } } }