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 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 ShowPlayerDetailsEx(int _playerId, string playerName, int lv, int job, int realmLV, int onlineTYype, Action _func, OpenType _type = OpenType.Default) { openType = _type; onClickFuncEvent = _func; PlayerID = _playerId; LV = lv; Job = job; OnlineType = onlineTYype; RealmLV = realmLV; PlayerName = playerName; IsInTeam = ModelCenter.Instance.GetModel().myTeam.GetIndexOfMember(PlayerID) != -1 ? 1 : 0; RectTransformUtility.ScreenPointToLocalPointInRectangle(WindowCenter.Instance.uiRoot.tipsCanvas, Input.mousePosition, WindowCenter.Instance.uiRoot.uicamera, out targetPos); if (!WindowCenter.Instance.IsOpen()) { WindowCenter.Instance.Open(); } } 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 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()) { 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; face = (int)_package.Face; 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,//查看装备 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 public static int face; } }