| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using Snxxz.UI; |
| | | using TableConfig; |
| | | using System; |
| | | using System.Linq; |
| | | |
| | | public class FriendPlayer |
| | | { |
| | | public uint PlayerID; |
| | | |
| | | public string PlayerName; |
| | | |
| | | public byte Job; |
| | | |
| | | public ushort LV; //等级 |
| | | |
| | | public ushort RealmLV; //境界 |
| | | |
| | | public byte OnlineType; //0不在线 1在线 2脱机在线 |
| | | |
| | | public uint SortValue; ////最近联系人和仇人按时间排序 |
| | | |
| | | public bool IsApplay; //是否申请添加好友 |
| | | |
| | | } |
| | | |
| | | public enum GroupType |
| | | { |
| | | RecentContact = 1, |
| | | Friend, |
| | | Enemy, |
| | | Balcklist, |
| | | AddFriend, |
| | | None, |
| | | } |
| | | |
| | | public class FriendsModel : Model,IBeforePlayerDataInitialize,IAfterPlayerDataInitialize |
| | | { |
| | | TeamModel _teamModel; |
| | | public TeamModel TeamModel |
| | | { |
| | | get |
| | | { |
| | | return _teamModel ?? (_teamModel = ModelCenter.Instance.GetModel<TeamModel>()); |
| | | } |
| | | } |
| | | |
| | | RoleParticularModel _particularModel; |
| | | RoleParticularModel ParticularModel |
| | | { |
| | | get |
| | | { |
| | | return _particularModel ?? (_particularModel = ModelCenter.Instance.GetModel<RoleParticularModel>()); |
| | | } |
| | | } |
| | | |
| | | public event Action RefreshFriendModel;//刷新好友信息 |
| | | |
| | | public event Action<GroupType,bool> RefreshFriendCntEvent; //刷新好友数量信息 true 增加好友 false 减少 |
| | | |
| | | |
| | | public delegate void OnRefresRecommendFriend(); //刷新推荐列表 |
| | | public event OnRefresRecommendFriend RefreshRecommendFriendEvent; |
| | | |
| | | public delegate void OnRefreshQuest(); |
| | | public event OnRefreshQuest RefreshQuestEvent; |
| | | // GroupType分组 1 最近联系人 2 好友 3 仇人 4 黑名单 |
| | | |
| | | private FuncConfigConfig _friendFuncModel; |
| | | private Dictionary<byte,Dictionary<uint,FriendPlayer>> _groupDict = new Dictionary<byte,Dictionary<uint, FriendPlayer>>(); //所有好友信息 key 分组 value 好友信息 |
| | | private Dictionary<uint, FriendPlayer> _friendQuestDict = new Dictionary<uint, FriendPlayer>(); //好友请求 |
| | | private Dictionary<uint, FriendPlayer> _friendRecommendDict = new Dictionary<uint, FriendPlayer>(); //好友推荐 |
| | | private Dictionary<uint, FriendPlayer> _socialPlayerDict = new Dictionary<uint, FriendPlayer>(); //好友推荐 |
| | | |
| | | private FuncConfigConfig _GreatFuncModel; //涅槃开启 |
| | | public int OpenGreatLV { get; private set; } |
| | | |
| | | /* 注意:_socialPlayerDict和_groupDict存储数量不一样 */ |
| | | |
| | | public Dictionary<GroupType,string> contactTypeNumDict { get; private set;} |
| | | |
| | | public override void Init() |
| | | { |
| | | _GreatFuncModel = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("GreatMasterStartLV"); |
| | | OpenGreatLV = int.Parse(_GreatFuncModel.Numerical1); |
| | | contactTypeNumDict = new Dictionary<GroupType, string>(); |
| | | FuncConfigConfig recentNum = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("ContactsMaxCnt"); |
| | | contactTypeNumDict.Add(GroupType.RecentContact,recentNum.Numerical1); |
| | | FuncConfigConfig friendNum = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("FriendMaxCnt"); |
| | | contactTypeNumDict.Add(GroupType.Friend, friendNum.Numerical1); |
| | | FuncConfigConfig enemyNum = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("EnemiesMaxCnt"); |
| | | contactTypeNumDict.Add(GroupType.Enemy, enemyNum.Numerical1); |
| | | FuncConfigConfig blackNum = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("BlacklistMaxCnt"); |
| | | contactTypeNumDict.Add(GroupType.Balcklist, blackNum.Numerical1); |
| | | |
| | | GA_Hero.OnKillPlayer += RefreshKillOtherPlayer; |
| | | SetGroupRedPointKey(); |
| | | } |
| | | |
| | | public override void UnInit() |
| | | { |
| | | ChatCtrl.OnRefreshPteChat -= FriendChatRedPointCtrl; |
| | | ChatCtrl.Inst.SelectRecentlyEvent -= PrivateSomeone; |
| | | GA_Hero.OnKillPlayer -= RefreshKillOtherPlayer; |
| | | } |
| | | |
| | | public void OnBeforePlayerDataInitialize() |
| | | { |
| | | ChatCtrl.OnRefreshPteChat -= FriendChatRedPointCtrl; |
| | | ChatCtrl.Inst.SelectRecentlyEvent -= PrivateSomeone; |
| | | _groupDict.Clear(); |
| | | _friendQuestDict.Clear(); |
| | | _friendRecommendDict.Clear(); |
| | | _socialPlayerDict.Clear(); |
| | | friendRedDict.Clear(); |
| | | needLookInfoDict.Clear(); |
| | | } |
| | | |
| | | public void OnAfterPlayerDataInitialize() |
| | | { |
| | | ChatCtrl.OnRefreshPteChat += FriendChatRedPointCtrl; |
| | | ChatCtrl.Inst.SelectRecentlyEvent += PrivateSomeone; |
| | | } |
| | | |
| | | private void RefreshKillOtherPlayer(uint id, string name) |
| | | { |
| | | if (id == PlayerDatas.Instance.baseData.PlayerID || IsDungeon()) return; |
| | | |
| | | |
| | | ChatCtrl.Inst.PteChatID = (int)id; |
| | | MapConfig mapConfig = ConfigManager.Instance.GetTemplate<MapConfig>(PlayerDatas.Instance.baseData.MapID); |
| | | string msg = StringUtility.Contact(Language.Get("KillOthersDes", mapConfig.Name, UIHelper.ServerStringTrim(PlayerDatas.Instance.baseData.PlayerName)),ChatCtrl.KILL_IDENTIFY); |
| | | ChatCtrl.Inst.SendChatInfo(ChatInfoType.Friend,msg); |
| | | } |
| | | |
| | | private bool IsDungeon() |
| | | { |
| | | var mapId = PlayerDatas.Instance.baseData.MapID; |
| | | var mapConfig = ConfigManager.Instance.GetTemplate<MapConfig>(mapId); |
| | | return mapConfig != null && mapConfig.MapFBType != 0; |
| | | } |
| | | |
| | | |
| | | //刷新好友列表信息 |
| | | public void ReFreshFriendlist(HB304_tagGCSocialPlayers friendInfo) |
| | | { |
| | | tempFriendData = null; |
| | | if (friendInfo.Count > 0) |
| | | { |
| | | for (int i = 0; i < friendInfo.Count; i++) |
| | | { |
| | | if(!_socialPlayerDict.ContainsKey(friendInfo.Player[i].PlayerID)) |
| | | { |
| | | FriendPlayer friend = new FriendPlayer(); |
| | | friend.PlayerID = friendInfo.Player[i].PlayerID; |
| | | friend.PlayerName = friendInfo.Player[i].PlayerName; |
| | | friend.Job = friendInfo.Player[i].Job; |
| | | friend.LV = friendInfo.Player[i].LV; |
| | | friend.RealmLV = friendInfo.Player[i].RealmLV; |
| | | friend.OnlineType = friendInfo.Player[i].OnlineType; |
| | | _socialPlayerDict.Add(friend.PlayerID,friend); |
| | | } |
| | | else |
| | | { |
| | | _socialPlayerDict[friendInfo.Player[i].PlayerID].PlayerName = friendInfo.Player[i].PlayerName; |
| | | _socialPlayerDict[friendInfo.Player[i].PlayerID].Job = friendInfo.Player[i].Job; |
| | | _socialPlayerDict[friendInfo.Player[i].PlayerID].LV = friendInfo.Player[i].LV; |
| | | _socialPlayerDict[friendInfo.Player[i].PlayerID].RealmLV = friendInfo.Player[i].RealmLV; |
| | | _socialPlayerDict[friendInfo.Player[i].PlayerID].OnlineType = friendInfo.Player[i].OnlineType; |
| | | } |
| | | } |
| | | if (RefreshFriendModel != null) |
| | | RefreshFriendModel(); |
| | | } |
| | | |
| | | } |
| | | |
| | | //刷新分组信息 |
| | | |
| | | public void ReFreshGroupInfo(HB308_tagGCGroupPlayers groupInfo) |
| | | { |
| | | tempFriendData = null; |
| | | if (groupInfo.GroupType == (int)GroupType.Friend) |
| | | { |
| | | _friendFuncModel = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("FriendMaxCnt"); |
| | | if(_groupDict.ContainsKey(groupInfo.GroupType)) |
| | | { |
| | | if (_groupDict[groupInfo.GroupType].Count >= int.Parse(_friendFuncModel.Numerical1)) |
| | | return; |
| | | } |
| | | } |
| | | else if(groupInfo.GroupType == (int)GroupType.Balcklist) |
| | | { |
| | | _friendFuncModel = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("BlacklistMaxCnt"); |
| | | if (_groupDict.ContainsKey(groupInfo.GroupType)) |
| | | { |
| | | if (_groupDict[groupInfo.GroupType].Count >= int.Parse(_friendFuncModel.Numerical1)) |
| | | return; |
| | | } |
| | | } |
| | | |
| | | if (groupInfo.Count > 0) |
| | | { |
| | | if (!_groupDict.ContainsKey(groupInfo.GroupType)) |
| | | { |
| | | Dictionary<uint, FriendPlayer> friendInfoDict = new Dictionary<uint, FriendPlayer>(); |
| | | _groupDict.Add(groupInfo.GroupType, friendInfoDict); |
| | | for (int i = 0; i < groupInfo.Count; i++) |
| | | { |
| | | FriendPlayer friend = new FriendPlayer(); |
| | | friend.PlayerID = groupInfo.Players[i].PlayerID; |
| | | friend.SortValue = groupInfo.Players[i].SortValue; |
| | | friendInfoDict.Add(friend.PlayerID, friend); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | for (int i = 0; i < groupInfo.Count; i++) |
| | | { |
| | | if (_groupDict[groupInfo.GroupType].ContainsKey(groupInfo.Players[i].PlayerID)) |
| | | { |
| | | _groupDict[groupInfo.GroupType][groupInfo.Players[i].PlayerID].SortValue = groupInfo.Players[i].SortValue; |
| | | } |
| | | else |
| | | { |
| | | FriendPlayer friend = new FriendPlayer(); |
| | | friend.PlayerID = groupInfo.Players[i].PlayerID; |
| | | friend.SortValue = groupInfo.Players[i].SortValue; |
| | | _groupDict[groupInfo.GroupType].Add(friend.PlayerID, friend); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | SetFriendRedPointKey((GroupType)groupInfo.GroupType); |
| | | } |
| | | |
| | | //广播玩家名称 |
| | | public void GetPlayerName(HB305_tagGCSocialName playerName) |
| | | { |
| | | if (_socialPlayerDict.ContainsKey(playerName.PlayerID)) |
| | | { |
| | | _socialPlayerDict[playerName.PlayerID].PlayerName = playerName.Name; |
| | | if (RefreshFriendModel != null) |
| | | RefreshFriendModel(); |
| | | } |
| | | |
| | | } |
| | | //玩家在线情况 |
| | | public void RefreshOnlineType(HB306_tagGCSocialOnline onlineType) |
| | | { |
| | | DesignDebug.Log("RefreshOnlineType:ID" + onlineType.PlayerID + "在线情况:" + onlineType.OnlineType); |
| | | if(_socialPlayerDict.ContainsKey(onlineType.PlayerID)) |
| | | { |
| | | _socialPlayerDict[onlineType.PlayerID].OnlineType = onlineType.OnlineType; |
| | | if (RefreshFriendModel != null) |
| | | RefreshFriendModel(); |
| | | } |
| | | |
| | | } |
| | | |
| | | //玩家属性刷新 |
| | | public void RefreshPlayerAttr(HB307_tagGCSocialRefreshType data) |
| | | { |
| | | if (_socialPlayerDict.ContainsKey(data.PlayerID)) |
| | | { |
| | | if(data.RefreshType == (int)PlayerDataRefresh.LV) |
| | | _socialPlayerDict[data.PlayerID].LV = (ushort)data.Value; |
| | | else if(data.RefreshType == (int)PlayerDataRefresh.OfficialRank) |
| | | _socialPlayerDict[data.PlayerID].RealmLV = (ushort)data.Value; |
| | | |
| | | if (RefreshFriendModel != null) |
| | | RefreshFriendModel(); |
| | | } |
| | | } |
| | | |
| | | //添加好友 |
| | | public void AddFriend(HB301_tagGCAddSocialPlayer addfriend) |
| | | { |
| | | tempFriendData = null; |
| | | DesignDebug.Log("AddFriend"); |
| | | if (!_groupDict.ContainsKey(addfriend.GroupType)) |
| | | { |
| | | Dictionary<uint, FriendPlayer> friendInfoDict = new Dictionary<uint, FriendPlayer>(); |
| | | FriendPlayer friend = new FriendPlayer(); |
| | | friend.PlayerID = addfriend.PlayerID; |
| | | friend.SortValue = addfriend.SortValue; |
| | | friendInfoDict.Add(friend.PlayerID, friend); |
| | | _groupDict.Add(addfriend.GroupType, friendInfoDict); |
| | | if (RefreshFriendCntEvent != null) |
| | | { |
| | | RefreshFriendCntEvent((GroupType)addfriend.GroupType,true); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (!_groupDict[addfriend.GroupType].ContainsKey(addfriend.PlayerID)) |
| | | { |
| | | FriendPlayer friend = new FriendPlayer(); |
| | | friend.PlayerID = addfriend.PlayerID; |
| | | friend.SortValue = addfriend.SortValue; |
| | | _groupDict[addfriend.GroupType].Add(friend.PlayerID, friend); |
| | | if (RefreshFriendCntEvent != null) |
| | | { |
| | | RefreshFriendCntEvent((GroupType)addfriend.GroupType,true); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | |
| | | _groupDict[addfriend.GroupType][addfriend.PlayerID].SortValue = addfriend.SortValue; |
| | | } |
| | | |
| | | } |
| | | |
| | | SetFriendRedPointKey((GroupType)addfriend.GroupType); |
| | | } |
| | | |
| | | //询问是否添加好友 |
| | | public Action askAddFriendEvent; |
| | | public void AskIfAddFriend(HB303_tagGCFriendAskIfJoin ifadd) |
| | | { |
| | | if (!_friendQuestDict.ContainsKey(ifadd.AskID)) |
| | | { |
| | | FriendPlayer friendInfo = new FriendPlayer(); |
| | | friendInfo.PlayerID = ifadd.AskID; |
| | | friendInfo.PlayerName = ifadd.Name; |
| | | friendInfo.LV = ifadd.LV; |
| | | friendInfo.RealmLV = ifadd.RealmLV; |
| | | _friendQuestDict.Add(friendInfo.PlayerID,friendInfo); |
| | | } |
| | | else |
| | | { |
| | | _friendQuestDict[ifadd.AskID].PlayerName = ifadd.Name; |
| | | _friendQuestDict[ifadd.AskID].LV = ifadd.LV; |
| | | _friendQuestDict[ifadd.AskID].RealmLV = ifadd.RealmLV; |
| | | } |
| | | FriendQuestRedPointCtrl(); |
| | | if (askAddFriendEvent != null) |
| | | askAddFriendEvent(); |
| | | |
| | | } |
| | | |
| | | //删除好友 |
| | | public void DeleteFriend(HB302_tagGCDelSocialPlayer deletefreind) |
| | | { |
| | | RemoveFriendRed((GroupType)deletefreind.GroupType,(int)deletefreind.PlayerID); |
| | | if (_groupDict.ContainsKey(deletefreind.GroupType)) |
| | | { |
| | | _groupDict[deletefreind.GroupType].Remove(deletefreind.PlayerID); |
| | | |
| | | if (RefreshFriendCntEvent != null) |
| | | { |
| | | RefreshFriendCntEvent((GroupType)deletefreind.GroupType,false); |
| | | } |
| | | } |
| | | |
| | | SetFriendRedPointKey((GroupType)deletefreind.GroupType); |
| | | } |
| | | |
| | | //得到推荐好友信息 |
| | | public void GetRecommendFriendInfo(HA9A8_tagGCRecommendFriendsInfo recommendInfo) |
| | | { |
| | | _friendRecommendDict.Clear(); |
| | | if(recommendInfo.Cnt > 0) |
| | | { |
| | | int i; |
| | | for(i = 0; i < recommendInfo.Cnt; i++) |
| | | { |
| | | if(!_friendRecommendDict.ContainsKey(recommendInfo.FriendsList[i].ID)) |
| | | { |
| | | FriendPlayer friend = new FriendPlayer(); |
| | | friend.PlayerID = recommendInfo.FriendsList[i].ID; |
| | | friend.PlayerName = recommendInfo.FriendsList[i].Name; |
| | | friend.Job = recommendInfo.FriendsList[i].Job; |
| | | friend.LV = (ushort)recommendInfo.FriendsList[i].LV; |
| | | friend.RealmLV = recommendInfo.FriendsList[i].RealmLV; |
| | | friend.IsApplay = false; |
| | | _friendRecommendDict.Add(friend.PlayerID,friend); |
| | | |
| | | |
| | | Debug.Log("id"+ recommendInfo.FriendsList[i].ID + "名字" + recommendInfo.FriendsList[i].Name + "等级" + recommendInfo.FriendsList[i].LV |
| | | + "职业" + recommendInfo.FriendsList[i].Job); |
| | | } |
| | | else |
| | | { |
| | | _friendRecommendDict[recommendInfo.FriendsList[i].ID].PlayerName = recommendInfo.FriendsList[i].Name; |
| | | _friendRecommendDict[recommendInfo.FriendsList[i].ID].Job = recommendInfo.FriendsList[i].Job; |
| | | _friendRecommendDict[recommendInfo.FriendsList[i].ID].LV = (ushort)recommendInfo.FriendsList[i].LV; |
| | | _friendRecommendDict[recommendInfo.FriendsList[i].ID].RealmLV = (ushort)recommendInfo.FriendsList[i].RealmLV; |
| | | _friendRecommendDict[recommendInfo.FriendsList[i].ID].IsApplay = false; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (RefreshRecommendFriendEvent != null) |
| | | { |
| | | RefreshRecommendFriendEvent(); |
| | | } |
| | | } |
| | | |
| | | #region 红点逻辑处理 |
| | | |
| | | private void FriendQuestRedPointCtrl() |
| | | { |
| | | MainRedDot.Instance.redpointFriendQuest.state = RedPointState.None; |
| | | |
| | | if (FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Friend)) |
| | | { |
| | | if (_friendQuestDict.Count > 0) |
| | | { |
| | | MainRedDot.Instance.redpointFriendQuest.state = RedPointState.Quantity; |
| | | MainRedDot.Instance.redpointFriendQuest.count = _friendQuestDict.Count; |
| | | } |
| | | } |
| | | } |
| | | |
| | | public const int RedPoint_SocialKey = 2501; |
| | | public Redpoint redpointSocial = new Redpoint(MainRedDot.RedPoint_FriendChatKey, RedPoint_SocialKey); |
| | | |
| | | private Dictionary<GroupType, Redpoint> groupRedDict = new Dictionary<GroupType, Redpoint>(); |
| | | public void SetGroupRedPointKey() |
| | | { |
| | | groupRedDict.Clear(); |
| | | for (int i = 1; i < 5; i++) |
| | | { |
| | | GroupType groupType = (GroupType)i; |
| | | int redId = RedPoint_SocialKey * 100 + i; |
| | | Redpoint redpoint = new Redpoint(RedPoint_SocialKey, redId); |
| | | groupRedDict.Add(groupType, redpoint); |
| | | } |
| | | } |
| | | |
| | | public Dictionary<int, ChatFriendData> needLookInfoDict = new Dictionary<int, ChatFriendData>(); |
| | | private Dictionary<GroupType, Dictionary<int, Redpoint>> friendRedDict = new Dictionary<GroupType, Dictionary<int, Redpoint>>(); |
| | | public void SetFriendRedPointKey(GroupType type) |
| | | { |
| | | Dictionary<uint, FriendPlayer> friendDict = GetFriendDictByType((byte)type); |
| | | if (!friendRedDict.ContainsKey(type)) |
| | | { |
| | | Dictionary<int, Redpoint> redDict = new Dictionary<int, Redpoint>(); |
| | | friendRedDict.Add(type, redDict); |
| | | |
| | | } |
| | | else |
| | | { |
| | | foreach (var id in friendRedDict[type].Keys) |
| | | { |
| | | friendRedDict[type][id].state = RedPointState.None; |
| | | } |
| | | friendRedDict[type].Clear(); |
| | | } |
| | | |
| | | if (friendDict != null) |
| | | { |
| | | int i = 1; |
| | | foreach (var id in friendDict.Keys) |
| | | { |
| | | int redId = groupRedDict[type].id * 1000 + i; |
| | | Redpoint redpoint = new Redpoint(groupRedDict[type].id, redId); |
| | | friendRedDict[type].Add((int)id, redpoint); |
| | | i += 1; |
| | | } |
| | | } |
| | | |
| | | if (newChatInfo != null) |
| | | { |
| | | if(!needLookInfoDict.ContainsKey(newChatInfo.player)) |
| | | { |
| | | needLookInfoDict.Add(newChatInfo.player,newChatInfo); |
| | | } |
| | | else |
| | | { |
| | | needLookInfoDict[newChatInfo.player] = newChatInfo; |
| | | } |
| | | newChatInfo = null; |
| | | } |
| | | |
| | | |
| | | if (FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Friend)) |
| | | { |
| | | foreach (var key in needLookInfoDict.Keys) |
| | | { |
| | | |
| | | if (needLookInfoDict[key].toPlayer == PlayerDatas.Instance.baseData.PlayerID) |
| | | { |
| | | if (friendRedDict.ContainsKey(GroupType.RecentContact)) |
| | | { |
| | | foreach (var id in friendRedDict[GroupType.RecentContact].Keys) |
| | | { |
| | | if (id == needLookInfoDict[key].player) |
| | | { |
| | | if(FriendTips.lookGroupType != GroupType.RecentContact) |
| | | { |
| | | friendRedDict[GroupType.RecentContact][id].state = RedPointState.Simple; |
| | | } |
| | | else if(FriendTips.selectPlayerId != id) |
| | | { |
| | | friendRedDict[GroupType.RecentContact][id].state = RedPointState.Simple; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | public ChatFriendData newChatInfo { get; private set; } |
| | | public void FriendChatRedPointCtrl(ChatFriendData data) |
| | | { |
| | | newChatInfo = data; |
| | | DesignDebug.Log("FriendChatRedPointCtrl"); |
| | | } |
| | | |
| | | private void PrivateSomeone(int playerId) |
| | | { |
| | | RemoveFriendRed(GroupType.RecentContact, playerId); |
| | | } |
| | | |
| | | |
| | | public void RemoveFriendRed(GroupType type,int id) |
| | | { |
| | | if (friendRedDict.ContainsKey(type)) |
| | | { |
| | | if (friendRedDict[type].ContainsKey(id)) |
| | | { |
| | | if (friendRedDict[type][id].state == RedPointState.Simple) |
| | | { |
| | | friendRedDict[type][id].state = RedPointState.None; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(type == GroupType.RecentContact) |
| | | { |
| | | if (needLookInfoDict.ContainsKey(id)) |
| | | { |
| | | needLookInfoDict.Remove(id); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | public int GetFriendRedPointId(GroupType type,int id) |
| | | { |
| | | if (friendRedDict.ContainsKey(type)) |
| | | { |
| | | if (friendRedDict[type].ContainsKey(id)) |
| | | { |
| | | return friendRedDict[type][id].id; |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | public int GetGroupRedPointId(GroupType type) |
| | | { |
| | | if(groupRedDict.ContainsKey(type)) |
| | | { |
| | | return groupRedDict[type].id; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | public string GetOnlineType(int onlineType) |
| | | { |
| | | DesignDebug.Log("在线状态:" + onlineType); |
| | | if (onlineType == 0) |
| | | { |
| | | return Language.Get("Friend108"); |
| | | } |
| | | else if(onlineType == 1) |
| | | { |
| | | return Language.Get("Friend109"); |
| | | } |
| | | else if (onlineType == 1) |
| | | { |
| | | return Language.Get("Friend110"); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | public Dictionary<uint, FriendPlayer> SocialPlayerOrder(byte groupType) |
| | | { |
| | | Dictionary<uint, FriendPlayer> friendDict = new Dictionary<uint, FriendPlayer>(); |
| | | List<FriendPlayer> friendlist = new List<FriendPlayer>(); |
| | | foreach (var id in _groupDict[groupType].Keys) |
| | | { |
| | | if (_socialPlayerDict.ContainsKey(id)) |
| | | { |
| | | FriendPlayer friendPlayer = new FriendPlayer(); |
| | | friendPlayer.PlayerID = id; |
| | | friendPlayer.SortValue = _groupDict[groupType][id].SortValue; |
| | | friendPlayer.PlayerName = _socialPlayerDict[id].PlayerName; |
| | | friendPlayer.Job = _socialPlayerDict[id].Job; |
| | | friendPlayer.LV = _socialPlayerDict[id].LV; |
| | | friendPlayer.RealmLV = _socialPlayerDict[id].RealmLV; |
| | | friendPlayer.OnlineType = _socialPlayerDict[id].OnlineType; |
| | | friendlist.Add(friendPlayer); |
| | | } |
| | | } |
| | | |
| | | switch (groupType) |
| | | { |
| | | case (byte)GroupType.RecentContact: |
| | | friendlist.Sort(GetCompareRecentResult); |
| | | break; |
| | | case (byte)GroupType.Friend: |
| | | friendlist.Sort(GetCompareFriendResult); |
| | | break; |
| | | case (byte)GroupType.Enemy: |
| | | friendlist.Sort(GetCompareRecentResult); |
| | | break; |
| | | case (byte)GroupType.Balcklist: |
| | | friendlist.Sort(GetCompareRecentResult); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | int i = 0; |
| | | for (i = 0; i < friendlist.Count; i++) |
| | | { |
| | | friendDict.Add(friendlist[i].PlayerID, friendlist[i]); |
| | | } |
| | | |
| | | return friendDict; |
| | | |
| | | } |
| | | |
| | | //只有时间、在线状态的排序 |
| | | public int GetCompareRecentResult(FriendPlayer start, FriendPlayer end) |
| | | { |
| | | bool sIsOnline = IsOnline(start); |
| | | bool eIsOnline = IsOnline(end); |
| | | if (sIsOnline.CompareTo(eIsOnline) != 0) |
| | | return -sIsOnline.CompareTo(eIsOnline); |
| | | |
| | | uint sTime = start.SortValue; |
| | | uint eTime = end.SortValue; |
| | | if(sTime.CompareTo(eTime) != 0) |
| | | return -sTime.CompareTo(eTime); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | //没有时间的排序 |
| | | public int GetCompareFriendResult(FriendPlayer start, FriendPlayer end) |
| | | { |
| | | bool sIsOnline = IsOnline(start); |
| | | bool eIsOnline = IsOnline(end); |
| | | if (sIsOnline.CompareTo(eIsOnline) != 0) |
| | | return -sIsOnline.CompareTo(eIsOnline); |
| | | |
| | | int sLv = start.LV; |
| | | int eLv = end.LV; |
| | | if(sLv.CompareTo(eLv) != 0) |
| | | return -sLv.CompareTo(eLv); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | public bool IsOnline(FriendPlayer player) |
| | | { |
| | | if(player.OnlineType == 1) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | } |
| | | |
| | | //得到所有群组的玩家信息 |
| | | public Dictionary<byte, Dictionary<uint, FriendPlayer>> GetGroupAllInfo() |
| | | { |
| | | return _groupDict; |
| | | } |
| | | |
| | | //得到单个群组的玩家信息 |
| | | public Dictionary<uint, FriendPlayer> GetFriendInfoDict(byte groupType) |
| | | { |
| | | if(_groupDict.ContainsKey(groupType)) |
| | | { |
| | | return SocialPlayerOrder(groupType); |
| | | } |
| | | else |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | //得到群组字典 |
| | | public Dictionary<uint, FriendPlayer> GetFriendDictByType(byte groupType) |
| | | { |
| | | Dictionary<uint, FriendPlayer> dict = null; |
| | | _groupDict.TryGetValue(groupType,out dict); |
| | | return dict; |
| | | } |
| | | |
| | | //得到单个玩家信息 |
| | | public FriendPlayer GetFirendInfo(uint friendId,byte groupType) |
| | | { |
| | | if (_groupDict.ContainsKey(groupType)) |
| | | { |
| | | if(_groupDict[groupType].ContainsKey(friendId)) |
| | | { |
| | | if(_socialPlayerDict.ContainsKey(friendId)) |
| | | { |
| | | return _socialPlayerDict[friendId]; |
| | | } |
| | | else |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | else |
| | | return null; |
| | | } |
| | | |
| | | //得到所有请求加好友的玩家信息 |
| | | public Dictionary<uint, FriendPlayer> GetFriendQuestDict() |
| | | { |
| | | return _friendQuestDict; |
| | | } |
| | | |
| | | public void DeleteFriendQuest(uint PlayerID) |
| | | { |
| | | if (_friendQuestDict.ContainsKey(PlayerID)) |
| | | { |
| | | _friendQuestDict.Remove(PlayerID); |
| | | if (askAddFriendEvent != null) |
| | | askAddFriendEvent(); |
| | | } |
| | | FriendQuestRedPointCtrl(); |
| | | } |
| | | |
| | | public void DeleteAllFriendQuest() |
| | | { |
| | | _friendQuestDict.Clear(); |
| | | if (askAddFriendEvent != null) |
| | | askAddFriendEvent(); |
| | | FriendQuestRedPointCtrl(); |
| | | } |
| | | |
| | | //得到好友推荐信息 或 得到搜索信息 |
| | | public Dictionary<uint, FriendPlayer> GetRecommendDict() |
| | | { |
| | | return _friendRecommendDict; |
| | | } |
| | | |
| | | //得到添加好友单个信息 |
| | | public FriendPlayer GetAddFriendInfo(uint id) |
| | | { |
| | | if (_friendRecommendDict.ContainsKey(id)) |
| | | return _friendRecommendDict[id]; |
| | | else |
| | | return null; |
| | | } |
| | | |
| | | #region 玩家详细响应事件 |
| | | |
| | | public void OnClickLookFight(uint playerID) |
| | | { |
| | | ParticularModel.ViewRoleFightPower((int)playerID); |
| | | } |
| | | |
| | | public void OnClickRemoveBlack(uint playerID) |
| | | { |
| | | CB305_tagCGDelBlackList removeBlack = new CB305_tagCGDelBlackList(); |
| | | removeBlack.tagID = playerID; |
| | | GameNetSystem.Instance.SendInfo(removeBlack); |
| | | } |
| | | |
| | | public void OnClickInviteTeam(uint playerId) |
| | | { |
| | | TeamModel.RequestInviteJoinTeam((int)playerId); |
| | | } |
| | | |
| | | public void OnClickApplyTeam(uint playerId) |
| | | { |
| | | if (TeamModel.myTeam.inTeam) |
| | | { |
| | | ConfirmCancel.ShowPopConfirm( |
| | | "", |
| | | Language.Get("PlayerJoinTeam_1"), |
| | | (bool _ok) => |
| | | { |
| | | if (_ok) |
| | | { |
| | | TeamModel.RequestExitTeam(); |
| | | TeamModel.RequestApplyForJoin((int)playerId); |
| | | } |
| | | } |
| | | ); |
| | | } |
| | | else |
| | | { |
| | | TeamModel.RequestApplyForJoin((int)playerId); |
| | | } |
| | | } |
| | | |
| | | public void OnClickAddTeam() |
| | | { |
| | | |
| | | } |
| | | |
| | | public void OnClickAddBlack(uint playerID) |
| | | { |
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Friend)) { |
| | | FuncOpen.Instance.ProcessorFuncErrorTip((int)FuncOpenEnum.Friend); |
| | | return; |
| | | } |
| | | CB304_tagCGAddBlackList addBlack = new CB304_tagCGAddBlackList(); |
| | | addBlack.TagID = playerID; |
| | | GameNetSystem.Instance.SendInfo(addBlack); |
| | | } |
| | | |
| | | public void OnClickDeleteFriend(uint playerID) |
| | | { |
| | | CB302_tagCGDeleteFriend deleteFriend = new CB302_tagCGDeleteFriend(); |
| | | deleteFriend.FriendID = playerID; |
| | | GameNetSystem.Instance.SendInfo(deleteFriend); |
| | | } |
| | | |
| | | public void OnClickAddFriend(uint playerID) |
| | | { |
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Friend)) { |
| | | FuncOpen.Instance.ProcessorFuncErrorTip((int)FuncOpenEnum.Friend); |
| | | return; |
| | | } |
| | | CB301_tagCGAddFriend addFriend = new CB301_tagCGAddFriend(); |
| | | addFriend.TagID = playerID; |
| | | addFriend.TagName = ""; |
| | | GameNetSystem.Instance.SendInfo(addFriend); |
| | | } |
| | | |
| | | public void SendSearchPlayerQuest(string playerName) |
| | | { |
| | | CA9A4_tagCGFuzzySearchPlayer searchPlayer = new CA9A4_tagCGFuzzySearchPlayer(); |
| | | searchPlayer.Name = playerName; |
| | | GameNetSystem.Instance.SendInfo(searchPlayer); |
| | | } |
| | | |
| | | public void OnClickViewEquip(uint playerID) |
| | | { |
| | | ParticularModel.ViewRoleEquip((int)playerID); |
| | | } |
| | | |
| | | public void OnClickPrivateChat() |
| | | { |
| | | |
| | | } |
| | | |
| | | |
| | | public event Action<bool> friendlistUIEvent; |
| | | |
| | | public void RefreshFriendlistUI(bool isOpen) |
| | | { |
| | | if(friendlistUIEvent != null) |
| | | { |
| | | friendlistUIEvent(isOpen); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 最近联系人临时处理 |
| | | |
| | | public FriendPlayer tempFriendData = null; |
| | | |
| | | public void SetPlayerShortInfo(uint PlayerID,string PlayerName,byte Job,ushort LV,ushort RealmLV,byte OnlineType,bool isJump = false) |
| | | { |
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Friend)) { |
| | | FuncOpen.Instance.ProcessorFuncErrorTip((int)FuncOpenEnum.Friend); |
| | | return; |
| | | } |
| | | FriendPlayer friend = new FriendPlayer(); |
| | | friend.PlayerID = PlayerID; |
| | | friend.PlayerName = PlayerName; |
| | | friend.Job = Job; |
| | | friend.LV = LV; |
| | | friend.RealmLV = RealmLV; |
| | | friend.OnlineType = OnlineType; |
| | | tempFriendData = friend; |
| | | |
| | | if(!isJump) |
| | | { |
| | | if (WindowCenter.Instance.CheckOpen<ChatWin>()) |
| | | { |
| | | ChatCtrl.Inst.OpenFriendWin(); |
| | | } |
| | | else |
| | | { |
| | | ChatCtrl.Inst.presentChatType = ChatInfoType.Friend; |
| | | WindowCenter.Instance.Open<ChatWin>(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.PrivateChat); |
| | | } |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 发送请求 |
| | | /// <summary> |
| | | /// 发送好友推荐申请 |
| | | /// </summary> |
| | | public void OnSendCA9A3_tagCGQueryRecommendFriends() |
| | | { |
| | | CA9A3_tagCGQueryRecommendFriends RecommendFriends = new CA9A3_tagCGQueryRecommendFriends(); |
| | | GameNetSystem.Instance.SendInfo(RecommendFriends); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | using System.Collections.Generic;
|
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | | using Snxxz.UI;
|
| | | using TableConfig;
|
| | | using System;
|
| | | using System.Linq;
|
| | |
|
| | | public class FriendPlayer
|
| | | {
|
| | | public uint PlayerID;
|
| | |
|
| | | public string PlayerName;
|
| | |
|
| | | public byte Job;
|
| | |
|
| | | public ushort LV; //等级
|
| | |
|
| | | public ushort RealmLV; //境界
|
| | |
|
| | | public byte OnlineType; //0不在线 1在线 2脱机在线
|
| | |
|
| | | public uint SortValue; ////最近联系人和仇人按时间排序
|
| | |
|
| | | public bool IsApplay; //是否申请添加好友
|
| | |
|
| | | }
|
| | |
|
| | | public enum GroupType
|
| | | {
|
| | | RecentContact = 1,
|
| | | Friend,
|
| | | Enemy,
|
| | | Balcklist,
|
| | | AddFriend,
|
| | | None,
|
| | | }
|
| | |
|
| | | public class FriendsModel : Model,IBeforePlayerDataInitialize,IAfterPlayerDataInitialize
|
| | | {
|
| | | TeamModel _teamModel;
|
| | | public TeamModel TeamModel
|
| | | {
|
| | | get
|
| | | {
|
| | | return _teamModel ?? (_teamModel = ModelCenter.Instance.GetModel<TeamModel>());
|
| | | }
|
| | | }
|
| | |
|
| | | RoleParticularModel _particularModel;
|
| | | RoleParticularModel ParticularModel
|
| | | {
|
| | | get
|
| | | {
|
| | | return _particularModel ?? (_particularModel = ModelCenter.Instance.GetModel<RoleParticularModel>());
|
| | | }
|
| | | }
|
| | |
|
| | | public event Action RefreshFriendModel;//刷新好友信息
|
| | |
|
| | | public event Action<GroupType,bool> RefreshFriendCntEvent; //刷新好友数量信息 true 增加好友 false 减少
|
| | |
|
| | |
|
| | | public delegate void OnRefresRecommendFriend(); //刷新推荐列表
|
| | | public event OnRefresRecommendFriend RefreshRecommendFriendEvent;
|
| | |
|
| | | public delegate void OnRefreshQuest();
|
| | | public event OnRefreshQuest RefreshQuestEvent;
|
| | | // GroupType分组 1 最近联系人 2 好友 3 仇人 4 黑名单
|
| | |
|
| | | private FuncConfigConfig _friendFuncModel;
|
| | | private Dictionary<byte,Dictionary<uint,FriendPlayer>> _groupDict = new Dictionary<byte,Dictionary<uint, FriendPlayer>>(); //所有好友信息 key 分组 value 好友信息
|
| | | private Dictionary<uint, FriendPlayer> _friendQuestDict = new Dictionary<uint, FriendPlayer>(); //好友请求
|
| | | private Dictionary<uint, FriendPlayer> _friendRecommendDict = new Dictionary<uint, FriendPlayer>(); //好友推荐
|
| | | private Dictionary<uint, FriendPlayer> _socialPlayerDict = new Dictionary<uint, FriendPlayer>(); //好友推荐
|
| | |
|
| | | private FuncConfigConfig _GreatFuncModel; //涅槃开启
|
| | | public int OpenGreatLV { get; private set; }
|
| | |
|
| | | /* 注意:_socialPlayerDict和_groupDict存储数量不一样 */
|
| | |
|
| | | public Dictionary<GroupType,string> contactTypeNumDict { get; private set;}
|
| | |
|
| | | public override void Init()
|
| | | {
|
| | | _GreatFuncModel = Config.Instance.Get<FuncConfigConfig>("GreatMasterStartLV");
|
| | | OpenGreatLV = int.Parse(_GreatFuncModel.Numerical1);
|
| | | contactTypeNumDict = new Dictionary<GroupType, string>();
|
| | | FuncConfigConfig recentNum = Config.Instance.Get<FuncConfigConfig>("ContactsMaxCnt");
|
| | | contactTypeNumDict.Add(GroupType.RecentContact,recentNum.Numerical1);
|
| | | FuncConfigConfig friendNum = Config.Instance.Get<FuncConfigConfig>("FriendMaxCnt");
|
| | | contactTypeNumDict.Add(GroupType.Friend, friendNum.Numerical1);
|
| | | FuncConfigConfig enemyNum = Config.Instance.Get<FuncConfigConfig>("EnemiesMaxCnt");
|
| | | contactTypeNumDict.Add(GroupType.Enemy, enemyNum.Numerical1);
|
| | | FuncConfigConfig blackNum = Config.Instance.Get<FuncConfigConfig>("BlacklistMaxCnt");
|
| | | contactTypeNumDict.Add(GroupType.Balcklist, blackNum.Numerical1);
|
| | |
|
| | | GA_Hero.OnKillPlayer += RefreshKillOtherPlayer;
|
| | | SetGroupRedPointKey();
|
| | | }
|
| | |
|
| | | public override void UnInit()
|
| | | {
|
| | | ChatCtrl.OnRefreshPteChat -= FriendChatRedPointCtrl;
|
| | | ChatCtrl.Inst.SelectRecentlyEvent -= PrivateSomeone;
|
| | | GA_Hero.OnKillPlayer -= RefreshKillOtherPlayer;
|
| | | }
|
| | |
|
| | | public void OnBeforePlayerDataInitialize()
|
| | | {
|
| | | ChatCtrl.OnRefreshPteChat -= FriendChatRedPointCtrl;
|
| | | ChatCtrl.Inst.SelectRecentlyEvent -= PrivateSomeone;
|
| | | _groupDict.Clear();
|
| | | _friendQuestDict.Clear();
|
| | | _friendRecommendDict.Clear();
|
| | | _socialPlayerDict.Clear();
|
| | | friendRedDict.Clear();
|
| | | needLookInfoDict.Clear();
|
| | | }
|
| | |
|
| | | public void OnAfterPlayerDataInitialize()
|
| | | {
|
| | | ChatCtrl.OnRefreshPteChat += FriendChatRedPointCtrl;
|
| | | ChatCtrl.Inst.SelectRecentlyEvent += PrivateSomeone;
|
| | | }
|
| | |
|
| | | Color32 redColor = new Color32(255,1,1,255);
|
| | | private void RefreshKillOtherPlayer(uint id, string name)
|
| | | {
|
| | | if (id == PlayerDatas.Instance.baseData.PlayerID || IsDungeon()) return;
|
| | |
|
| | | ChatCtrl.Inst.PteChatID = (int)id;
|
| | | ChatCtrl.Inst.PteChatName = name;
|
| | | LanguageVerify.toPlayerLevel = 0;
|
| | | MapConfig mapConfig = Config.Instance.Get<MapConfig>(PlayerDatas.Instance.baseData.MapID);
|
| | | string msg = StringUtility.Contact(Language.Get("KillOthersDes", mapConfig.Name,StringUtility.Contact("<color=#FF0101FF>", UIHelper.ServerStringTrim(PlayerDatas.Instance.baseData.PlayerName), "</color>")),ChatCtrl.KILL_IDENTIFY);
|
| | | ChatCtrl.Inst.SendChatInfo(ChatInfoType.Friend,msg);
|
| | | }
|
| | |
|
| | | private bool IsDungeon()
|
| | | {
|
| | | var mapId = PlayerDatas.Instance.baseData.MapID;
|
| | | var mapConfig = Config.Instance.Get<MapConfig>(mapId);
|
| | | return mapConfig != null && mapConfig.MapFBType != 0;
|
| | | }
|
| | |
|
| | |
|
| | | //刷新好友列表信息
|
| | | public void ReFreshFriendlist(HB304_tagGCSocialPlayers friendInfo)
|
| | | {
|
| | | tempFriendData = null;
|
| | | if (friendInfo.Count > 0)
|
| | | {
|
| | | for (int i = 0; i < friendInfo.Count; i++)
|
| | | {
|
| | | if(!_socialPlayerDict.ContainsKey(friendInfo.Player[i].PlayerID))
|
| | | {
|
| | | FriendPlayer friend = new FriendPlayer();
|
| | | friend.PlayerID = friendInfo.Player[i].PlayerID;
|
| | | friend.PlayerName = friendInfo.Player[i].PlayerName;
|
| | | friend.Job = friendInfo.Player[i].Job;
|
| | | friend.LV = friendInfo.Player[i].LV;
|
| | | friend.RealmLV = friendInfo.Player[i].RealmLV;
|
| | | friend.OnlineType = friendInfo.Player[i].OnlineType;
|
| | | _socialPlayerDict.Add(friend.PlayerID,friend);
|
| | | }
|
| | | else
|
| | | {
|
| | | _socialPlayerDict[friendInfo.Player[i].PlayerID].PlayerName = friendInfo.Player[i].PlayerName;
|
| | | _socialPlayerDict[friendInfo.Player[i].PlayerID].Job = friendInfo.Player[i].Job;
|
| | | _socialPlayerDict[friendInfo.Player[i].PlayerID].LV = friendInfo.Player[i].LV;
|
| | | _socialPlayerDict[friendInfo.Player[i].PlayerID].RealmLV = friendInfo.Player[i].RealmLV;
|
| | | _socialPlayerDict[friendInfo.Player[i].PlayerID].OnlineType = friendInfo.Player[i].OnlineType;
|
| | | }
|
| | | }
|
| | | if (RefreshFriendModel != null)
|
| | | RefreshFriendModel();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | //刷新分组信息
|
| | |
|
| | | public void ReFreshGroupInfo(HB308_tagGCGroupPlayers groupInfo)
|
| | | {
|
| | | tempFriendData = null;
|
| | | if (groupInfo.GroupType == (int)GroupType.Friend)
|
| | | {
|
| | | _friendFuncModel = Config.Instance.Get<FuncConfigConfig>("FriendMaxCnt");
|
| | | if(_groupDict.ContainsKey(groupInfo.GroupType))
|
| | | {
|
| | | if (_groupDict[groupInfo.GroupType].Count >= int.Parse(_friendFuncModel.Numerical1))
|
| | | return;
|
| | | }
|
| | | }
|
| | | else if(groupInfo.GroupType == (int)GroupType.Balcklist)
|
| | | {
|
| | | _friendFuncModel = Config.Instance.Get<FuncConfigConfig>("BlacklistMaxCnt");
|
| | | if (_groupDict.ContainsKey(groupInfo.GroupType))
|
| | | {
|
| | | if (_groupDict[groupInfo.GroupType].Count >= int.Parse(_friendFuncModel.Numerical1))
|
| | | return;
|
| | | }
|
| | | }
|
| | |
|
| | | if (groupInfo.Count > 0)
|
| | | {
|
| | | if (!_groupDict.ContainsKey(groupInfo.GroupType))
|
| | | {
|
| | | Dictionary<uint, FriendPlayer> friendInfoDict = new Dictionary<uint, FriendPlayer>();
|
| | | _groupDict.Add(groupInfo.GroupType, friendInfoDict);
|
| | | for (int i = 0; i < groupInfo.Count; i++)
|
| | | {
|
| | | FriendPlayer friend = new FriendPlayer();
|
| | | friend.PlayerID = groupInfo.Players[i].PlayerID;
|
| | | friend.SortValue = groupInfo.Players[i].SortValue;
|
| | | friendInfoDict.Add(friend.PlayerID, friend);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | for (int i = 0; i < groupInfo.Count; i++)
|
| | | {
|
| | | if (_groupDict[groupInfo.GroupType].ContainsKey(groupInfo.Players[i].PlayerID))
|
| | | {
|
| | | _groupDict[groupInfo.GroupType][groupInfo.Players[i].PlayerID].SortValue = groupInfo.Players[i].SortValue;
|
| | | }
|
| | | else
|
| | | {
|
| | | FriendPlayer friend = new FriendPlayer();
|
| | | friend.PlayerID = groupInfo.Players[i].PlayerID;
|
| | | friend.SortValue = groupInfo.Players[i].SortValue;
|
| | | _groupDict[groupInfo.GroupType].Add(friend.PlayerID, friend);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | SetFriendRedPointKey((GroupType)groupInfo.GroupType);
|
| | | }
|
| | | |
| | | //广播玩家名称
|
| | | public void GetPlayerName(HB305_tagGCSocialName playerName)
|
| | | {
|
| | | if (_socialPlayerDict.ContainsKey(playerName.PlayerID))
|
| | | {
|
| | | _socialPlayerDict[playerName.PlayerID].PlayerName = playerName.Name;
|
| | | if (RefreshFriendModel != null)
|
| | | RefreshFriendModel();
|
| | | }
|
| | | |
| | | }
|
| | | //玩家在线情况
|
| | | public void RefreshOnlineType(HB306_tagGCSocialOnline onlineType)
|
| | | {
|
| | | DebugEx.Log("RefreshOnlineType:ID" + onlineType.PlayerID + "在线情况:" + onlineType.OnlineType);
|
| | | if(_socialPlayerDict.ContainsKey(onlineType.PlayerID))
|
| | | {
|
| | | _socialPlayerDict[onlineType.PlayerID].OnlineType = onlineType.OnlineType;
|
| | | if (RefreshFriendModel != null)
|
| | | RefreshFriendModel();
|
| | | }
|
| | | |
| | | }
|
| | |
|
| | | //玩家属性刷新
|
| | | public void RefreshPlayerAttr(HB307_tagGCSocialRefreshType data)
|
| | | {
|
| | | if (_socialPlayerDict.ContainsKey(data.PlayerID))
|
| | | {
|
| | | if(data.RefreshType == (int)PlayerDataRefresh.LV)
|
| | | _socialPlayerDict[data.PlayerID].LV = (ushort)data.Value;
|
| | | else if(data.RefreshType == (int)PlayerDataRefresh.OfficialRank)
|
| | | _socialPlayerDict[data.PlayerID].RealmLV = (ushort)data.Value;
|
| | |
|
| | | if (RefreshFriendModel != null)
|
| | | RefreshFriendModel();
|
| | | }
|
| | | }
|
| | |
|
| | | //添加好友
|
| | | public void AddFriend(HB301_tagGCAddSocialPlayer addfriend)
|
| | | {
|
| | | tempFriendData = null;
|
| | | DebugEx.Log("AddFriend");
|
| | | if (!_groupDict.ContainsKey(addfriend.GroupType))
|
| | | {
|
| | | Dictionary<uint, FriendPlayer> friendInfoDict = new Dictionary<uint, FriendPlayer>();
|
| | | FriendPlayer friend = new FriendPlayer();
|
| | | friend.PlayerID = addfriend.PlayerID;
|
| | | friend.SortValue = addfriend.SortValue;
|
| | | friendInfoDict.Add(friend.PlayerID, friend);
|
| | | _groupDict.Add(addfriend.GroupType, friendInfoDict);
|
| | | if (RefreshFriendCntEvent != null)
|
| | | {
|
| | | RefreshFriendCntEvent((GroupType)addfriend.GroupType,true);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | if (!_groupDict[addfriend.GroupType].ContainsKey(addfriend.PlayerID))
|
| | | {
|
| | | FriendPlayer friend = new FriendPlayer();
|
| | | friend.PlayerID = addfriend.PlayerID;
|
| | | friend.SortValue = addfriend.SortValue;
|
| | | _groupDict[addfriend.GroupType].Add(friend.PlayerID, friend);
|
| | | if (RefreshFriendCntEvent != null)
|
| | | {
|
| | | RefreshFriendCntEvent((GroupType)addfriend.GroupType,true);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | |
| | | _groupDict[addfriend.GroupType][addfriend.PlayerID].SortValue = addfriend.SortValue;
|
| | | }
|
| | | |
| | | }
|
| | |
|
| | | SetFriendRedPointKey((GroupType)addfriend.GroupType);
|
| | | }
|
| | |
|
| | | //询问是否添加好友
|
| | | public Action askAddFriendEvent;
|
| | | public void AskIfAddFriend(HB303_tagGCFriendAskIfJoin ifadd)
|
| | | {
|
| | | if (!_friendQuestDict.ContainsKey(ifadd.AskID))
|
| | | {
|
| | | FriendPlayer friendInfo = new FriendPlayer();
|
| | | friendInfo.PlayerID = ifadd.AskID;
|
| | | friendInfo.PlayerName = ifadd.Name;
|
| | | friendInfo.LV = ifadd.LV;
|
| | | friendInfo.RealmLV = ifadd.RealmLV;
|
| | | _friendQuestDict.Add(friendInfo.PlayerID,friendInfo);
|
| | | }
|
| | | else
|
| | | {
|
| | | _friendQuestDict[ifadd.AskID].PlayerName = ifadd.Name;
|
| | | _friendQuestDict[ifadd.AskID].LV = ifadd.LV;
|
| | | _friendQuestDict[ifadd.AskID].RealmLV = ifadd.RealmLV;
|
| | | }
|
| | | FriendQuestRedPointCtrl();
|
| | | if (askAddFriendEvent != null)
|
| | | askAddFriendEvent();
|
| | | |
| | | }
|
| | |
|
| | | //删除好友
|
| | | public void DeleteFriend(HB302_tagGCDelSocialPlayer deletefreind)
|
| | | {
|
| | | RemoveFriendRed((GroupType)deletefreind.GroupType,(int)deletefreind.PlayerID);
|
| | | if (_groupDict.ContainsKey(deletefreind.GroupType))
|
| | | {
|
| | | _groupDict[deletefreind.GroupType].Remove(deletefreind.PlayerID);
|
| | |
|
| | | if (RefreshFriendCntEvent != null)
|
| | | {
|
| | | RefreshFriendCntEvent((GroupType)deletefreind.GroupType,false);
|
| | | }
|
| | | }
|
| | |
|
| | | SetFriendRedPointKey((GroupType)deletefreind.GroupType);
|
| | | }
|
| | |
|
| | | //得到推荐好友信息
|
| | | public void GetRecommendFriendInfo(HA9A8_tagGCRecommendFriendsInfo recommendInfo)
|
| | | {
|
| | | _friendRecommendDict.Clear();
|
| | | if(recommendInfo.Cnt > 0)
|
| | | {
|
| | | int i;
|
| | | for(i = 0; i < recommendInfo.Cnt; i++)
|
| | | {
|
| | | if(!_friendRecommendDict.ContainsKey(recommendInfo.FriendsList[i].ID))
|
| | | {
|
| | | FriendPlayer friend = new FriendPlayer();
|
| | | friend.PlayerID = recommendInfo.FriendsList[i].ID;
|
| | | friend.PlayerName = recommendInfo.FriendsList[i].Name;
|
| | | friend.Job = recommendInfo.FriendsList[i].Job;
|
| | | friend.LV = (ushort)recommendInfo.FriendsList[i].LV;
|
| | | friend.RealmLV = recommendInfo.FriendsList[i].RealmLV;
|
| | | friend.IsApplay = false;
|
| | | _friendRecommendDict.Add(friend.PlayerID,friend);
|
| | |
|
| | |
|
| | | Debug.Log("id"+ recommendInfo.FriendsList[i].ID + "名字" + recommendInfo.FriendsList[i].Name + "等级" + recommendInfo.FriendsList[i].LV
|
| | | + "职业" + recommendInfo.FriendsList[i].Job);
|
| | | }
|
| | | else
|
| | | {
|
| | | _friendRecommendDict[recommendInfo.FriendsList[i].ID].PlayerName = recommendInfo.FriendsList[i].Name;
|
| | | _friendRecommendDict[recommendInfo.FriendsList[i].ID].Job = recommendInfo.FriendsList[i].Job;
|
| | | _friendRecommendDict[recommendInfo.FriendsList[i].ID].LV = (ushort)recommendInfo.FriendsList[i].LV;
|
| | | _friendRecommendDict[recommendInfo.FriendsList[i].ID].RealmLV = (ushort)recommendInfo.FriendsList[i].RealmLV;
|
| | | _friendRecommendDict[recommendInfo.FriendsList[i].ID].IsApplay = false;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | if (RefreshRecommendFriendEvent != null)
|
| | | {
|
| | | RefreshRecommendFriendEvent();
|
| | | }
|
| | | }
|
| | |
|
| | | #region 红点逻辑处理
|
| | |
|
| | | private void FriendQuestRedPointCtrl()
|
| | | {
|
| | | MainRedDot.Instance.redpointFriendQuest.state = RedPointState.None;
|
| | |
|
| | | if (FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Friend))
|
| | | {
|
| | | if (_friendQuestDict.Count > 0)
|
| | | {
|
| | | MainRedDot.Instance.redpointFriendQuest.state = RedPointState.Quantity;
|
| | | MainRedDot.Instance.redpointFriendQuest.count = _friendQuestDict.Count;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public const int RedPoint_SocialKey = 2501;
|
| | | public Redpoint redpointSocial = new Redpoint(MainRedDot.RedPoint_FriendChatKey, RedPoint_SocialKey);
|
| | |
|
| | | private Dictionary<GroupType, Redpoint> groupRedDict = new Dictionary<GroupType, Redpoint>();
|
| | | public void SetGroupRedPointKey()
|
| | | {
|
| | | groupRedDict.Clear();
|
| | | for (int i = 1; i < 5; i++)
|
| | | {
|
| | | GroupType groupType = (GroupType)i;
|
| | | int redId = RedPoint_SocialKey * 100 + i;
|
| | | Redpoint redpoint = new Redpoint(RedPoint_SocialKey, redId);
|
| | | groupRedDict.Add(groupType, redpoint);
|
| | | }
|
| | | }
|
| | |
|
| | | public Dictionary<int, ChatFriendData> needLookInfoDict = new Dictionary<int, ChatFriendData>();
|
| | | private Dictionary<GroupType, Dictionary<int, Redpoint>> friendRedDict = new Dictionary<GroupType, Dictionary<int, Redpoint>>();
|
| | | public void SetFriendRedPointKey(GroupType type)
|
| | | {
|
| | | Dictionary<uint, FriendPlayer> friendDict = GetFriendDictByType((byte)type);
|
| | | if (!friendRedDict.ContainsKey(type))
|
| | | {
|
| | | Dictionary<int, Redpoint> redDict = new Dictionary<int, Redpoint>();
|
| | | friendRedDict.Add(type, redDict);
|
| | | |
| | | }
|
| | | else
|
| | | {
|
| | | foreach (var id in friendRedDict[type].Keys)
|
| | | {
|
| | | friendRedDict[type][id].state = RedPointState.None;
|
| | | }
|
| | | friendRedDict[type].Clear();
|
| | | }
|
| | |
|
| | | if (friendDict != null)
|
| | | {
|
| | | int i = 1;
|
| | | foreach (var id in friendDict.Keys)
|
| | | {
|
| | | int redId = groupRedDict[type].id * 1000 + i;
|
| | | Redpoint redpoint = new Redpoint(groupRedDict[type].id, redId);
|
| | | friendRedDict[type].Add((int)id, redpoint);
|
| | | i += 1;
|
| | | }
|
| | | }
|
| | |
|
| | | if (newChatInfo != null)
|
| | | {
|
| | | if(!needLookInfoDict.ContainsKey(newChatInfo.player))
|
| | | {
|
| | | needLookInfoDict.Add(newChatInfo.player,newChatInfo);
|
| | | }
|
| | | else
|
| | | {
|
| | | needLookInfoDict[newChatInfo.player] = newChatInfo;
|
| | | }
|
| | | newChatInfo = null;
|
| | | }
|
| | |
|
| | |
|
| | | if (FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Friend))
|
| | | {
|
| | | foreach (var key in needLookInfoDict.Keys)
|
| | | {
|
| | |
|
| | | if (needLookInfoDict[key].toPlayer == PlayerDatas.Instance.baseData.PlayerID)
|
| | | {
|
| | | if (friendRedDict.ContainsKey(GroupType.RecentContact))
|
| | | {
|
| | | foreach (var id in friendRedDict[GroupType.RecentContact].Keys)
|
| | | {
|
| | | if (id == needLookInfoDict[key].player)
|
| | | {
|
| | | if(FriendTips.lookGroupType != GroupType.RecentContact)
|
| | | {
|
| | | friendRedDict[GroupType.RecentContact][id].state = RedPointState.Simple;
|
| | | }
|
| | | else if(FriendTips.selectPlayerId != id)
|
| | | {
|
| | | friendRedDict[GroupType.RecentContact][id].state = RedPointState.Simple;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | |
|
| | | public ChatFriendData newChatInfo { get; private set; }
|
| | | public void FriendChatRedPointCtrl(ChatFriendData data)
|
| | | {
|
| | | newChatInfo = data;
|
| | | DebugEx.Log("FriendChatRedPointCtrl");
|
| | | }
|
| | |
|
| | | private void PrivateSomeone(int playerId)
|
| | | {
|
| | | RemoveFriendRed(GroupType.RecentContact, playerId);
|
| | | }
|
| | |
|
| | |
|
| | | public void RemoveFriendRed(GroupType type,int id)
|
| | | {
|
| | | if (friendRedDict.ContainsKey(type))
|
| | | {
|
| | | if (friendRedDict[type].ContainsKey(id))
|
| | | {
|
| | | if (friendRedDict[type][id].state == RedPointState.Simple)
|
| | | {
|
| | | friendRedDict[type][id].state = RedPointState.None;
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | if(type == GroupType.RecentContact)
|
| | | {
|
| | | if (needLookInfoDict.ContainsKey(id))
|
| | | {
|
| | | needLookInfoDict.Remove(id);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | public int GetFriendRedPointId(GroupType type,int id)
|
| | | {
|
| | | if (friendRedDict.ContainsKey(type))
|
| | | {
|
| | | if (friendRedDict[type].ContainsKey(id))
|
| | | {
|
| | | return friendRedDict[type][id].id;
|
| | | }
|
| | | }
|
| | | return 0;
|
| | | }
|
| | |
|
| | | public int GetGroupRedPointId(GroupType type)
|
| | | {
|
| | | if(groupRedDict.ContainsKey(type))
|
| | | {
|
| | | return groupRedDict[type].id;
|
| | | }
|
| | | return 0;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | public string GetOnlineType(int onlineType)
|
| | | {
|
| | | DebugEx.Log("在线状态:" + onlineType);
|
| | | if (onlineType == 0)
|
| | | {
|
| | | return Language.Get("Friend108");
|
| | | }
|
| | | else if(onlineType == 1)
|
| | | {
|
| | | return Language.Get("Friend109");
|
| | | }
|
| | | else if (onlineType == 1)
|
| | | {
|
| | | return Language.Get("Friend110");
|
| | | }
|
| | | return "";
|
| | | }
|
| | |
|
| | | public Dictionary<uint, FriendPlayer> SocialPlayerOrder(byte groupType)
|
| | | {
|
| | | Dictionary<uint, FriendPlayer> friendDict = new Dictionary<uint, FriendPlayer>();
|
| | | List<FriendPlayer> friendlist = new List<FriendPlayer>();
|
| | | foreach (var id in _groupDict[groupType].Keys)
|
| | | {
|
| | | if (_socialPlayerDict.ContainsKey(id))
|
| | | {
|
| | | FriendPlayer friendPlayer = new FriendPlayer();
|
| | | friendPlayer.PlayerID = id;
|
| | | friendPlayer.SortValue = _groupDict[groupType][id].SortValue;
|
| | | friendPlayer.PlayerName = _socialPlayerDict[id].PlayerName;
|
| | | friendPlayer.Job = _socialPlayerDict[id].Job;
|
| | | friendPlayer.LV = _socialPlayerDict[id].LV;
|
| | | friendPlayer.RealmLV = _socialPlayerDict[id].RealmLV;
|
| | | friendPlayer.OnlineType = _socialPlayerDict[id].OnlineType;
|
| | | friendlist.Add(friendPlayer);
|
| | | }
|
| | | }
|
| | |
|
| | | switch (groupType)
|
| | | {
|
| | | case (byte)GroupType.RecentContact:
|
| | | friendlist.Sort(GetCompareRecentResult);
|
| | | break;
|
| | | case (byte)GroupType.Friend:
|
| | | friendlist.Sort(GetCompareFriendResult);
|
| | | break;
|
| | | case (byte)GroupType.Enemy:
|
| | | friendlist.Sort(GetCompareRecentResult);
|
| | | break;
|
| | | case (byte)GroupType.Balcklist:
|
| | | friendlist.Sort(GetCompareRecentResult);
|
| | | break;
|
| | | default:
|
| | | break;
|
| | | }
|
| | |
|
| | | int i = 0;
|
| | | for (i = 0; i < friendlist.Count; i++)
|
| | | {
|
| | | friendDict.Add(friendlist[i].PlayerID, friendlist[i]);
|
| | | }
|
| | |
|
| | | return friendDict;
|
| | | |
| | | }
|
| | |
|
| | | //只有时间、在线状态的排序
|
| | | public int GetCompareRecentResult(FriendPlayer start, FriendPlayer end)
|
| | | {
|
| | | bool sIsOnline = IsOnline(start);
|
| | | bool eIsOnline = IsOnline(end);
|
| | | if (sIsOnline.CompareTo(eIsOnline) != 0)
|
| | | return -sIsOnline.CompareTo(eIsOnline);
|
| | |
|
| | | uint sTime = start.SortValue;
|
| | | uint eTime = end.SortValue;
|
| | | if(sTime.CompareTo(eTime) != 0)
|
| | | return -sTime.CompareTo(eTime);
|
| | |
|
| | | return 0;
|
| | | }
|
| | |
|
| | | //没有时间的排序
|
| | | public int GetCompareFriendResult(FriendPlayer start, FriendPlayer end)
|
| | | {
|
| | | bool sIsOnline = IsOnline(start);
|
| | | bool eIsOnline = IsOnline(end);
|
| | | if (sIsOnline.CompareTo(eIsOnline) != 0)
|
| | | return -sIsOnline.CompareTo(eIsOnline);
|
| | |
|
| | | int sLv = start.LV;
|
| | | int eLv = end.LV;
|
| | | if(sLv.CompareTo(eLv) != 0)
|
| | | return -sLv.CompareTo(eLv);
|
| | |
|
| | | return 0;
|
| | | }
|
| | |
|
| | | public bool IsOnline(FriendPlayer player)
|
| | | {
|
| | | if(player.OnlineType == 1)
|
| | | {
|
| | | return true;
|
| | | }
|
| | | else
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | //得到所有群组的玩家信息
|
| | | public Dictionary<byte, Dictionary<uint, FriendPlayer>> GetGroupAllInfo()
|
| | | {
|
| | | return _groupDict;
|
| | | }
|
| | |
|
| | | //得到单个群组的玩家信息
|
| | | public Dictionary<uint, FriendPlayer> GetFriendInfoDict(byte groupType)
|
| | | {
|
| | | if(_groupDict.ContainsKey(groupType))
|
| | | {
|
| | | return SocialPlayerOrder(groupType);
|
| | | }
|
| | | else
|
| | | {
|
| | | return null;
|
| | | }
|
| | | }
|
| | |
|
| | | //得到群组字典
|
| | | public Dictionary<uint, FriendPlayer> GetFriendDictByType(byte groupType)
|
| | | {
|
| | | Dictionary<uint, FriendPlayer> dict = null;
|
| | | _groupDict.TryGetValue(groupType,out dict);
|
| | | return dict;
|
| | | }
|
| | |
|
| | | //得到单个玩家信息
|
| | | public FriendPlayer GetFirendInfo(uint friendId,byte groupType)
|
| | | {
|
| | | if (_groupDict.ContainsKey(groupType))
|
| | | {
|
| | | if(_groupDict[groupType].ContainsKey(friendId))
|
| | | {
|
| | | if(_socialPlayerDict.ContainsKey(friendId))
|
| | | {
|
| | | return _socialPlayerDict[friendId];
|
| | | }
|
| | | else
|
| | | {
|
| | | return null;
|
| | | }
|
| | | |
| | | }
|
| | | else
|
| | | {
|
| | | return null;
|
| | | }
|
| | | }
|
| | | |
| | | else
|
| | | return null;
|
| | | }
|
| | |
|
| | | //得到所有请求加好友的玩家信息
|
| | | public Dictionary<uint, FriendPlayer> GetFriendQuestDict()
|
| | | {
|
| | | return _friendQuestDict;
|
| | | }
|
| | |
|
| | | public void DeleteFriendQuest(uint PlayerID)
|
| | | {
|
| | | if (_friendQuestDict.ContainsKey(PlayerID))
|
| | | {
|
| | | _friendQuestDict.Remove(PlayerID);
|
| | | if (askAddFriendEvent != null)
|
| | | askAddFriendEvent();
|
| | | }
|
| | | FriendQuestRedPointCtrl();
|
| | | }
|
| | |
|
| | | public void DeleteAllFriendQuest()
|
| | | {
|
| | | _friendQuestDict.Clear();
|
| | | if (askAddFriendEvent != null)
|
| | | askAddFriendEvent();
|
| | | FriendQuestRedPointCtrl();
|
| | | }
|
| | |
|
| | | //得到好友推荐信息 或 得到搜索信息
|
| | | public Dictionary<uint, FriendPlayer> GetRecommendDict()
|
| | | {
|
| | | return _friendRecommendDict;
|
| | | }
|
| | |
|
| | | //得到添加好友单个信息
|
| | | public FriendPlayer GetAddFriendInfo(uint id)
|
| | | {
|
| | | if (_friendRecommendDict.ContainsKey(id))
|
| | | return _friendRecommendDict[id];
|
| | | else
|
| | | return null;
|
| | | }
|
| | |
|
| | | #region 玩家详细响应事件
|
| | |
|
| | | public void OnClickLookFight(uint playerID)
|
| | | {
|
| | | ParticularModel.ViewRoleFightPower((int)playerID);
|
| | | }
|
| | |
|
| | | public void OnClickRemoveBlack(uint playerID)
|
| | | {
|
| | | CB305_tagCGDelBlackList removeBlack = new CB305_tagCGDelBlackList();
|
| | | removeBlack.tagID = playerID;
|
| | | GameNetSystem.Instance.SendInfo(removeBlack);
|
| | | }
|
| | |
|
| | | public void OnClickInviteTeam(uint playerId)
|
| | | {
|
| | | TeamModel.RequestInviteJoinTeam((int)playerId);
|
| | | }
|
| | |
|
| | | public void OnClickApplyTeam(uint playerId)
|
| | | {
|
| | | if (TeamModel.myTeam.inTeam)
|
| | | {
|
| | | ConfirmCancel.ShowPopConfirm(
|
| | | "",
|
| | | Language.Get("PlayerJoinTeam_1"),
|
| | | (bool _ok) =>
|
| | | {
|
| | | if (_ok)
|
| | | {
|
| | | TeamModel.RequestExitTeam();
|
| | | TeamModel.RequestApplyForJoin((int)playerId);
|
| | | }
|
| | | }
|
| | | );
|
| | | }
|
| | | else
|
| | | {
|
| | | TeamModel.RequestApplyForJoin((int)playerId);
|
| | | }
|
| | | }
|
| | |
|
| | | public void OnClickAddTeam()
|
| | | {
|
| | |
|
| | | }
|
| | |
|
| | | public void OnClickAddBlack(uint playerID)
|
| | | {
|
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Friend)) {
|
| | | FuncOpen.Instance.ProcessorFuncErrorTip((int)FuncOpenEnum.Friend);
|
| | | return;
|
| | | }
|
| | | CB304_tagCGAddBlackList addBlack = new CB304_tagCGAddBlackList();
|
| | | addBlack.TagID = playerID;
|
| | | GameNetSystem.Instance.SendInfo(addBlack);
|
| | | }
|
| | |
|
| | | public void OnClickDeleteFriend(uint playerID)
|
| | | {
|
| | | CB302_tagCGDeleteFriend deleteFriend = new CB302_tagCGDeleteFriend();
|
| | | deleteFriend.FriendID = playerID;
|
| | | GameNetSystem.Instance.SendInfo(deleteFriend);
|
| | | }
|
| | |
|
| | | public void OnClickAddFriend(uint playerID)
|
| | | {
|
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Friend)) {
|
| | | FuncOpen.Instance.ProcessorFuncErrorTip((int)FuncOpenEnum.Friend);
|
| | | return;
|
| | | }
|
| | | CB301_tagCGAddFriend addFriend = new CB301_tagCGAddFriend();
|
| | | addFriend.TagID = playerID;
|
| | | addFriend.TagName = "";
|
| | | GameNetSystem.Instance.SendInfo(addFriend);
|
| | | }
|
| | |
|
| | | public void SendSearchPlayerQuest(string playerName)
|
| | | {
|
| | | CA9A4_tagCGFuzzySearchPlayer searchPlayer = new CA9A4_tagCGFuzzySearchPlayer();
|
| | | searchPlayer.Name = playerName;
|
| | | GameNetSystem.Instance.SendInfo(searchPlayer);
|
| | | }
|
| | |
|
| | | public void OnClickViewEquip(uint playerID)
|
| | | {
|
| | | ParticularModel.ViewRoleEquip((int)playerID);
|
| | | }
|
| | |
|
| | | public void OnClickPrivateChat()
|
| | | {
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | public event Action<bool> friendlistUIEvent;
|
| | | |
| | | public void RefreshFriendlistUI(bool isOpen)
|
| | | {
|
| | | if(friendlistUIEvent != null)
|
| | | {
|
| | | friendlistUIEvent(isOpen);
|
| | | }
|
| | | }
|
| | | #endregion
|
| | | |
| | | #region 最近联系人临时处理
|
| | |
|
| | | public FriendPlayer tempFriendData = null;
|
| | |
|
| | | public void SetPlayerShortInfo(uint PlayerID,string PlayerName,byte Job,ushort LV,ushort RealmLV,byte OnlineType,bool isJump = false)
|
| | | {
|
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Friend)) {
|
| | | FuncOpen.Instance.ProcessorFuncErrorTip((int)FuncOpenEnum.Friend);
|
| | | return;
|
| | | }
|
| | | FriendPlayer friend = new FriendPlayer();
|
| | | friend.PlayerID = PlayerID;
|
| | | friend.PlayerName = PlayerName;
|
| | | friend.Job = Job;
|
| | | friend.LV = LV;
|
| | | friend.RealmLV = RealmLV;
|
| | | friend.OnlineType = OnlineType;
|
| | | tempFriendData = friend;
|
| | |
|
| | | if(!isJump)
|
| | | {
|
| | | if (WindowCenter.Instance.CheckOpen<ChatWin>())
|
| | | {
|
| | | ChatCtrl.Inst.OpenFriendWin();
|
| | | }
|
| | | else
|
| | | {
|
| | | ChatCtrl.Inst.presentChatType = ChatInfoType.Friend;
|
| | | WindowCenter.Instance.Open<ChatWin>();
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.PrivateChat);
|
| | | }
|
| | | |
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region 发送请求
|
| | | /// <summary>
|
| | | /// 发送好友推荐申请
|
| | | /// </summary>
|
| | | public void OnSendCA9A3_tagCGQueryRecommendFriends()
|
| | | {
|
| | | CA9A3_tagCGQueryRecommendFriends RecommendFriends = new CA9A3_tagCGQueryRecommendFriends();
|
| | | GameNetSystem.Instance.SendInfo(RecommendFriends);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | } |