少年修仙传客户端代码仓库
client_Wu Xijin
2019-06-13 033958214c0b16d7e7b93cc821b018c295251867
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
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Snxxz.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 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 = 1,//查看装备
            AddFriend = 2,//加为好友
            DeleteFriend = 3,//删除好友
            AddBlack = 4,//加入黑名单
            AddTeam = 5,//加入队伍
            FairyLv = 6,//更改仙盟职权
            KickFairy = 7,//提出仙盟
            ApplyTeam = 8, //申请入队
            InviteTeam = 9, //邀请入队
            RemoveBlack = 10, //移出黑名单
            LookFight = 11,//查看战力
            InviteFairy = 12,//邀请入盟
        }
 
        public enum OpenType
        {
            Default,
            Fairy,
            Friend,
            CrossPlayer,
        }
 
        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
    }
}