using UnityEngine;
|
using UnityEngine.UI;
|
using TableConfig;
|
using System.Collections.Generic;
|
|
namespace Snxxz.UI
|
{
|
public class XBItemCell : MonoBehaviour
|
{
|
[SerializeField] CommonItemBaisc itemCell;
|
[SerializeField] GameObject selectIcon;
|
[SerializeField] Text nameText;
|
|
ItemTipsModel itemTips { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
|
int xbIndex = 0;
|
|
public void SetModel(int itemId,int count,int index)
|
{
|
this.xbIndex = index;
|
ItemCellModel cellModel = new ItemCellModel(itemId,true,(ulong)count);
|
itemCell.Init(cellModel);
|
ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(itemId);
|
if(itemConfig != null)
|
{
|
nameText.text = itemConfig.ItemName;
|
nameText.color = UIHelper.GetUIColor(itemConfig.ItemColor,false);
|
}
|
itemCell.cellBtn.RemoveAllListeners();
|
itemCell.cellBtn.AddListener(()=>
|
{
|
ItemAttrData attrData = new ItemAttrData(itemId,true,(ulong)count);
|
itemTips.SetItemTipsModel(attrData);
|
});
|
selectIcon.SetActive(false);
|
}
|
|
public void RefreshSelectIcon(int curSelect)
|
{
|
if(curSelect == xbIndex)
|
{
|
selectIcon.SetActive(true);
|
}
|
else
|
{
|
selectIcon.SetActive(false);
|
}
|
}
|
}
|
}
|