public void SetupView(FriendBriefDataItem friendBriefData, FriendOverviewPageContext.FriendTab friendTab, RequestCallBack onRequest = null, AcceptCallBack onAccept = null, RejectCallBack onReject = null, DetailCallBack onDetailBtnClick = null) { this._friendBriefData = friendBriefData; this._friendTab = friendTab; this._onRequestBtnClick = onRequest; this._onAcceptBtnClick = onAccept; this._onRejectBtnClick = onReject; this._onDetailBtnClick = onDetailBtnClick; this._friendAvatarData = new AvatarDataItem(friendBriefData.showAvatarID, 1, 0); base.transform.Find("AvatarImage/Image").GetComponent <Image>().sprite = Miscs.GetSpriteByPrefab(this._friendAvatarData.IconPath); base.transform.Find("AvatarImage/BGColor").GetComponent <Image>().sprite = this.GetBGSprite(); base.transform.Find("Nickname").GetComponent <Text>().text = friendBriefData.nickName; base.transform.Find("Lv/Num").GetComponent <Text>().text = friendBriefData.level.ToString(); base.transform.Find("AvatarInfo/Combat/Num").GetComponent <Text>().text = friendBriefData.avatarCombat.ToString(); base.transform.Find("AvatarInfo/AvatarStar/Star").GetComponent <MonoAvatarStar>().SetupView(friendBriefData.avatarStar); base.transform.Find("AvatarImage/NewMark").gameObject.SetActive((friendTab == FriendOverviewPageContext.FriendTab.FriendListTab) && !Singleton <FriendModule> .Instance.IsOldFriend(friendBriefData.uid)); bool flag = this._friendTab == FriendOverviewPageContext.FriendTab.AddFriendTab; bool flag2 = this._friendTab == FriendOverviewPageContext.FriendTab.RequestListTab; bool flag3 = this._friendTab == FriendOverviewPageContext.FriendTab.FriendListTab; bool flag4 = (flag || flag2) || flag3; base.transform.Find("ActionBtns/TalkBtn").gameObject.SetActive(false); base.transform.Find("ActionBtns/AddFriendBtn").gameObject.SetActive(false); base.transform.Find("ActionBtns/ReplyBtns").gameObject.SetActive(false); base.transform.Find("ActionBtns/TalkBtn").gameObject.SetActive(flag3); base.transform.Find("ActionBtns/AddFriendBtn").gameObject.SetActive(flag); base.transform.Find("ActionBtns/ReplyBtns").gameObject.SetActive(flag2); base.transform.Find("ActionBtns").gameObject.SetActive(flag4); }
public void SetupView(FriendBriefDataItem friendData, bool selected, Action <FriendBriefDataItem> onFrameClick = null, Action <FriendBriefDataItem> onIconClick = null) { this._friendData = friendData; bool flag = Singleton <FriendModule> .Instance.IsMyFriend(this._friendData.uid); this._isFrozen = Singleton <FriendModule> .Instance.isHelperFrozen(friendData.uid); if (this._isFrozen) { this._nextAvaliableTime = Singleton <FriendModule> .Instance.GetHelperNextAvaliableTime(friendData.uid); } base.transform.Find("BG/Select").gameObject.SetActive(selected); base.transform.Find("BG/Normal").gameObject.SetActive(!selected && !this._isFrozen); base.transform.Find("Grey").gameObject.SetActive(this._isFrozen); base.transform.Find("PlayerName").GetComponent <Text>().text = friendData.nickName; base.transform.Find("FriendMark/Friend").gameObject.SetActive(flag); base.transform.Find("FriendMark/Strange").gameObject.SetActive(!flag); base.transform.Find("AvatarStar").GetComponent <MonoAvatarStar>().SetupView(friendData.avatarStar); base.transform.Find("Lv").GetComponent <Text>().text = "LV." + friendData.level; base.transform.Find("SelectMark").gameObject.SetActive(selected); base.transform.Find("PlayerIcon").GetComponent <Image>().sprite = Miscs.GetSpriteByPrefab(this._friendData.AvatarIconPath); base.transform.Find("FriendPoint/Value").GetComponent <Text>().text = this.GetAddFP(flag).ToString(); base.transform.Find("Btns/FrameBtn").gameObject.SetActive(!this._isFrozen); base.transform.Find("FriendPoint").gameObject.SetActive(!this._isFrozen); base.transform.Find("RemainTimer").gameObject.SetActive(this._isFrozen); if (this._isFrozen) { base.transform.Find("RemainTimer/Time").GetComponent <MonoRemainTimer>().SetTargetTime(this._nextAvaliableTime, null, new Action(this.OnFrozenTimeOutCallBack), false); } this._onFrameClick = onFrameClick; this._onIconClick = onIconClick; }
private bool OnGetFriendListRsp(GetFriendListRsp rsp) { if (rsp.get_retcode() == null) { if (rsp.get_is_whole_dataSpecified() && rsp.get_is_whole_data()) { this._friendsBriefInfoDict.Clear(); this.friendsList.Clear(); } for (int i = 0; i < rsp.get_friend_list().Count; i++) { PlayerFriendBriefData briefData = rsp.get_friend_list()[i]; FriendBriefDataItem item = new FriendBriefDataItem(briefData); if (this._friendsBriefInfoDict.ContainsKey(item.uid)) { this.friendsList.Remove(this._friendsBriefInfoDict[item.uid]); this.friendsList.Insert(0, item); } else { this.friendsList.Add(item); } this._friendsBriefInfoDict[item.uid] = item; this._playerBriefInfoCacheDict[item.uid] = new CacheData <FriendBriefDataItem>(item); } } return(false); }
private bool OnGetRecommandFriendListRsp(GetRecommendFriendListRsp rsp) { this.recommandedPlayerList.Clear(); this.helperStrangerList.Clear(); for (int i = 0; i < rsp.get_recommend_list().Count; i++) { PlayerFriendBriefData briefData = rsp.get_recommend_list()[i]; if (!this._friendsBriefInfoDict.ContainsKey((int)briefData.get_uid())) { FriendBriefDataItem item = new FriendBriefDataItem(briefData); if (i < MiscData.Config.BasicConfig.RecommendFriendListNum) { this.recommandedPlayerList.Add(item); } else { this.helperStrangerList.Add(item); } this._playerBriefInfoCacheDict[item.uid] = new CacheData <FriendBriefDataItem>(item); } } if (this.helperStrangerList.Count == 0) { this.helperStrangerList.AddRange(this.recommandedPlayerList); } return(false); }
public void SetupView(FriendBriefDataItem friendBriefData, bool hasNewMessage, ChangeTalkingFriend onChangeTalkingFriend = null) { this._friendBriefData = friendBriefData; this._onChangeTalkingFriendClick = onChangeTalkingFriend; this.hasNewMessage = hasNewMessage; base.transform.Find("FriendBtn/Image").gameObject.SetActive(hasNewMessage); }
private void OnChangeTalkingFriendClick(FriendBriefDataItem data) { this._isFriendListShow = false; base.view.transform.Find("Dialog/Content/FriendListPanel/FriendList").GetComponent <MonoFriendChatList>().CloseFriendChatList(); this._talkingFriendUid = data.uid; this._friendTabManager.ShowTab(data.uid.ToString()); this.RefreshMode(Mode.Friend); }
private void OnRejectBtnClick(FriendBriefDataItem friendBriefData) { Singleton <FriendModule> .Instance.RemoveFriendInfo(FriendTab.RequestListTab, friendBriefData.uid); this.SetupRequestListTab(); this.PlayCurrentTabAnim(); Singleton <NetworkManager> .Instance.RequestRejectFriend(friendBriefData.uid); }
public FriendBriefDataItem GetOneStrangeHelper() { FriendBriefDataItem item = this.helperStrangerList.Find(x => !this.isHelperFrozen(x.uid) && !this._friendsBriefInfoDict.ContainsKey(x.uid)); if (item == null) { Singleton <NetworkManager> .Instance.RequestRecommandFriendList(); } return(item); }
private void OnFriendTabSetActive(bool active, GameObject go, Button btn) { MonoFriendChatInfo component = btn.transform.parent.GetComponent <MonoFriendChatInfo>(); if (active) { FriendBriefDataItem friendData = component.GetFriendData(); if (friendData != null) { Singleton <ChatModule> .Instance.SetFriendMsgRead(friendData.uid); component.SetNewMessageTipShow(false); } } component.RefreshNickName(); }
private void OnDetailBtnClick(FriendBriefDataItem friendBriefData) { Singleton <FriendModule> .Instance.MarkFriendAsOld(friendBriefData.uid); FriendDetailDataItem detailData = Singleton <FriendModule> .Instance.TryGetFriendDetailData(friendBriefData.uid); if (detailData == null) { this._playerUidToShow = friendBriefData.uid; Singleton <NetworkManager> .Instance.RequestFriendDetailInfo(friendBriefData.uid); } else { this.ShowFriendDetailInfo(detailData); } }
private void SetupLvUpTab() { GameObject gameObject = base.view.transform.Find("LvUpTab").gameObject; Button component = base.view.transform.Find("TabBtns/LvUpTabBtn").GetComponent <Button>(); component.transform.Find("Text").GetComponent <LocalizedText>().TextID = "Menu_Detail"; component.transform.Find("PopUp").gameObject.SetActive(false); this._tabManager.SetTab("LvUpTab", component, gameObject); gameObject.GetComponent <MonoAvatarDetailLvUpTab>().SetupView(this.userData); FriendBriefDataItem item = Singleton <FriendModule> .Instance.TryGetFriendBriefData(this.userData.uid); if (item != null) { base.view.transform.Find("AvatarDetailProfile/Info/CombatNumText").GetComponent <Text>().text = item.avatarCombat.ToString(); } }
private void OnFriendScrollChange(Transform trans, int index) { if (this._mode == Mode.Friend) { int targetUid = Singleton <ChatModule> .Instance.GetSortedChatFriendList()[index]; FriendBriefDataItem friendBriefData = Singleton <FriendModule> .Instance.TryGetFriendBriefData(targetUid); trans.Find("FriendBtn/Name").GetComponent <Text>().text = friendBriefData.nickName; MonoFriendChatInfo component = trans.GetComponent <MonoFriendChatInfo>(); bool friendMsgNewState = Singleton <ChatModule> .Instance.GetFriendMsgNewState(friendBriefData.uid); bool flag2 = friendBriefData.uid == this._talkingFriendUid; bool hasNewMessage = friendMsgNewState && !flag2; component.SetupView(friendBriefData, hasNewMessage, new ChangeTalkingFriend(this.OnChangeTalkingFriendClick)); MonoGridScroller scroller = base.view.transform.Find("Dialog/Content/ChatList/ScrollView").GetComponent <MonoGridScroller>(); Button btn = trans.Find("FriendBtn").GetComponent <Button>(); this._friendTabManager.SetTab(friendBriefData.uid.ToString(), btn, scroller.gameObject); } }
private bool OnDelFriendNotify(DelFriendNotify rsp) { int num = (int)rsp.get_target_uid(); FriendBriefDataItem item = null; foreach (FriendBriefDataItem item2 in this.friendsList) { if (item2.uid == num) { item = item2; break; } } if (item != null) { this.friendsList.Remove(item); } this._friendsBriefInfoDict.Remove((int)rsp.get_target_uid()); return(false); }
private bool OnGetAskAddFriendListRsp(GetAskAddFriendListRsp rsp) { if (rsp.get_retcode() == null) { bool flag = this._askingDict.Count <= 0; for (int i = 0; i < rsp.get_ask_list().Count; i++) { PlayerFriendBriefData briefData = rsp.get_ask_list()[i]; FriendBriefDataItem item = new FriendBriefDataItem(briefData); if (this._askingDict.ContainsKey(item.uid)) { this.askingList.Remove(this._askingDict[item.uid]); this.askingList.Insert(0, item); } else { this.askingList.Add(item); } this._askingDict[item.uid] = item; this._playerBriefInfoCacheDict[item.uid] = new CacheData <FriendBriefDataItem>(item); } if (flag) { HashSet <int> set = new HashSet <int>(); foreach (int num2 in Singleton <MiHoYoGameData> .Instance.LocalData.OldRequestUIDSet) { if (this._askingDict.ContainsKey(num2)) { set.Add(num2); } } if (set.Count > 0) { Singleton <MiHoYoGameData> .Instance.LocalData.OldRequestUIDSet.ExceptWith(set); Singleton <MiHoYoGameData> .Instance.Save(); } } } return(false); }
private List <FriendBriefDataItem> GetHelperList() { List <FriendBriefDataItem> list = new List <FriendBriefDataItem>(); FriendBriefDataItem oneStrangeHelper = Singleton <FriendModule> .Instance.GetOneStrangeHelper(); List <FriendBriefDataItem> friendsList = Singleton <FriendModule> .Instance.friendsList; List <FriendBriefDataItem> collection = new List <FriendBriefDataItem>(); List <FriendBriefDataItem> list4 = new List <FriendBriefDataItem>(); foreach (FriendBriefDataItem item2 in friendsList) { if (Singleton <FriendModule> .Instance.isHelperFrozen(item2.uid)) { list4.Add(item2); } else { collection.Add(item2); } } if (< > f__am$cache8 == null) {
private void OnScrollerChange(string key, List <FriendBriefDataItem> list, Transform trans, int index) { FriendBriefDataItem friendBriefData = list[index]; trans.GetComponent <MonoFriendInfo>().SetupView(friendBriefData, key.ToEnum <FriendTab>(FriendTab.FriendListTab), new RequestCallBack(this.OnRequestBtnClick), new AcceptCallBack(this.OnAcceptBtnClick), new RejectCallBack(this.OnRejectBtnClick), new DetailCallBack(this.OnDetailBtnClick)); }