少年修仙传客户端代码仓库
hch
2024-12-16 9377811d0ba27047e1e5ec2348a28eba1033d59d
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
64
65
66
67
68
69
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Tuesday, April 16, 2019
//--------------------------------------------------------
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Collections.Generic;
 
namespace vnxbqy.UI
{
 
    public class TipPetMountSkillWidget : MonoBehaviour
    {
        [SerializeField] ScrollerController m_Scroll;
 
        public void Display(PetMountTipWin.ShowType showType, int itemId)
        {
            var skillInfos = new List<SkillInfo>();
 
            switch (showType)
            {
                case PetMountTipWin.ShowType.Pet:
                    var petId = PetInfoConfig.GetItemUnLockPet(itemId);
                    var petConfig = PetInfoConfig.Get(petId);
 
                    var min = Mathf.Min(petConfig.SkillID.Length, petConfig.SkillUnLock.Length);
                    for (var i = 0; i < min; i++)
                    {
                        var skillId = petConfig.SkillID[i];
                        var unlockLevel = petConfig.SkillUnLock[i];
                        skillInfos.Add(new SkillInfo() { skillId = skillId, unlockLevel = unlockLevel });
                    }
                    break;
                case PetMountTipWin.ShowType.Mount:
                    break;
            }
            m_Scroll.OnRefreshCell -= OnRefreshCell;
            m_Scroll.OnRefreshCell += OnRefreshCell;
 
            //m_Scroll.Init(skillInfos);
            m_Scroll.Refresh();
            foreach (var skillinfo in skillInfos)
            {
                CellInfo info = new CellInfo();
                info.infoInt1 = skillinfo.unlockLevel;
                m_Scroll.AddCell(ScrollerDataType.Header, skillinfo.skillId, info);
            }
            m_Scroll.Restart();
        }
 
        void OnRefreshCell(ScrollerDataType type, CellView cell)
        {
            var _cell = cell as TipPetMountSkillBehaviour;
            _cell.Display(cell.index, cell.info.Value.infoInt1);
        }
 
        public struct SkillInfo
        {
            public int skillId;
            public int unlockLevel;
        }
 
    }
 
}