예제 #1
0
 //初始化服务器列表
 private void InistServerList()
 {
     if (isInist)
     {
         return;
     }
     for (int i = 0; i < serverNum; i++)
     {
         int n = Random.Range(0, 100);
         if (n <= 50)
         {
             //流畅
             inistGO = NGUITools.AddChild(gridParent, serverGreenPrefab);
             inistGO.transform.SetParent(gridParent.transform);
         }
         else
         {
             //火爆
             inistGO = NGUITools.AddChild(gridParent, serverRedPrefab);
             inistGO.transform.SetParent(gridParent.transform);
         }
         ServerPropety sp = inistGO.GetComponent <ServerPropety>();
         sp.ServerName   = (i + 1) + "区 龙叩首";
         sp.playerNumber = n;
         sp.ip           = "127.0.0.1:9080";
     }
     isInist = true;
 }
예제 #2
0
 public void OnServerButtonClick(GameObject serverGo)
 {
     sp = serverGo.GetComponent <ServerPropety>();
     selectedServer.GetComponent <UISprite>().spriteName = serverGo.GetComponent <UISprite>().spriteName;
     selectedServer.transform.GetChild(0).GetComponent <UILabel>().text  = sp.ServerName;
     selectedServer.transform.GetChild(0).GetComponent <UILabel>().color = serverGo.transform.GetChild(0).GetComponent <UILabel>().color;
 }