重构:统一 UI 模块目录结构规范
- 事件命名规范化:RefreshEventArgs → LevelUpRefreshEventArgs - LevelUp 子组件目录调整:LevelUpRewardItem + LevelUpRewardItemContext 移动到 LevelUp/ - Shop 子组件目录调整:DisplayItem/DisplayListArea/GoodsItem/ShopGoodsItem 及其 Context/RawData 全部移动到 Shop/ - 删除冗余文件:LevelUpRewardItemRawData(从未被使用) - 新增 ObjectPool 目录结构 - 更新 LevelUpController 和 LevelUpForm 中的事件引用
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace SepCore.UI
|
||||
{
|
||||
public class ShopGoodsItem : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private IconArea _iconArea;
|
||||
|
||||
[SerializeField] private TMP_Text _titleText;
|
||||
|
||||
[SerializeField] private TMP_Text _typeText;
|
||||
|
||||
[SerializeField] private TMP_Text _descriptionText;
|
||||
|
||||
[SerializeField] private TMP_Text _costText;
|
||||
|
||||
#region Init
|
||||
|
||||
public void Init(GoodsItemContext data)
|
||||
{
|
||||
_iconArea.OnInit(data.Icon, data.Rarity);
|
||||
_titleText.text = data.Title;
|
||||
_typeText.text = data.ItemType switch
|
||||
{
|
||||
ItemType.None => "error",
|
||||
ItemType.Weapon => "武器",
|
||||
ItemType.Prop => "道具",
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
};
|
||||
_descriptionText.text = data.Description;
|
||||
_costText.text = $"{data.Price} <sprite name=\"coin\" index=0>";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user