少年修仙传客户端代码仓库
hch
2025-03-03 28785d6ddf9c08e49527ede9405c7b6c93c6ed32
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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);
        }
    }
}