public void SetRegularTournamentObjects(API_GameInfo games) { DestroyAllObjects(); gameInfo = games; regularTournamentObjectList = new List <GameObject> (); if (games.gameList.Count > 0) { txtMessage.text = ""; for (int i = 0; i < games.gameList.Count; i++) { GameObject o = Instantiate(objPrefab) as GameObject; o.transform.SetParent(scrollViewContent); o.transform.localScale = Vector3.one; regularTournamentObjectList.Add(o); o.transform.position = new Vector3(o.transform.position.x, o.transform.position.y, scrollViewContent.position.z); RegularTournamentObject rto = o.GetComponent <RegularTournamentObject> (); rto.txtStartDate.text = games.gameList [i].start_time; rto.txtName.text = games.gameList [i].game_name; rto.txtBuyin.text = Utility.GetCommaSeperatedAmount(games.gameList [i].buy_in); rto.txtPrizePool.text = Utility.GetCommaSeperatedAmount(games.gameList [i].prize_pool); rto.txtStatus.text = games.gameList [i].status.ToCamelCase(); rto.txtEnrolled.text = games.gameList [i].users.ToString(); rto.gameID = games.gameList [i].id; rto.imgBackground.color = new Color(0, 0, 0, i % 2 == 0 ? 0f : .25f); if (games.gameList [i].status.Equals(APIConstants.TOURNAMENT_STATUS_REGISTERING)) { rto.imgTournamentStatus.color = Color.green; } else if (games.gameList [i].status.Equals(APIConstants.TOURNAMENT_STATUS_PENDING) || games.gameList [i].status.Equals(APIConstants.TOURNAMENT_STATUS_RUNNING)) { rto.imgTournamentStatus.color = Color.yellow; } else { rto.imgTournamentStatus.color = Color.red; } rto.index = i; } } else { txtMessage.text = APIConstants.MESSAGE_NO_GAMES_FOUND; } SetContentHeight(games.gameList.Count); gameObject.SetActive(true); }
private void UpdateTournamentStatusToFinished(string gameID) { foreach (GameObject go in regularTournamentObjectList) { RegularTournamentObject rto = go.GetComponent <RegularTournamentObject> (); if (rto.gameID.Equals(gameID)) { rto.txtStatus.text = APIConstants.TOURNAMENT_STATUS_FINISHED; rto.imgTournamentStatus.color = Color.red; } } }
private void UpdateTournamentStatusToRunning(string gameID) { foreach (GameObject go in regularTournamentObjectList) { RegularTournamentObject rto = go.GetComponent <RegularTournamentObject> (); if (rto.gameID.Equals(gameID)) { rto.txtStatus.text = APIConstants.TOURNAMENT_STATUS_RUNNING; rto.imgTournamentStatus.color = Color.green; } } }
private void UpdatePrizePool(string gameID, long prizePool) { foreach (GameObject go in regularTournamentObjectList) { RegularTournamentObject sto = go.GetComponent <RegularTournamentObject> (); if (sto.gameID.Equals(gameID)) { GameData gd = gameInfo.gameList [sto.index]; gd.prize_pool = prizePool; } } tournamentDetailPanel.UpdatePrizePool(gameID); }
private void UpdatePlayersCount(string gameID, int totalPlayers) { totalPlayers = totalPlayers < 0 ? 0 : totalPlayers; foreach (GameObject go in regularTournamentObjectList) { RegularTournamentObject sto = go.GetComponent <RegularTournamentObject> (); if (sto.gameID.Equals(gameID)) { GameData gd = gameInfo.gameList [sto.index]; gd.users = totalPlayers; sto.txtEnrolled.text = gd.users + "/" + gd.maximum_players; } } tournamentDetailPanel.UpdateTournamentDetailText(gameID); }