少年修仙传客户端代码仓库
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
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System;
 
namespace vnxbqy.UI
{
    public class CrossServerOneVsOnePKPlayerCell : MonoBehaviour
    {
        [SerializeField] RawImage playerRaw;
        [SerializeField] Text nameText;
        [SerializeField] Text fightPointTxt;
        [SerializeField] Text winScoreTxt;
        [SerializeField] Button challengeBtn;
 
        CrossServerOneVsOneModel crossServerModel { get { return ModelCenter.Instance.GetModel<CrossServerOneVsOneModel>(); } }
        RoleParticularModel model { get { return ModelCenter.Instance.GetModel<RoleParticularModel>(); } }
        ServerMirrorFightModel mirrorFightModel { get { return ModelCenter.Instance.GetModel<ServerMirrorFightModel>(); } }
 
        DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } }
 
        public void Display(int index)
        {
            if (index >= crossServerModel.matchPlayers.Count)
                return;
 
            var matchPlayer = crossServerModel.matchPlayers[index];
            ShowRawPlayer((int)matchPlayer.PlayerID, index);
            nameText.text = matchPlayer.PlayerName;
            fightPointTxt.text = UIHelper.ReplaceLargeArtNum(matchPlayer.FightPowerEx * Constants.ExpPointValue + matchPlayer.FightPower);
            winScoreTxt.text = Language.Get("CrossServerOneVsOne2") + crossServerModel.winConstScoreArr[index].ToString();
 
            challengeBtn.AddListener(() =>
            {
                int remainNum = CrossServerOneVsOnePlayerInfo.Instance.GetDayRemainNum();
                if (remainNum <= 0)
                {
                    SysNotifyMgr.Instance.ShowTip("TryEnterJadeDynastyBossError_4");
                    return;
                }
 
                int error;
                if (!dungeonModel.CanEnter(out error))
                {
                    dungeonModel.ProcessEnterError(error);
                    return;
                }
 
 
                if (matchPlayer.PlayerID > 10000)
                {
                    var teamModel = ModelCenter.Instance.GetModel<TeamModel>();
                    if (teamModel.isMatching)
                    {
                        teamModel.RequestCancelAutoMatchTeam();
                    }
 
                    CrossServerLogin.Instance.InitOneVsOnePlayerInfo(matchPlayer);
                    mirrorFightModel.SendMirrorFight(CrossServerOneVsOneModel.CrossServerDataMapId, 0, matchPlayer.PlayerID, 0);
                }
                else
                {
                    CrossServerLogin.Instance.InitOneVsOneClientPlayerInfo(matchPlayer);
                    ClientCrossServerOneVsOne.JiaMatchOk(matchPlayer);
                }
            });
        }
 
        
 
 
        void ShowRawPlayer(int playerID, int index)
        {
            if (playerID < 10000)
            {
                ShowRobot(playerID, index);
                return;
            }
            var viewPlayerData = model.GetViewPlayerData(playerID);
            if (viewPlayerData == null)
            {
                return;
            }
 
            int _suitLevel = (int)(viewPlayerData.rolePropData.EquipShowSwitch % 10);
            int clothes = viewPlayerData.GetItemId(RoleEquipType.Clothes);
            int weapon = viewPlayerData.GetItemId(RoleEquipType.Weapon);
            int wing = viewPlayerData.GetItemId(RoleEquipType.Wing);
            int weapon2 = viewPlayerData.GetItemId(RoleEquipType.Weapon2);
            int fashionClothes = viewPlayerData.GetItemId(RoleEquipType.FashionClothes);
            int fashionWeapon = viewPlayerData.GetItemId(RoleEquipType.FashionWeapon);
            int fashionWeapon2 = viewPlayerData.GetItemId(RoleEquipType.FashionWeapon2);
            var reikiRootEffectId = viewPlayerData.rolePropData.EquipShowSwitch / 1000 % 1000;
 
 
            var data = new UI3DPlayerExhibitionData
            {
                job = viewPlayerData.rolePropData.Job,
                fashionClothesId = fashionClothes,
                fashionWeaponId = fashionWeapon,
                fashionSecondaryId = fashionWeapon2,
                clothesId = clothes,
                suitLevel = _suitLevel,
                weaponId = weapon,
                wingsId = wing,
                secondaryId = weapon2,
                reikiRootEffectId = (int)reikiRootEffectId,
                isDialogue = false,
                equipLevel = (int)viewPlayerData.rolePropData.EquipShowSwitch / 10 % 100,
                titleID = viewPlayerData.rolePropData.TitleID,
            };
 
            if (index == 0)
                UI3DModelExhibition.InstanceClone1.ShowPlayer(playerRaw, data);
            else if (index == 1)
                UI3DModelExhibition.InstanceClone2.ShowPlayer(playerRaw, data);
            else if (index == 2)
                UI3DModelExhibition.InstanceClone3.ShowPlayer(playerRaw, data);
 
            playerRaw.raycastTarget = false;
        }
 
        void ShowRobot(int playerID, int index)
        {
            var robot = crossServerModel.robots[playerID];
 
            int clothesID = 0;
            int weaponID1 = 0;
            int weaponID2 = 0;
            // 因为衣服是所有装备的父节点, 需要预先处理衣服
            for (int i = 0; i < robot.itemDatas.Length; ++i)
            {
                var _itemInfo = robot.itemDatas[i];
 
                if (_itemInfo.place == (int)RoleEquipType.Clothes)
                {
                    clothesID = (int)_itemInfo.id;
                }
                if (_itemInfo.place == (int)RoleEquipType.Weapon)
                {
                    weaponID1 = (int)_itemInfo.id;
                }
                else if (_itemInfo.place == (int)RoleEquipType.Weapon2)
                {
                    weaponID2 = (int)_itemInfo.id;
                }
            }
 
 
            var data = new UI3DPlayerExhibitionData
            {
                job = robot.job,
                clothesId = clothesID,
                weaponId = weaponID1,
                secondaryId = weaponID2,
            };
 
            if (index == 0)
                UI3DModelExhibition.InstanceClone1.ShowPlayer(playerRaw, data);
            else if (index == 1)
                UI3DModelExhibition.InstanceClone2.ShowPlayer(playerRaw, data);
            else if (index == 2)
                UI3DModelExhibition.InstanceClone3.ShowPlayer(playerRaw, data);
 
            playerRaw.raycastTarget = false;
        }
    }
}