public List <RetGameServerPageEntity> GetGameServerPageList()
    {
        List <GameServerEntity>        list     = this.GetList(isDesc: false);
        List <RetGameServerPageEntity> pageList = new List <RetGameServerPageEntity>();
        int pageIndex = 1;

        for (int i = 1; i <= list.Count; i++)
        {
            if (i % 10 == 0)
            {
                RetGameServerPageEntity entity = new RetGameServerPageEntity();
                entity.PageIndex = pageIndex;
                entity.Name      = string.Format("{0}-{1}", i - 9, i);
                pageIndex++;
                pageList.Add(entity);
            }
            else if (i == list.Count && i % 10 != 0)
            {
                RetGameServerPageEntity entity = new RetGameServerPageEntity();
                entity.PageIndex = pageIndex;
                entity.Name      = string.Format("{0}-{1}", i - (i % 10) + 1, i);
                pageIndex++;
                pageList.Add(entity);
            }
        }
        return(pageList);
    }
Exemplo n.º 2
0
 /// <summary>
 /// ÉèÖÃҳǩÍø¸ñ
 /// </summary>
 /// <param name="pageList"></param>
 public void SetGameServerPageGrid(List <RetGameServerPageEntity> pageList)
 {
     if (pageList != null)
     {
         for (int i = 0; i < pageList.Count + 1; i++)
         {
             GameObject go = Instantiate(m_GameServerPagePrefab);
             go.transform.SetParent(m_GameServerPageGrid.transform);
             go.transform.localPosition = Vector3.zero;
             go.transform.localScale    = Vector3.one;
             UIGameServerPageView pageView = go.GetComponent <UIGameServerPageView>();
             if (pageView != null)
             {
                 if (i == 0)
                 {
                     RetGameServerPageEntity entity = new RetGameServerPageEntity();
                     entity.Name = "ÍƼö·þÎñÆ÷";
                     pageView.SetUI(entity);
                 }
                 else
                 {
                     pageView.OnClickGameServerPage = OnClickGameServerPage;
                     pageView.SetUI(pageList[i - 1]);
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
    public List <RetGameServerPageEntity> GetGameServerPageList(string condition)
    {
        List <RetGameServerPageEntity> lst = new List <RetGameServerPageEntity>();

        List <GameServerEntity> gameServerLst = GetList(condition: condition, isDesc: false);

        int pageIndex = 1;
        RetGameServerPageEntity entity = null;

        for (int i = 0; i < gameServerLst.Count; i++)
        {
            //每10个服 一组
            if (i % 10 == 0)
            {
                //10个一组的第一个
                entity           = new RetGameServerPageEntity();
                entity.PageIndex = pageIndex;
                pageIndex++;
                entity.Name = gameServerLst[i].Id.ToString();
                lst.Add(entity);
            }
            if ((i + 1) % 10 == 0 || i == gameServerLst.Count - 1)
            {
                //10个一组的最后一个
                if (entity != null)
                {
                    entity.Name += " - " + gameServerLst[i].Id.ToString() + "服";
                }
            }
        }

        return(lst.OrderByDescending(p => p.PageIndex).ToList());
    }
Exemplo n.º 4
0
 public void SetUI(RetGameServerPageEntity retGameServerPageEntity)
 {
     m_pageIndx = retGameServerPageEntity.PageIndex;
     m_gameServerPageName.text = retGameServerPageEntity.Name;
 }
Exemplo n.º 5
0
 public void SetUI(RetGameServerPageEntity entity)
 {
     m_PageIndex = entity.PageIndex;
     m_GameServerPageName.text = entity.Name;
 }