Example #1
0
 protected void otherUserInfoToFriendCell(UIFriendCell friendCell, OtherUserInfo otherUserInfo)
 {
     friendCell.userHead.textureName = otherUserInfo.hi.ToString();
     friendCell.userName.text        = otherUserInfo.n;
     friendCell.userLevel.text       = otherUserInfo.lv.ToString();
     friendCell.userVIPLevel.text    = otherUserInfo.vipLv.ToString();
     friendCell.userRank.text        = Core.Data.stringManager.getString(6081) + otherUserInfo.r.ToString();
     friendCell.setRoleIcons(otherUserInfo.p);
     friendCell.otherUserInfo = otherUserInfo;
 }
Example #2
0
//	protected void setOtherUserDataListToFriendCell(ShowType showType)
//	{
//		List<OtherUserData> otherUserInfoConfig = null;
//		if(showType == ShowType.Friend)
//		{
//			otherUserInfoConfig = Core.Data.FriendManager.getFriendConfig();
//		}
//		else
//		{
//			otherUserInfoConfig = Core.Data.FriendManager.getSuDiConfig();
//		}
//		if(otherUserInfoConfig == null || otherUserInfoConfig.Count == 0)
//		{
//			return;
//		}
//
//		setFriendCell(showType, otherUserInfoConfig);
//	}

    public void setCell(ShowType showType, List <OtherUserInfo> otherUserInfoList)
    {
        UITable table = null;

        UIFriendCell.FriendCellType friendCellType = UIFriendCell.FriendCellType.None;

        this.currentShowType = showType;

        // 该页显示的个数
        int count = FriendManager.pageShowListItemCount;
        int start = 0;

        if (showType == ShowType.Friend)
        {
            table            = this.friendTable;
            friendCellType   = UIFriendCell.FriendCellType.FriendCell;
            this.listCount   = Core.Data.FriendManager.friendListCount;
            this.currentPage = Core.Data.FriendManager.friendListCurrentPage;
            this.pageCount   = Core.Data.FriendManager.friendListPageCount;
        }
        else if (showType == ShowType.SuDi)
        {
            table            = this.suDiTable;
            friendCellType   = UIFriendCell.FriendCellType.SuDiCell;
            this.listCount   = Core.Data.FriendManager.suDiListCount;
            this.currentPage = Core.Data.FriendManager.suDiListCurrentPage;
            this.pageCount   = Core.Data.FriendManager.suDiListPageCount;
        }
        else if (showType == ShowType.Request)
        {
            table            = this.requestTable;
            friendCellType   = UIFriendCell.FriendCellType.RequestCell;
            this.listCount   = Core.Data.FriendManager.requestFriendListCount;
            this.currentPage = Core.Data.FriendManager.requestFriendListCurrentPage;
            this.pageCount   = Core.Data.FriendManager.requestFriendListPageCount;
        }
        else if (showType == ShowType.Search)
        {
            table          = this.searchTable;
            friendCellType = UIFriendCell.FriendCellType.SearchCell;
        }

        if (this.currentPage == 1)
        {
            this.upPageButton.SetActive(false);
        }

        if (this.currentPage == pageCount)
        {
            this.downPageButton.SetActive(false);
            count = this.listCount - (this.currentPage - 1) * FriendManager.pageShowListItemCount;
        }

        while (table.transform.childCount > 0)
        {
            GameObject g = table.transform.GetChild(0).gameObject;
            g.transform.parent = null;
            Destroy(g);
        }
        table.Reposition();

        start = FriendManager.pageShowListItemCount * (this.currentPage - 1);

        for (int i = start; i < count; i++)
        {
            OtherUserInfo otherUserInfo = otherUserInfoList[i];
            UIFriendCell  friendCell    = this.getFriendCellObj(table.transform);
            friendCell.CurrentFriendCellType = friendCellType;

            this.otherUserInfoToFriendCell(friendCell, otherUserInfo);
        }
        table.Reposition();
    }