using UnityEngine; using UnityEngine.UI; using TableConfig; using System; namespace Snxxz.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; ComposeWinModel composeModel { get { return ModelCenter.Instance.GetModel(); } } 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 = StringUtility.Contact(itemCompound.levelNeed,"级"); 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); } } }