using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
namespace Snxxz.UI
|
{
|
public class TreasureSoulPattern3 : TreasureSoulPattern
|
{
|
[SerializeField] RareItem[] m_Items;
|
[SerializeField] Button m_Get;
|
[SerializeField] Text m_GetText;
|
|
private void Awake()
|
{
|
m_Get.onClick.AddListener(OnGet);
|
}
|
|
public override void Display(int _id)
|
{
|
base.Display(_id);
|
Display();
|
}
|
|
public override void Dispose()
|
{
|
base.Dispose();
|
}
|
|
protected override void TreasurePrivilegeUpdateEvent(int _id)
|
{
|
base.TreasurePrivilegeUpdateEvent(_id);
|
if (_id == (int)special.type)
|
{
|
Display();
|
}
|
}
|
|
private void Display()
|
{
|
for (int i = 0; i < m_Items.Length; i++)
|
{
|
m_Items[i].gameObject.SetActive(special.items != null && i < special.items.Count);
|
m_Items[i].cellBtn.RemoveAllListeners();
|
if (special.items != null && i < special.items.Count)
|
{
|
var award = special.items[i];
|
ItemCellModel cellModel = new ItemCellModel(award.item.id, true, (ulong)award.item.count, award.isBind);
|
m_Items[i].Init(cellModel);
|
m_Items[i].cellBtn.AddListener(() =>
|
{
|
ItemAttrData attrData = new ItemAttrData(award.item.id, true, (ulong)award.item.count, -1, award.isBind);
|
ModelCenter.Instance.GetModel<ItemTipsModel>().SetItemTipsModel(attrData);
|
});
|
}
|
}
|
m_Get.SetInteractable(m_GetText, special.state == TreasurePrivilegeState.Reward);
|
}
|
|
private void OnGet()
|
{
|
special.GetReward();
|
}
|
}
|
}
|
|