//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Friday, March 15, 2019
|
//--------------------------------------------------------
|
using UnityEngine;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine.UI;
|
|
namespace Snxxz.UI
|
{
|
|
public class EquipGetWayWidget : MonoBehaviour
|
{
|
[SerializeField] WayCell[] m_GetWayCells;
|
[SerializeField] Button m_Close;
|
|
EquipModel model { get { return ModelCenter.Instance.GetModel<EquipModel>(); } }
|
|
public void DisplayGetWays(List<int> getWays)
|
{
|
if (getWays == null)
|
{
|
return;
|
}
|
|
for (var i = 0; i < m_GetWayCells.Length; i++)
|
{
|
var behaviour = m_GetWayCells[i];
|
if (i < getWays.Count)
|
{
|
behaviour.gameObject.SetActive(true);
|
var config = GetItemWaysConfig.Get(getWays[i]);
|
behaviour.icon.SetSprite(config.Icon);
|
behaviour.wayName.text = config.Text;
|
behaviour.funcName.text = config.name;
|
behaviour.wayButton.SetListener(() =>
|
{
|
WindowCenter.Instance.Close<EquipFrameWin>();
|
ModelCenter.Instance.GetModel<GetItemPathModel>().ClickGetWay(config.ID);
|
});
|
}
|
else
|
{
|
behaviour.gameObject.SetActive(false);
|
}
|
}
|
|
m_Close.SetListener(() => { model.ClearGetWays(); });
|
}
|
|
}
|
|
}
|