少年修仙传客户端代码仓库
hch
2025-03-19 6770e1eb64c4282def45adb824b14b2a407fdd30
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using UnityEngine;
using UnityEngine.UI;
namespace vnxbqy.UI
{
    public class DungeonRankBehaviour : MonoBehaviour
    {
        [SerializeField] List<Text> playerNameTexts;
        [SerializeField] List<Text> valueTexts;
        [SerializeField] Text mineRankText;
        [SerializeField] Text mineNameText;
        [SerializeField] Text mineValueText;
 
        int currentDugeonId = 0;
 
        private object RegexPlayerDatas;
 
        DungeonModel model { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } }
        JadeDynastyBossModel jadeDynastyBossModel { get { return ModelCenter.Instance.GetModel<JadeDynastyBossModel>(); } }
 
        public void Init(int mapID)
        {
            currentDugeonId = mapID;
            SetMineInfo(0, 0);
            SetDefault();
            UpdateMissionEvent();
        }
 
        private void OnEnable()
        {
            model.updateMissionEvent += UpdateMissionEvent;
        }
 
        private void UpdateMissionEvent()
        {
            if (currentDugeonId == 0)
            {
                return;
            }
            switch (currentDugeonId)
            {
                case 31170:
                case DemonJarModel.DATA_MAPID:
                case JadeDynastyBossModel.JADEDYNASTY_MAP:
                    {
                        int i = 0;
                        if (model.mission.hurtInfo != null && model.mission.hurtInfo.Length > 0)
                        {
                            for (i = 0; i < model.mission.hurtInfo.Length; i++)
                            {
                                var rank = model.mission.hurtInfo[i].rank;
                                if (rank - 1 < playerNameTexts.Count)
                                {
                                    playerNameTexts[rank - 1].text = model.mission.hurtInfo[i].playerName;
                                    valueTexts[rank - 1].text = UIHelper.ReplaceLargeNum(model.mission.hurtInfo[i].totalHurt);
                                    if (Regex.IsMatch(UIHelper.ServerStringTrim(model.mission.hurtInfo[i].playerName), UIHelper.ServerStringTrim(PlayerDatas.Instance.baseData.PlayerName)))
                                    {
                                        SetMineInfo(rank, model.mission.hurtInfo[i].totalHurt);
                                    }
                                }
                                else
                                {
                                    SetMineInfo(rank, model.mission.hurtInfo[i].totalHurt);
                                }
                            }
                        }
                        while (i < playerNameTexts.Count)
                        {
                            playerNameTexts[i].text = string.Empty;
                            valueTexts[i].text = string.Empty;
                            i++;
                        }
                    }
                    break;
            }
 
            if (currentDugeonId == JadeDynastyBossModel.JADEDYNASTY_MAP)
            {
                DisplayAssistHurt();
            }
        }
 
        private void SetMineInfo(int rank, long hurt)
        {
            switch (currentDugeonId)
            {
                case JadeDynastyBossModel.JADEDYNASTY_MAP:
                    mineValueText.text = UIHelper.ReplaceLargeNum((ulong)hurt);
                    break;
                default:
                    if (mineRankText != null)
                    {
                        mineRankText.text = rank == 0 ? Language.Get("FamilyMatchUnBeOnList") : StringUtility.Contact(rank, ":");
                    }
                    if (mineNameText != null)
                    {
                        mineNameText.text = PlayerDatas.Instance.baseData.PlayerName;
                    }
                    mineValueText.text = UIHelper.ReplaceLargeNum((ulong)hurt);
                    break;
            }
        }
 
        private void DisplayAssistHurt()
        {
            mineRankText.text = Language.Get("DemonJar16");
        }
 
        private void SetDefault()
        {
            for (int i = 0; i < playerNameTexts.Count; i++)
            {
                playerNameTexts[i].text = string.Empty;
            }
            for (int i = 0; i < valueTexts.Count; i++)
            {
                valueTexts[i].text = string.Empty;
            }
        }
 
        private void OnDisable()
        {
            model.updateMissionEvent -= UpdateMissionEvent;
        }
    }
}