少年修仙传客户端代码仓库
hch
2025-06-12 204ef05a831c9484e2abc561d27ecbff7c797453
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
70
71
72
73
74
75
76
77
78
using UnityEngine;
namespace vnxbqy.UI
{
    public class ChatBubbleCell : CellView
    {
        [SerializeField] ChatBubbleSelectBehaviour[] m_ChatBubbles;
        [SerializeField] int m_LineCount = 7;
 
        public int lineCount { get { return m_LineCount; } }
 
        ChatBubbleModel model
        {
            get { return ModelCenter.Instance.GetModel<ChatBubbleModel>(); }
        }
        PhantasmPavilionModel phantasmPavilionModel {get { return ModelCenter.Instance.GetModel<PhantasmPavilionModel>(); }}
        public void Display(int line)
        {
            var keys = ChatBubbleBoxConfig.GetKeys();
            keys.Sort(Cmp);
            for (int i = 0; i < lineCount; i++)
            {
                var index = line * 7 + i;
                if (index < keys.Count)
                {
                    int id = int.Parse(keys[index]);
                    if (!ChatBubbleBoxConfig.Has(id))
                        continue;
                    m_ChatBubbles[i].SetActive(true);
                    m_ChatBubbles[i].Display(id);
                }
                else
                {
                    m_ChatBubbles[i].SetActive(false);
                }
            }
        }
 
        public int Cmp(string numA, string numB)
        {
            int a = int.Parse(numA);
            int b = int.Parse(numB);
 
            PhantasmPavilionTab tab = PhantasmPavilionTab.ChatBubble;
            // 获取 a 和 b 的解锁状态
            int stateA = phantasmPavilionModel.GetUnLockState(tab, a);
            int stateB = phantasmPavilionModel.GetUnLockState(tab, b);
 
            //0 - 未激活 1 - 可激活 2 - 已激活
            int priorityA = stateA;
            int priorityB = stateB;
 
            if (priorityA != priorityB)
            {
                return priorityB.CompareTo(priorityA);
            }
 
            // 如果激活状态相同,比较 SortNum
            int sortNumA = phantasmPavilionModel.GetSortNum(tab, a);
            int sortNumB = phantasmPavilionModel.GetSortNum(tab, b);
 
            if (sortNumA != sortNumB)
            {
                if (tab == PhantasmPavilionTab.Avatar)
                {
                    return sortNumB.CompareTo(sortNumA);
                }
                else
                {
                    return sortNumA.CompareTo(sortNumB);
                }
            }
 
            return a.CompareTo(b);
        }
 
    }
}