少年修仙传客户端代码仓库
lcy
2024-12-16 a39c35fc6449430cd02bccb681c4a0a880e46cd9
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace vnxbqy.UI
{
    public class PlayerDetails
    {
        public static Vector2 targetPos;
        public static OpenType openType { get; private set; }
        public static event Action<DetailType> onClickFuncEvent;
        public static event Action<DetailType> updateDetailTypeEvent;
        public static void ShowPlayerDetails(int _playerId, Action<DetailType> _func, OpenType _type = OpenType.Default)
        {
            openType = _type;
            onClickFuncEvent = _func;
            DTCB309_tagGCAnswerPlayerShortInfo.OnPlayerShortInfoEvent -= OnPlayerShortInfoEvent;
            DTCB309_tagGCAnswerPlayerShortInfo.OnPlayerShortInfoEvent += OnPlayerShortInfoEvent;
            CB306_tagCGViewPlayerShortInfo _pak = new CB306_tagCGViewPlayerShortInfo();
            _pak.PlayerID = (uint)_playerId;
            GameNetSystem.Instance.SendInfo(_pak);
            RectTransformUtility.ScreenPointToLocalPointInRectangle(WindowCenter.Instance.uiRoot.tipsCanvas, Input.mousePosition, WindowCenter.Instance.uiRoot.uicamera, out targetPos);
        }
 
        public static void ShowCrossServerChatPlayer(ChatUeseData data)
        {
            openType = OpenType.CrossPlayer;
            PlayerID = (int)data.player;
            LV = data.level;
            Job = data.job;
            RealmLV = 0;
            PlayerName = data.name;
            OnlineType = 0;
            IsInTeam = 0;
            ServerGroupId = data.serverGroupId;
 
            RectTransformUtility.ScreenPointToLocalPointInRectangle(WindowCenter.Instance.uiRoot.tipsCanvas, Input.mousePosition, WindowCenter.Instance.uiRoot.uicamera, out targetPos);
 
            if (!WindowCenter.Instance.IsOpen<PlayerDetailWin>())
            {
                WindowCenter.Instance.Open<PlayerDetailWin>();
            }
        }
 
        public static void ShowCrossServerPlayer(int playerId, int level, string name, int serverGroupId)
        {
            openType = OpenType.CrossPlayer;
            PlayerID = playerId;
            LV = level;
            Job = 1;
            RealmLV = 0;
            PlayerName = name;
            OnlineType = 0;
            IsInTeam = 0;
            ServerGroupId = serverGroupId;
 
            RectTransformUtility.ScreenPointToLocalPointInRectangle(WindowCenter.Instance.uiRoot.tipsCanvas, Input.mousePosition, WindowCenter.Instance.uiRoot.uicamera, out targetPos);
 
            if (!WindowCenter.Instance.IsOpen<PlayerDetailWin>())
            {
                WindowCenter.Instance.Open<PlayerDetailWin>();
            }
        }
 
        public static void ShowBossHurtPlayer(int playerId, string name, int inTeam)
        {
            openType = OpenType.Assist;
            PlayerID = playerId;
            LV = 0;
            Job = 1;
            RealmLV = 0;
            PlayerName = name;
            OnlineType = 0;
            IsInTeam = inTeam;
            ServerGroupId = 0;
 
            RectTransformUtility.ScreenPointToLocalPointInRectangle(WindowCenter.Instance.uiRoot.tipsCanvas, Input.mousePosition, WindowCenter.Instance.uiRoot.uicamera, out targetPos);
 
            if (!WindowCenter.Instance.IsOpen<PlayerDetailWin>())
            {
                WindowCenter.Instance.Open<PlayerDetailWin>();
            }
        }
 
        public static void ShowAreaPlayer(int _playerId)
        {
            openType = OpenType.Default;
            onClickFuncEvent = null;
            DTCB309_tagGCAnswerPlayerShortInfo.OnPlayerShortInfoEvent -= OnPlayerShortInfoEvent;
            DTCB309_tagGCAnswerPlayerShortInfo.OnPlayerShortInfoEvent += OnPlayerShortInfoEvent;
            CB306_tagCGViewPlayerShortInfo _pak = new CB306_tagCGViewPlayerShortInfo();
            _pak.PlayerID = (uint)_playerId;
            if (CrossServerUtility.IsCrossServer())
            {
                GameNetSystem.Instance.SendToCrossServer(_pak);
            }
            else
            {
                GameNetSystem.Instance.SendInfo(_pak);
            }
            RectTransformUtility.ScreenPointToLocalPointInRectangle(WindowCenter.Instance.uiRoot.tipsCanvas, Input.mousePosition, WindowCenter.Instance.uiRoot.uicamera, out targetPos);
        }
 
        private static void OnPlayerShortInfoEvent(HB309_tagGCAnswerPlayerShortInfo _package)
        {
            PlayerID = (int)_package.PlayerID;
            LV = _package.LV;
            Job = _package.Job;
            OnlineType = _package.OnlineType;
            RealmLV = _package.RealmLV;
            PlayerName = _package.PlayerName;
            IsInTeam = _package.IsInTeam;
            ServerGroupId = (int)_package.ServerGroupID;
 
            if (!WindowCenter.Instance.IsOpen<PlayerDetailWin>())
            {
                WindowCenter.Instance.Open<PlayerDetailWin>();
            }
            DTCB309_tagGCAnswerPlayerShortInfo.OnPlayerShortInfoEvent -= OnPlayerShortInfoEvent;
        }
 
        public static void OnClickFunc(DetailType _type)
        {
            if (onClickFuncEvent != null)
            {
                onClickFuncEvent(_type);
            }
            if(updateDetailTypeEvent != null)
            {
                updateDetailTypeEvent(_type);
            }
        }
 
        public enum DetailType
        {
            PrivateChat = 0,//私聊
            ViewEquip,//查看装备
            AddFriend,//加为好友
            DeleteFriend,//删除好友
            AddBlack,//加入黑名单
            AddTeam,//加入队伍
            FairyLv,//更改仙盟职权
            KickFairy,//提出仙盟
            Kill, //击杀
            ApplyTeam, //申请入队
            InviteTeam, //邀请入队
            RemoveBlack, //移出黑名单
            LookFight,//查看战力
            InviteFairy,//邀请入盟
                        //后续IL开发添加预设
            default1, //赠送鲜花
            default2, //复制名字
            default3,
            default4,
            default5,
            default6,
            default7,
            default8,
            default9,
            default10,
        }
 
        public enum OpenType
        {
            Default,
            Fairy,
            Friend,
            CrossPlayer,
            Assist,
            //后续IL开发添加预设
            default1,
            default2,
            default3,
            default4,
            default5,
            default6,
            default7,
            default8,
            default9,
            default10,
        }
 
        public static int PlayerID = 0;
        public static string PlayerName = string.Empty;
        public static int Job = 1;
        public static int LV = 0;    //等级
        public static int RealmLV = 0;    //境界
        public static int OnlineType = 0;    //在线状态, 0 不在线 1在线
        public static int IsInTeam = 0;
        public static int ServerGroupId = 0;//玩家所在服务器id
    }
}