Ejemplo n.º 1
0
    public void CreateIcons(List <ComRoomInfo> ComRoomInfos)
    {
        if (ComRoomInfos == null || ComRoomInfos.Count == 0)
        {
            Debug.LogError("MainPanel: ComRoomInfos == null || ComRoomInfos.Count == 0");
            return;
        }

        ClearIcon();

        GameObject asset = (GameObject)AssetManager.Instance.LoadPrefab("GameListItem");

        //创建 Length-1个因为已经存在一个
        for (int i = 0; i < ComRoomInfos.Count; ++i)
        {
            GameObject go = Instantiate(asset);
            go.transform.parent     = IconGrid.transform;
            go.transform.localScale = Vector3.one;
            Icons.Add(go);
            Icons[i].SetActive(false);
            ComRoomInfo room = ComRoomInfos [i];
            go.name = room.uRoomID.ToString();
            GamelistItem item  = go.GetComponent <GamelistItem> ();
            int          count = (int)room.uPeopleCount;
            if (count < 30)
            {
                item.people.text = "在线人数:空闲";
            }
            else if (count > 30 && count <= 60)
            {
                item.people.text = "在线人数:良好";
            }
            else if (count > 60 && count <= 90)
            {
                item.people.text = "在线人数:活跃";
            }
            else if (count > 90 && count <= 120)
            {
                item.people.text = "在线人数:繁忙";
            }
            else
            {
                item.people.text = "在线人数:火爆";
            }
            item.limit.text  = System.String.Format("房间限制:{0:0.00}", room.iLessPoint * 1.0 / 100);
            item.comRoomInfo = room;
            UIEventListener.Get(Icons [i]).onClick = OnIconClick;
        }
        IconGrid.repositionNow = true;
        scorllview.ResetPosition();
        StartCoroutine(process());
    }
Ejemplo n.º 2
0
 public void AddQpRoomInfo(ComRoomInfo info)
 {
     QpRoomInfoList.Add(info);
 }