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 onClickFuncEvent; public static event Action updateDetailTypeEvent; public static void ShowPlayerDetails(int _playerId, Action _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()) { WindowCenter.Instance.Open(); } } 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()) { WindowCenter.Instance.Open(); } } 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()) { WindowCenter.Instance.Open(); } 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 } }