vampire-like/Assets/GameMain/Scripts/Presentation/Main/Context/GoodsItemContext.cs

57 lines
1.5 KiB
C#

using Cysharp.Threading.Tasks;
using SepCore.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);
}
else
{
var prop = (DRProp)rawData.DataRow;
Title = prop.Title;
Description = ItemDescUtility.CreatePropDescription(prop.Modifiers);
}
}
}
}