Пример #1
0
 void showServerList()
 {
     foreach (Server server in ListOfServer)
     {
         if (server != null)
         {
             GameObject item = Instantiate(ItemObj) as GameObject;
             RED.AddChild(item, ScrollOffset.gameObject);
             ServerItem scItem = item.GetComponent <ServerItem>();
             scItem.setItem(server);
             scItem.onClick = OnButttonClick;
         }
     }
     ScrollOffset.Reposition();
 }
Пример #2
0
    void showRecommmandList()
    {
        int curCount = ListOfRecommandServer.Count;

        if (curCount >= maxCount)
        {
            btnRecommandLeft.SetActive(true);
            btnRecommandRight.SetActive(true);

            curCount = maxCount;
        }
        else if (curCount < maxCount)
        {
            if (curCount == 0)
            {
                btnRecommandLeft.SetActive(false);
                btnRecommandRight.SetActive(false);
            }
            else
            {
                btnRecommandLeft.SetActive(true);
                btnRecommandRight.SetActive(false);
            }
        }

        for (int i = 0; i < curCount; ++i)
        {
            Server     server = ListOfRecommandServer[i];
            ServerItem scItem = null;
            if (i == 0)
            {
                txtRecommandLeft.text = server.name;
                scItem = btnRecommandLeft.GetComponent <ServerItem>();
            }
            else
            {
                txtRecommandRight.text = server.name;
                scItem = btnRecommandRight.GetComponent <ServerItem>();
            }

            scItem.setItem(server);
            scItem.onClick = OnButttonClick;
        }
    }