using vnxbqy.UI;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
public class ShentongLabCell : ILBehaviour
|
{
|
Image chooseImg;
|
Image lockImg;
|
RedpointBehaviour redpoint;
|
Text stName;
|
Button outBtn;
|
Text stateText;
|
Transform skillOutStateObj;
|
Text skillnum;
|
Button selectBtn;
|
|
protected override void Awake()
|
{
|
chooseImg = proxy.GetWidgtEx<Image>("ChooseImage");
|
lockImg = proxy.GetWidgtEx<Image>("lockImage");
|
redpoint = proxy.GetWidgtEx<RedpointBehaviour>("RedPoint");
|
stName = proxy.GetWidgtEx<Text>("name");
|
outBtn = proxy.GetWidgtEx<Button>("outButton");
|
stateText = proxy.GetWidgtEx<Text>("stateText");
|
skillOutStateObj = proxy.GetWidgtEx<Transform>("skillOut");
|
skillnum = proxy.GetWidgtEx<Text>("skillnum");
|
selectBtn = proxy.GetWidgtEx<Button>("ShentongLabCell");
|
}
|
|
public void Display(int id)
|
{
|
if (id == ShentongModel.Instance.selectShentong)
|
{
|
chooseImg.SetActiveIL(true);
|
}
|
else
|
{
|
chooseImg.SetActiveIL(false);
|
}
|
|
lockImg.SetActiveIL(!ShentongModel.Instance.IsGubaoActive(id));
|
redpoint.redpointId = ShentongModel.Instance.shentongPoint * 1000 + id;
|
|
var config = ILShentongConfig.Get(id);
|
var classLV = ShentongModel.Instance.shentongDict.ContainsKey(id) ? ShentongModel.Instance.shentongDict[id].ClassLV : 0;
|
stName.text = config.Name + (classLV == 0 ? string.Empty : " " + Language.Get("L1091", classLV));
|
stateText.text = Language.Get(ShentongModel.Instance.shentongIDSortBySkillID.Contains(id) ? "KnapS106" : "Shentong5");
|
outBtn.SetActiveIL(ShentongModel.Instance.shentongIDToSkillID.ContainsKey(id));
|
outBtn.SetListener(()=> {
|
var index = ShentongModel.Instance.shentongIDSortBySkillID.IndexOf(id);
|
if (index == -1)
|
{
|
//选择放置
|
ShentongModel.Instance.selectShentong = id;
|
ShentongModel.Instance.selectShentongSkillID = ShentongModel.Instance.shentongIDToSkillID[id];
|
}
|
else
|
{
|
//卸下
|
ShentongModel.Instance.shentongIDSortBySkillID[index] = 0;
|
ShentongModel.Instance.shentongSetSkillIDs[index] = 0;
|
|
ShentongModel.Instance.SetShentongSkill();
|
}
|
});
|
skillOutStateObj.SetActiveIL(ShentongModel.Instance.shentongIDSortBySkillID.Contains(id));
|
skillnum.text = (ShentongModel.Instance.shentongIDSortBySkillID.IndexOf(id) + 1).ToString();
|
|
selectBtn.SetListener(()=> {
|
ShentongModel.Instance.selectShentong = id;
|
});
|
}
|
|
}
|