public void UpdateInfo(WaitingRoomInfo data, bool onNextFrame = false) { if (onNextFrame) { gameInfo = data; return; } foreach (Transform child in team1) { Destroy(child.gameObject); } foreach (Transform child in team2) { Destroy(child.gameObject); } city.text = data.city; int team1Size = data.teams[0].Length; int team2Size = data.teams[1].Length; players.text = $"{team1Size + team2Size}\\{data.maxClients}"; for (int i = 0; i < team1Size; i++) { SpawnPlayerInfo(data.teams[0][i], team1); } for (int i = 0; i < team2Size; i++) { SpawnPlayerInfo(data.teams[1][i], team2); } startGame.SetActive(userID == data.host); }
private void Update() { if (gameInfo != null) { UpdateInfo(gameInfo); gameInfo = null; } }
public void Receive(Message message) { if (message.Version != 4) { return; } ControllersManager.Instance.OpenScene("Szczegóły gry"); var buffer = new ByteBuffer(message.Payload); FWaitingRoom roomInfo = FWaitingRoom.GetRootAsFWaitingRoom(buffer); currentWaitingRoom = new WaitingRoomInfo(roomInfo); prezenter?.UpdateInfo(currentWaitingRoom, true); }
public void OnOpenScene(string sceneName) { if (sceneName.Equals("Lista Gier")) { currentWaitingRoom = null; } else if (sceneName.Equals("Szczegóły gry")) { prezenter = GameObject.FindObjectOfType <WaitingRoomPrezenter>(); if (!prezenter) { throw new Exception("Can't find games list prezenter"); } if (currentWaitingRoom != null) { prezenter.UpdateInfo(currentWaitingRoom); } } }