private void HandleRecommendPlayerFeedback(byte[] data) { RecommendPlayerS2C feedback = ProtobufUtils.Deserialize <RecommendPlayerS2C>(data); if (feedback.result) { systemRecommendedPlayerDataList.Clear(); List <FriendInfo> list = feedback.friends; for (int i = 0; i < list.Count; i++) { FriendListDataStruct friendData = new FriendListDataStruct(); friendData.playerUID = list[i].friendId; friendData.playerName = list[i].name; friendData.portrait = list[i].portrait; friendData.grade = list[i].grade; friendData.playerLevel = list[i].level; friendData.vipLevel = list[i].vipLevel; friendData.isOnline = list[i].isOnline; friendData.lastLoginTime = list[i].lastLoginTime; friendData.alreadyApplication = list[i].alreadyApplication; systemRecommendedPlayerDataList.Add(friendData); } view.RefreshSystemRecommendedFriendList(); } }
private void ShowFindedPlayerItem(FriendListDataStruct dummy) { for (int i = 0; i < findFriendPanelItemList.Count; i++) { findFriendPanelItemList[i].gameObject.SetActive(false); } findFriendPanelItemList[0].SetData(dummy); findFriendPanelItemList[0].Show(); }
private void HandleGiftCurrenciesFeedback(byte[] data) { GiftCurrenciesS2C feedback = ProtobufUtils.Deserialize <GiftCurrenciesS2C>(data); if (feedback.result) { FriendListDataStruct friend = friendListPlayerDataList.Find(t => t.playerUID == currentSendFriendId); int index = friendListPlayerDataList.IndexOf(friend); friend.canGiveGold = false; friendListPlayerDataList[index] = friend; view.RefreshFriendList(); MessageDispatcher.PostMessage(Constants.MessageType.OpenAlertWindow, null, UI.AlertType.ConfirmAlone, "金币赠送成功", "提示"); } }
private void FriendClick(long id) { FriendListDataStruct data = friendController.GetFriendListPlayersData().Find(p => p.playerUID == id); if (data.playerUID == 0) { friendController.SendRelationApplicationMessage(Data.RelationApplicationType.ApplyingRelation, id); MessageDispatcher.PostMessage(Constants.MessageType.OpenAlertWindow, null, UI.AlertType.ConfirmAlone, "好友申请已发送,请耐心等待对方确认", "提示"); } else { MessageDispatcher.PostMessage(Constants.MessageType.OpenAlertWindow, null, UI.AlertType.ConfirmAlone, "该玩家已经在好友列表中,无法再次添加", "提示"); } }
public void SetData(FriendListDataStruct data) { if (!isInited) { Initialize(); } this.playerUID = data.playerUID; this.playerInfoButtonIconName = data.portrait; this.playerName = data.playerName; this.playerLevel = data.playerLevel; this.playerRankIconID = data.grade; this.playerNetworkStatus = data.playerNetWorkStatus; }
public void SetData(FriendListDataStruct data) { if (!isInited) { Initialize(); } this.playerUID = data.playerUID; this.canSendGift = data.canGiveGold; this.playerInfoButtonIconName = data.portrait; this.playerName = data.playerName; this.playerLevel = data.playerLevel; this.playerVipIconID = data.vipLevel; this.playerRankIconID = data.grade; this.playerNetworkStatus = data.playerNetWorkStatus; this.isJoinedGuild = data.isPlayerJionedGuild; }
private void HandleRelationApplicationFeedback(byte[] data) { RelationApplicationS2C feedback = ProtobufUtils.Deserialize <RelationApplicationS2C>(data); if (feedback.result) { switch (feedback.applciationType) { case RelationApplicationType.AcceptRelation: FriendListDataStruct acceptRelationData = applicationPlayerDataList.Find(p => p.playerUID == feedback.friendId); applicationPlayerDataList.Remove(acceptRelationData); friendListPlayerDataList.Add(acceptRelationData); view.RefreshApplicationInfomationPlayerList(); DataManager.GetInstance().SetRedBubbleNum(CaptionType.RelationApplicationCaption, DataManager.GetInstance().GetRedBubbleNum(CaptionType.EmailCaption) - 1); view.RefresRedBubble(); break; case RelationApplicationType.BlockList: FriendListDataStruct blockData = friendListPlayerDataList.Find(p => p.playerUID == feedback.friendId); friendListPlayerDataList.Remove(blockData); view.RefreshFriendList(); break; case RelationApplicationType.Unblock: FriendListDataStruct unblockData = blackListPlayerDataList.Find(p => p.playerUID == feedback.friendId); blackListPlayerDataList.Remove(unblockData); view.RefreshBlackList(); break; case RelationApplicationType.RefuseRelation: FriendListDataStruct refuseRelationData = applicationPlayerDataList.Find(p => p.playerUID == feedback.friendId); applicationPlayerDataList.Remove(refuseRelationData); view.RefreshApplicationInfomationPlayerList(); DataManager.GetInstance().SetRedBubbleNum(CaptionType.RelationApplicationCaption, DataManager.GetInstance().GetRedBubbleNum(CaptionType.EmailCaption) - 1); view.RefresRedBubble(); break; case RelationApplicationType.RemoveRelation: FriendListDataStruct removeRelationData = friendListPlayerDataList.Find(p => p.playerUID == feedback.friendId); friendListPlayerDataList.Remove(removeRelationData); view.RefreshFriendList(); break; } } }
private static int FriendInfoSort(FriendListDataStruct x, FriendListDataStruct y) { if (y.isOnline.CompareTo(x.isOnline) != 0) { return(y.isOnline.CompareTo(x.isOnline)); } else if (y.grade.CompareTo(x.grade) != 0) { return(y.grade.CompareTo(x.grade)); } else if (y.playerLevel.CompareTo(x.playerLevel) != 0) { return(y.playerLevel.CompareTo(x.playerLevel)); } else if (y.playerUID.CompareTo(x.playerUID) != 0) { return(x.playerUID.CompareTo(y.playerUID)); } return(1); }
private List <FriendListDataStruct> GetFriendList(List <FriendInfo> list) { List <FriendListDataStruct> dataList = new List <FriendListDataStruct>(); for (int i = 0; i < list.Count; i++) { FriendListDataStruct friendData = new FriendListDataStruct(); friendData.canGiveGold = list[i].canGiveGold; friendData.playerUID = list[i].friendId; friendData.playerName = list[i].name; friendData.portrait = list[i].portrait; friendData.grade = list[i].grade; friendData.playerLevel = list[i].level; friendData.vipLevel = list[i].vipLevel; friendData.isPlayerJionedGuild = list[i].isOnline; friendData.lastLoginTime = list[i].lastLoginTime; friendData.playerNetWorkStatus = GetPlayerNetworkStatus(list[i].lastLoginTime, list[i].isOnline); dataList.Add(friendData); } return(dataList); }
//When set finished, if you want see show effect must use Show function. public void SetData(FriendListDataStruct friendListDataStruct) { if (!isInited) { Initialize(); } this.playerUID = friendListDataStruct.playerUID; this.playerIconName = friendListDataStruct.portrait; this.playerVipIconID = friendListDataStruct.vipLevel; this.playerRankIconID = friendListDataStruct.grade; this.playerName = friendListDataStruct.playerName; this.playerLevel = friendListDataStruct.playerLevel; // isOnline data error if (friendListDataStruct.isOnline) { this.playerNetworkStatus = "在线"; } else { this.playerNetworkStatus = "离线"; } this.alreadyApplication = friendListDataStruct.alreadyApplication; }