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