private void ManageGetGamesAnswer(PacketGetGameAnswer packet) { if (m_lines != null && m_lines.Count > 0) { foreach (var line in m_lines) { Destroy(line.Value); } } m_lines = new Dictionary <uint, GameObject>(); foreach (var gameId in packet.GamesIds) { GameObject newGame = Instantiate(GameLinePrefab); m_lines.Add(gameId, newGame); newGame.transform.SetParent(GamesHolder.transform); Text gameBtnText = newGame.GetComponentInChildren <Text>(); if (gameBtnText) { gameBtnText.text = $"Game {gameId}"; } Button gameBtn = newGame.GetComponent <Button>(); if (gameBtn) { gameBtn.onClick.AddListener(delegate { OnClickJoinGames(gameId); }); } } }
private void ManageGetGameAnswerPacket(PacketGetGameAnswer packet) { Console.WriteLine("Game availables : " + packet.GamesIds.Count); }