using System;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
namespace vnxbqy.UI
|
{
|
public class ChooseCell : CommonItemBaisc
|
{
|
[SerializeField] GameObject chooseImage;
|
[SerializeField] Text nameText;
|
private void Awake()
|
{
|
ChooseItemWin.RefreshChooseCellAct += RefreshChooseImage;
|
|
}
|
|
public void InitModel(ItemCellModel model)
|
{
|
base.Init(model);
|
var config = ItemConfig.Get( itemId);
|
nameText.text = config.ItemName;
|
SetIsChoose(false);
|
}
|
|
private void RefreshChooseImage(int id)
|
{
|
if (id == this.itemId)
|
{
|
SetIsChoose(true);
|
}
|
else
|
{
|
SetIsChoose(false);
|
}
|
}
|
|
private void SetIsChoose(bool isChoose)
|
{
|
if(isChoose)
|
{
|
chooseImage.SetActive(true);
|
}
|
else
|
{
|
chooseImage.SetActive(false);
|
}
|
}
|
|
private void OnDestroy()
|
{
|
ChooseItemWin.RefreshChooseCellAct -= RefreshChooseImage;
|
|
}
|
}
|
}
|