示例#1
0
    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);
    }
示例#2
0
    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);
    }
示例#3
0
    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);
    }