Exemplo n.º 1
0
    private void RefreshRoomListView(JArray jarr)                                                       // 수정 좀 해야할것같이 생김
    {
        for (int i = 0; i < roomListViewContent.childCount; i++)
        {
            Destroy(roomListViewContent.GetChild(i).gameObject);
        }

        int length = jarr.Count;

        roomListViewContent.sizeDelta = new Vector2(0, 240 * length + 80);

        int number = 0;

        foreach (JObject item in jarr.Children <JObject>())
        {
            int    roomId   = (int)item.GetValue("id");
            string roomName = (string)item.GetValue("config").ToObject <JObject>().GetValue("name");

            RoomItem roomItem = Instantiate(roomItemOrigin.gameObject).GetComponent <RoomItem>();
            roomItem.SetRoomItemEvent(delegate {
                RequestEnterRoom(roomId);
            });
            roomItem.SetRoomId(roomId);
            roomItem.SetRoomName(roomName);
            roomItem.AppendTo(roomListViewContent.gameObject, number);
            number++;
        }
    }