using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
namespace Snxxz.UI
|
{
|
public class AlchemyRecipeCell : CellView
|
{
|
[SerializeField] Text m_AlchemyName;
|
[SerializeField] Text m_UnGrasp;
|
[SerializeField] Transform m_ContainerSelect;
|
[SerializeField] Button m_Func;
|
[SerializeField] RedpointBehaviour m_Redpoint;
|
|
int id = 0;
|
|
AlchemyModel model { get { return ModelCenter.Instance.GetModel<AlchemyModel>(); } }
|
|
private void Awake()
|
{
|
m_Func.SetListener(OnSelect);
|
}
|
|
public void Display(int id)
|
{
|
this.id = id;
|
|
var config = AlchemyConfig.Get(id);
|
|
m_AlchemyName.text = config.AlchemName;
|
|
m_UnGrasp.gameObject.SetActive(!model.IsGraspRecipe(id));
|
|
m_ContainerSelect.gameObject.SetActive(model.selectAlchemy == id);
|
|
m_Redpoint.redpointId = model.GetAlchemyRedpointId(id);
|
}
|
|
private void OnSelect()
|
{
|
int alchemyId;
|
if (model.IsStoveAlcheming(model.selectAlchemyType, out alchemyId))
|
{
|
if (alchemyId != id)
|
{
|
if (model.GetStoveState(alchemyId) == 2)
|
{
|
SysNotifyMgr.Instance.ShowTip("AlchemingSwitchError_1");
|
}
|
else
|
{
|
SysNotifyMgr.Instance.ShowTip("AlchemingSwitchError");
|
}
|
return;
|
}
|
}
|
model.selectAlchemy = id;
|
}
|
}
|
}
|