Files
vampire-like/Assets/GameMain/Scripts/Presentation/Main/Shop/GoodsItemContext.cs
T
basil 5c3b87ab3f 重构:统一 UI 模块目录结构规范
- 事件命名规范化:RefreshEventArgs → LevelUpRefreshEventArgs
- LevelUp 子组件目录调整:LevelUpRewardItem + LevelUpRewardItemContext 移动到 LevelUp/
- Shop 子组件目录调整:DisplayItem/DisplayListArea/GoodsItem/ShopGoodsItem 及其 Context/RawData 全部移动到 Shop/
- 删除冗余文件:LevelUpRewardItemRawData(从未被使用)
- 新增 ObjectPool 目录结构
- 更新 LevelUpController 和 LevelUpForm 中的事件引用
2026-06-17 09:50:47 +08:00

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);
}
}
}
}