void ShowBtns(PanelElementDataModel friendData) { if (m_btnType == ButtonType.AddFriend) { DeleteFriendBtn.gameObject.SetActive(false); JoinTeamBtn.gameObject.SetActive(false); SureBtn.gameObject.SetActive(true); TurnDownBtn.gameObject.SetActive(true); SendMsgBtn.gameObject.SetActive(false); } else { DeleteFriendBtn.gameObject.SetActive(true); SureBtn.gameObject.SetActive(false); TurnDownBtn.gameObject.SetActive(false); if (GameManager.Instance.CurrentState == GameManager.GameState.GAME_STATE_PLAYERROOM) { SendMsgBtn.gameObject.SetActive(false); JoinTeamBtn.gameObject.SetActive(false); } else { SendMsgBtn.gameObject.SetActive(true); if (friendData.sMsgRecvAnswerFriends_SC.IsOnLine && GetTeamType(friendData.sMsgRecvAnswerFriends_SC.dwTeamType) == TeamType.TeamLeader) { JoinTeamBtn.gameObject.SetActive(true); } else { JoinTeamBtn.gameObject.SetActive(false); } } } }
void ResetPageInfo() { //TraceUtil.Log("刷新好友面板,好友个数:"+FriendDataManager.Instance.GetFriendListData.Count); for (int i = 0; i < MyFriendPanelList.Count; i++) { PanelElementDataModel friendData = FriendDataManager.Instance.GetFriendListData.FirstOrDefault(P => P.PositionID == (CurrentPage - 1) * 4 + i); if (friendData == null) { friendData = FriendDataManager.Instance.GetRequestListData.FirstOrDefault(P => P.PositionID == CurrentPage * i); } if (friendData == null) { //MyFriendPanelList[i].gameObject.SetActive(false); MyFriendPanelList[i].SetElementActive(false); } else { //MyFriendPanelList[i].gameObject.SetActive(true); MyFriendPanelList[i].SetElementActive(true); MyFriendPanelList[i].SetAttribute(friendData); } } Color enabelColor = new Color(1, 1, 1, 1); Color disabelColor = new Color(1, 1, 1, 0.3f); LastPageBtn.BackgroundSprite.color = (CurrentPage > 1?enabelColor:disabelColor); int MaxItemID = 1; FriendDataManager.Instance.GetFriendListData.ApplyAllItem(P => MaxItemID = P.PositionID > MaxItemID?P.PositionID:MaxItemID); MaxItemID++; NextPageBtn.BackgroundSprite.color = (MaxItemID / 4 + (MaxItemID % 4 > 0 ? 1 : 0)) > CurrentPage ? enabelColor : disabelColor; PageLabel.SetText(string.Format("{0}/{1}", CurrentPage, MaxItemID / 4 + (MaxItemID % 4 > 0 ? 1 : 0))); RoleNumber.SetText(string.Format("{0}/{1}", FriendDataManager.Instance.GetFriendListData.Count, 30)); }
private void CreateItem(PanelElementDataModel data, FriendBtnType type) { GameObject item = UI.CreatObjectToNGUI.InstantiateObj(FriendItemPrefab, Grid.transform); FriendItem_V3 friendItem = item.GetComponent <FriendItem_V3>(); friendItem.Init(data.sMsgRecvAnswerFriends_SC, type, DeleteFriendItemCallBack); m_FriendList.Add(friendItem); }
private void InitFriendUI(PanelElementDataModel element) { //GameObject friendPanel = CreatObjectToNGUI.InstantiateObj(FriendPanelPrefab, Grid); //FriendElement friendBehaviour = friendPanel.GetComponent<FriendElement>(); //friendBehaviour.SetAttribute(element); //FriendDataManager.Instance.GetFriendListData.Find(P => P.sMsgRecvAnswerFriends_SC.dwFriendID == // element.sMsgRecvAnswerFriends_SC.dwFriendID).BtnObj = friendPanel; }
/// <summary> /// 添加好友数据 /// </summary> /// <param name="playerID">好友的ID</param> /// <param name="panelData">好友的数据</param> public void RegFriendData(PanelElementDataModel panelData) { if (panelData != null) { if (!m_friendList.Any(p => p.sMsgRecvAnswerFriends_SC.dwFriendID == panelData.sMsgRecvAnswerFriends_SC.dwFriendID)) { m_friendList.Add(panelData); } } }
//public void SetAttribute(PanelElementDataModel friendData) //{ // this.PlayerName.text = friendData.sMsgRecvAnswerFriends_SC.Name; // this.PlayerLevel.text = friendData.sMsgRecvAnswerFriends_SC.sActorLevel.ToString() + LanguageTextManager.GetString("IDS_H1_156"); // this.m_curBtnID = friendData.sMsgRecvAnswerFriends_SC.dwFriendID; // this.PlayerIcon.ChangeSprite((int)friendData.sMsgRecvAnswerFriends_SC.dProfession); // ////TODO GuideBtnManager.Instance.RegGuideButton(RightButton.gameObject, MainUI.UIType.SocialInfo, SubUIType.IncreaseFriend, out m_guideBtnID); //} public void SetAttribute(PanelElementDataModel friendData, bool IsFriend) { this.PlayerName.text = friendData.sMsgRecvAnswerFriends_SC.Name; this.PlayerLevel.text = friendData.sMsgRecvAnswerFriends_SC.sActorLevel.ToString(); this.m_curBtnID = friendData.sMsgRecvAnswerFriends_SC.dwFriendID; this.btnType = friendData.BtnType; this.PlayerProfassionIcon.ChangeSprite((int)friendData.sMsgRecvAnswerFriends_SC.dProfession); AddFriendBtn.gameObject.SetActive(!IsFriend); ResetSendBtnStatus(); }
public void SetAttribute(PanelElementDataModel friendData) { this.PlayerName.text = friendData.sMsgRecvAnswerFriends_SC.Name; this.m_curBtnID = friendData.sMsgRecvAnswerFriends_SC.dwFriendID; this.m_btnType = friendData.BtnType; this.m_curPlayerLevel = friendData.sMsgRecvAnswerFriends_SC.sActorLevel; PlayerLevel.SetText(m_curPlayerLevel.ToString()); //this.m_profession = GetProfession(friendData.sMsgRecvAnswerFriends_SC.dProfession); this.ProfessionIcon.ChangeSprite((int)friendData.sMsgRecvAnswerFriends_SC.dProfession); IsOnlineIcon.ChangeSprite(friendData.sMsgRecvAnswerFriends_SC.IsOnLine?1:2); BackGruond.ChangeSprite(friendData.sMsgRecvAnswerFriends_SC.IsOnLine?1:2); ShowBtns(friendData); }
/// <summary> /// 将申请好友消息加入申请加入好友列表 /// </summary> /// <param name="playerID">申请者的ID</param> /// <param name="panelData">申请者的数据</param> public void RegRequestData(PanelElementDataModel panelData) { if (panelData == null) { return; } if (m_requestList.Exists(P => P.sMsgRecvAnswerFriends_SC.dwFriendID == panelData.sMsgRecvAnswerFriends_SC.dwFriendID)) { return; } m_requestList.Add(panelData); }
private void CreateUIListPanel(PanelElementDataModel element, int index) { if (m_panelElementList.Exists(P => P.dwFriendID == element.sMsgRecvAnswerFriends_SC.dwFriendID)) { return; } NearlyItem nearlyItem = new NearlyItem(); nearlyItem.Index = index; nearlyItem.dwFriendID = element.sMsgRecvAnswerFriends_SC.dwFriendID; nearlyItem.element = element; nearlyItem.m_isFriend = FriendDataManager.Instance.GetFriendListData.Exists(P => P.sMsgRecvAnswerFriends_SC.dwFriendID == element.sMsgRecvAnswerFriends_SC.dwFriendID); m_panelElementList.Add(nearlyItem); }
private void CreateUIListPanel(PanelElementDataModel element) { if (element.BtnType == ButtonType.FriendList) { if (FriendDataManager.Instance.GetFriendListData.Exists(P => P.sMsgRecvAnswerFriends_SC.dwFriendID == element.sMsgRecvAnswerFriends_SC.dwFriendID)) { return; } } if (element.BtnType == ButtonType.AddFriend) { if (FriendDataManager.Instance.GetRequestListData.Exists(P => P.sMsgRecvAnswerFriends_SC.dwFriendID == element.sMsgRecvAnswerFriends_SC.dwFriendID)) { return; } } //GameObject friendPanel = CreatObjectToNGUI.InstantiateObj(FriendPanelPrefab, Grid); //FriendElement friendBehaviour = friendPanel.GetComponent<FriendElement>(); //friendBehaviour.SetAttribute(element); //element.BtnObj = friendPanel; if (element.BtnType == ButtonType.FriendList) { FriendDataManager.Instance.RegFriendData(element); } else { ///当申请好友数量大于或等于最大值时,删除最先申请的 if (FriendDataManager.Instance.GetRequestListData.Count >= 15) { //Destroy(FriendDataManager.Instance.GetAddFriendData[0].BtnObj); FriendDataManager.Instance.GetRequestListData.RemoveAt(0); } //friendBehaviour.IsShowEmailIcon(true); FriendDataManager.Instance.IsUpdateMsgNum = true; FriendDataManager.Instance.RegRequestData(element); } }
/// <summary> /// 打开 /// </summary> /// <param name="notifyArgs"></param> private void ShowNearlyPlayerHandle(INotifyArgs notifyArgs) { StopAllCoroutines(); if (LoadingUI.Instance != null) { LoadingUI.Instance.Close(); } NearlySMsgGetActorListHead = (SMsgGetActorListHead)notifyArgs; m_panelElementList.Clear(); for (int i = 0; i < NearlySMsgGetActorListHead.dwFriendNum; i++) { PanelElementDataModel playerElementData = new PanelElementDataModel(); playerElementData.sMsgRecvAnswerFriends_SC.dwFriendID = NearlySMsgGetActorListHead.sMsgRecvAnswerFriends_SC[i].dwFriendID; playerElementData.sMsgRecvAnswerFriends_SC.szName = NearlySMsgGetActorListHead.sMsgRecvAnswerFriends_SC[i].szName; playerElementData.sMsgRecvAnswerFriends_SC.sActorLevel = NearlySMsgGetActorListHead.sMsgRecvAnswerFriends_SC[i].sActorLevel; playerElementData.sMsgRecvAnswerFriends_SC.bOnLine = NearlySMsgGetActorListHead.sMsgRecvAnswerFriends_SC[i].bOnLine; playerElementData.sMsgRecvAnswerFriends_SC.dProfession = NearlySMsgGetActorListHead.sMsgRecvAnswerFriends_SC[i].dProfession; playerElementData.BtnType = ButtonType.NearlyPlayer; //TraceUtil.Log("附近玩家列表=====>>>>>.dProfession" + sMsgGetActorListHead.sMsgRecvAnswerFriends_SC[i].dProfession); if (!m_panelElementList.Exists(P => P.dwFriendID == playerElementData.sMsgRecvAnswerFriends_SC.dwFriendID)) { NearlyItem nearlyItem = new NearlyItem(); nearlyItem.Index = i; nearlyItem.dwFriendID = playerElementData.sMsgRecvAnswerFriends_SC.dwFriendID; nearlyItem.element = playerElementData; nearlyItem.m_isFriend = FriendDataManager.Instance.GetFriendListData.Exists(P => P.sMsgRecvAnswerFriends_SC.dwFriendID == playerElementData.sMsgRecvAnswerFriends_SC.dwFriendID); m_panelElementList.Add(nearlyItem); } } CurrentPage = 1; ResetPageInfo(); if (commonUIBottomButtonTool == null) { commonUIBottomButtonTool = CreatObjectToNGUI.InstantiateObj(UIBottomBtnPrefab, CreatBottomBtnPoint).GetComponent <UI.MainUI.CommonUIBottomButtonTool>(); ShowBottomBtn(); } else { commonUIBottomButtonTool.ShowAnim(); } transform.localPosition = Vector3.zero; }