using CustomUtility; using SepCore.DataTable; using SepCore.Definition; using UnityEngine; namespace SepCore.UI { public class GoodsItemContext : UIContext { public string Title; public ItemRarity Rarity; public Sprite Icon; public ItemType ItemType; public string Description; public int Price; public GoodsItemContext() { Title = string.Empty; Description = string.Empty; Rarity = ItemRarity.White; Price = 0; Icon = null; ItemType = ItemType.None; } public GoodsItemContext(GoodsItemRawData rawData) { Price = rawData.Price; Rarity = rawData.Rarity; ItemType = rawData.ItemType; if (ItemType == ItemType.None) { Description = string.Empty; Icon = null; Title = string.Empty; } else if (ItemType == ItemType.Weapon) { var weapon = (DRWeapon)rawData.DataRow; Title = weapon.Title; Description = ItemDescUtility.CreateWeaponDescription(weapon); GameEntry.SpriteCache.GetSprite(weapon.IconAssetName, sprite => Icon = sprite); } else { var prop = (DRProp)rawData.DataRow; Title = prop.Title; Description = ItemDescUtility.CreatePropDescription(prop.Modifiers); GameEntry.SpriteCache.GetSprite(prop.IconAssetName, sprite => Icon = sprite); } } } }