using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
using System;
|
|
|
namespace vnxbqy.UI
|
{
|
public class RunePreviewCell : CellView
|
{
|
[SerializeField] List<RunePreviewData> m_RunePreviewList;
|
|
public void Display(int _index, int _id)
|
{
|
m_RunePreviewList[_index].SetActive(_id != 0);
|
if (_id != 0)
|
{
|
m_RunePreviewList[_index].Display(_id);
|
}
|
}
|
|
[Serializable]
|
public class RunePreviewData
|
{
|
[SerializeField] Image m_RuneIcon;
|
[SerializeField] Text m_RuneName;
|
[SerializeField] Button m_RuneBtn;
|
[SerializeField] RectTransform m_Rune;
|
|
RuneModel model { get { return ModelCenter.Instance.GetModel<RuneModel>(); } }
|
|
public void Display(int _id)
|
{
|
ItemConfig _itemCfg = ItemConfig.Get(_id);
|
m_RuneBtn.onClick.RemoveAllListeners();
|
if (_itemCfg != null)
|
{
|
m_RuneName.text = UIHelper.AppendColor(_itemCfg.ItemColor, _itemCfg.ItemName + "lv.1");
|
m_RuneIcon.SetSprite(_itemCfg.IconKey);
|
m_RuneBtn.onClick.AddListener(()=>
|
{
|
ShowRunePath(_itemCfg);
|
});
|
}
|
}
|
|
public void SetActive(bool _active)
|
{
|
m_Rune.SetActive(_active);
|
}
|
|
private void ShowRunePath(ItemConfig itemCfg)
|
{
|
ItemTipUtility.Show(itemCfg.ID);
|
}
|
}
|
}
|
}
|
|