public void SelectPlayerListItem(PlayerListItemLogic selectItem) { if (null == selectItem) { if (m_ButtonWindow != null) { m_ButtonWindow.SetPlayerListItemInfo(GlobeVar.INVALID_GUID, GlobeVar.INVALID_ID, "", PlayerListItemLogic.PlayerListItemType.Invalid); } m_SelectPlayerItem = null; // if (m_TeamMemberSceneInfo != null) // { // m_TeamMemberSceneInfo.SetActive(false); // } return; } if (m_SelectPlayerItem != null) { m_SelectPlayerItem.OnCancelSelectItem(); } m_SelectPlayerItem = selectItem; m_SelectPlayerItem.OnSelectItem(); if (m_ButtonWindow != null) { m_ButtonWindow.SetPlayerListItemInfo(m_SelectPlayerItem.GUID, m_SelectPlayerItem.TeamID, m_SelectPlayerItem.m_PlayerName, m_SelectPlayerItem.ItemType); } UpdateTeamMemberScenePos(selectItem.TeamPosIndex); }
//public void UpdateSelectState(PlayerListItemLogic selectItem) //{ // foreach (PlayerListItemLogic item in friendListGrid.GetComponentsInChildren<PlayerListItemLogic>()) // { // if (null == selectItem || selectItem != item) // { // item.OnSelected(false); // } // } //} public void OnClickPlayerListItem(PlayerListItemLogic selectItem) { if (selectItem == null) { LogModule.ErrorLog("OnClickPlayerListItem::selectItem = null"); return; } SelectPlayerListItem(selectItem); }
void OnEnable() { GUIData.delFriendDataUpdate += UpdateData; m_SelectPlayerItem = null; SelectPlayerListItem(null); //UpdateData(); //向服务器申请更新好友列表 m_TabController.ChangeTab("0"); //打开的时候默认为好友 //UpdateData(); }
void OnLoadBlackItem(GameObject resItem, object param) { if (null == resItem) { LogModule.ErrorLog("load friend item fail"); return; } //Utils.CleanGrid(friendListGrid); //填充好友信息 int nPlayerListItemIndex = 0; GameManager.gameManager.PlayerDataPool.BlackList.SortByRelationState((int)CharacterDefine.RELATION_TYPE.ONLINE); foreach (KeyValuePair <UInt64, Relation> _relation in GameManager.gameManager.PlayerDataPool.BlackList.RelationDataList) { //GameObject newPlayerListItem = Utils.BindObjToParent(resItem, friendListGrid, nPlayerListItemIndex.ToString()); //newPlayerListItem.GetComponent<PlayerListItemLogic>().InitPlayerListItemInfoBlack(_relation.Value); PlayerListItemLogic PlayerListItem = PlayerListItemLogic.CreateItem(friendListGrid, resItem, nPlayerListItemIndex.ToString(), this); if (PlayerListItem == null) { continue; } PlayerListItem.InitPlayerListItemInfoBlack(_relation.Value); if (m_SelectPlayerItem == null) { SelectPlayerListItem(PlayerListItem); } nPlayerListItemIndex++; } friendListGrid.GetComponent <UIGrid>().Reposition(); //隐藏好友人数 showFriendStr(1); hideOtherWindows(); //ShowFrinedNum(false); }
public void SelectPlayerListItem(PlayerListItemLogic selectItem) { if (null == selectItem) { if (m_ButtonWindow != null) { m_ButtonWindow.SetPlayerListItemInfo(GlobeVar.INVALID_GUID, GlobeVar.INVALID_ID, "", PlayerListItemLogic.PlayerListItemType.Invalid); } m_SelectPlayerItem = null; return; } if (m_SelectPlayerItem != null) { m_SelectPlayerItem.OnCancelSelectItem(); } m_SelectPlayerItem = selectItem; m_SelectPlayerItem.OnSelectItem(); if (m_ButtonWindow != null) { m_ButtonWindow.SetPlayerListItemInfo(selectItem.GUID, selectItem.TeamID, selectItem.m_PlayerName, selectItem.ItemType); } }
public static PlayerListItemLogic CreateItem(GameObject grid, GameObject resItem, string name, RelationTeamWindow parent) { if (null == resItem) { LogModule.ErrorLog("PlayerListItemLogic Create resItem is null_2"); return(null); } GameObject curItem = Utils.BindObjToParent(resItem, grid, name); if (null != curItem) { PlayerListItemLogic curItemComponent = curItem.GetComponent <PlayerListItemLogic>(); if (null != curItemComponent) { curItemComponent.SetParent(parent); } return(curItemComponent); } return(null); }
void OnLoadHateItem(GameObject resItem, object param) { if (null == resItem) { LogModule.ErrorLog("load friend item fail"); return; } //填充好友信息 int nPlayerListItemIndex = 0; GameManager.gameManager.PlayerDataPool.HateList.SortByRelationState((int)CharacterDefine.RELATION_TYPE.ONLINE); foreach (KeyValuePair <UInt64, Relation> _relation in GameManager.gameManager.PlayerDataPool.HateList.RelationDataList) { PlayerListItemLogic PlayerListItem = PlayerListItemLogic.CreateItem(friendListGrid, resItem, nPlayerListItemIndex.ToString(), this); if (PlayerListItem == null) { continue; } PlayerListItem.InitPlayerListItemInfoHate(_relation.Value); if (m_SelectPlayerItem == null) { SelectPlayerListItem(PlayerListItem); } nPlayerListItemIndex++; } friendListGrid.GetComponent <UIGrid>().Reposition(); m_lotDeleteBtn.SetActive(true); //隐藏好友人数 showFriendStr(2); hideOtherWindows(); // ShowFrinedNum(false); }
void OnDisable() { GUIData.delFriendDataUpdate -= UpdateData; m_SelectPlayerItem = null; SelectPlayerListItem(null); }
void OnLoadFriendItem(GameObject resItem, object param) { if (null == resItem) { LogModule.ErrorLog("load friend item fail"); return; } Utils.CleanGrid(friendListGrid); int nPlayerListItemIndex = 0; GameManager.gameManager.PlayerDataPool.FriendList.SortByRelationState((int)CharacterDefine.RELATION_TYPE.ONLINE); //先排在线的 foreach (KeyValuePair <UInt64, Relation> _relation in GameManager.gameManager.PlayerDataPool.FriendList.RelationDataList) { // if (_relation.Key == GlobeVar.INVALID_GUID) // { // continue; // } // //如果离线,则不排 // if (_relation.Value.State == (int)CharacterDefine.RELATION_TYPE.OFFLINE) // { // continue; // } //GameObject newPlayerListItem = Utils.BindObjToParent(resItem, friendListGrid, nPlayerListItemIndex.ToString()); //newPlayerListItem.GetComponent<PlayerListItemLogic>().InitPlayerListItemInfoFriend(_relation.Value); PlayerListItemLogic PlayerListItem = PlayerListItemLogic.CreateItem(friendListGrid, resItem, nPlayerListItemIndex.ToString(), this); if (PlayerListItem == null) { continue; } PlayerListItem.InitPlayerListItemInfoFriend(_relation.Value); if (m_SelectPlayerItem == null) { SelectPlayerListItem(PlayerListItem); } nPlayerListItemIndex++; } //再排离线的 // foreach (KeyValuePair<UInt64, Relation> _relation in GameManager.gameManager.PlayerDataPool.FriendList.RelationDataList) // { // if (_relation.Key == GlobeVar.INVALID_GUID) // { // continue; // } // // //如果在线,则不排 // if (_relation.Value.State == (int)CharacterDefine.RELATION_TYPE.ONLINE) // { // continue; // } // // //GameObject newPlayerListItem = Utils.BindObjToParent(resItem, friendListGrid, nPlayerListItemIndex.ToString()); // //newPlayerListItem.GetComponent<PlayerListItemLogic>().InitPlayerListItemInfoFriend(_relation.Value); // PlayerListItemLogic PlayerListItem = PlayerListItemLogic.CreateItem(friendListGrid, resItem, nPlayerListItemIndex.ToString(), this); // if (PlayerListItem == null) // { // continue; // } // PlayerListItem.InitPlayerListItemInfoFriend(_relation.Value); // if (m_SelectPlayerItem == null) // { // SelectPlayerListItem(PlayerListItem); // } // nPlayerListItemIndex++; // } if (friendListGrid != null && friendListGrid.GetComponent <UIGrid>() != null) { friendListGrid.GetComponent <UIGrid>().Reposition(); } //显示好友人数 // ShowFrinedNum(true); showFriendStr(0); }