private void getListGamesOfRoom(RoomGame roomGame) { // TODO: can optimize lai viec find GameObject, co the dat vao CubeiaClient CubeiaClient cubeia = GameApplication.cubeia; GameObject tableListObject = GameObject.Find("TableList"); TableListControl tableListControl = (TableListControl)tableListObject.GetComponent(typeof(TableListControl)); // cubeia.tableList = new TableGame[] {}; // if (User.getInstance().roomGame.length < 1) // return; cubeia.currentRoom = roomGame; // enter room default cubeia.tableList.Clear(); tableListControl.updateListItem(cubeia.tableList); cubeia.sendSelectR(roomGame); }
private void handleTableSnapshotListPacket(TableSnapshotListPacket tableSnapshotListPacket) { unsubcribeRoom(currentRoom); tableList.Clear(); GameObject tableListObject = GameObject.Find("TableList"); TableListControl tableListControl = (TableListControl)tableListObject.GetComponent(typeof(TableListControl)); foreach (TableSnapshotPacket tableSnapshotPacket in tableSnapshotListPacket.snapshots) { TableGame tableGame = new TableGame(tableSnapshotPacket); if (tableGame.capacity > 0) { tableList.Add(tableGame); } } // update to the view tableListControl.updateListItem(tableList); }