using UnityEngine;
|
using UnityEngine.UI;
|
|
using System;
|
|
namespace vnxbqy.UI
|
{
|
public class ComposeSecondTypeCell : MonoBehaviour
|
{
|
[SerializeField] Image btnImg;
|
[SerializeField] GameObject unlockObj;
|
[SerializeField] Text unlockTypeName;
|
[SerializeField] GameObject lockObj;
|
[SerializeField] Text lockTypeName;
|
[SerializeField] Text lockLevel;
|
[SerializeField] Button typeBtn;
|
[SerializeField] RedpointBehaviour redpoint;
|
|
ComposeWinModel composeModel { get { return ModelCenter.Instance.GetModel<ComposeWinModel>(); } }
|
|
int thirdType = 0;
|
public void SetDisplay(int firstType,int secondType,int thirdType,int selectThirdType)
|
{
|
this.thirdType = thirdType;
|
ComposeWinModel.ComposeThirdTypeData thirdTypeData = null;
|
bool isThird = composeModel.TryGetThirdTypeData(firstType,secondType,thirdType,out thirdTypeData);
|
if (!isThird) return;
|
|
var itemCompound = thirdTypeData.itemCompound;
|
bool isTrailer = composeModel.IsTrailerByLevel(itemCompound);
|
lockObj.SetActive(isTrailer);
|
unlockObj.SetActive(!isTrailer);
|
unlockTypeName.text = itemCompound.thirdTypeName;
|
lockTypeName.text = itemCompound.thirdTypeName;
|
lockLevel.text = Language.Get("LoadIconLV", itemCompound.levelNeed);
|
string key = ((firstType * 100 + secondType) * 100 + thirdType).ToString();
|
if (firstType == (int)ComposeFuncType.Item
|
&& composeModel.thirdTypeRedDict.ContainsKey(key))
|
{
|
redpoint.SetActive(true);
|
redpoint.redpointId = composeModel.thirdTypeRedDict[key].id;
|
}
|
else
|
{
|
redpoint.SetActive(false);
|
}
|
UpdateBtnImg(selectThirdType);
|
typeBtn.RemoveAllListeners();
|
typeBtn.AddListener(ClickTypeBtn);
|
}
|
|
public void UpdateBtnImg(int selectThirdType)
|
{
|
string iconKey = thirdType == selectThirdType ? "ChildListBtn_Select" : "ChildListBtn_UnSelect";
|
btnImg.SetSprite(iconKey);
|
}
|
|
private void ClickTypeBtn()
|
{
|
composeModel.UpdateThirdType(thirdType);
|
}
|
}
|
}
|