Exemplo n.º 1
0
    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);
    }
Exemplo n.º 2
0
	public void SetCashGameObjects (API_GameInfo games)
	{
		DestroyAllObjects ();
		gameInfo = games;

		cashGameObjectList = 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;

				cashGameObjectList.Add (o);

				o.transform.position = new Vector3 (o.transform.position.x, o.transform.position.y, scrollViewContent.position.z);

				CashGameObject cgo = o.GetComponent<CashGameObject> ();
				cgo.txtName.text = games.gameList [i].name;
				cgo.txtBuyin.text = Utility.GetCommaSeperatedAmount (games.gameList [i].buy_in, games.gameList [i].money_type.Equals (APIConstants.KEY_REAL_MONEY));
				if (games.gameList [i].poker_type.Equals (APIConstants.KEY_TABLE)) {
//					double buyIn = games.gameList [i].money_type.Equals (APIConstants.KEY_PLAY_MONEY) ? Constants.TABLE_GAME_PLAY_MIN_CHIPS : Constants.TABLE_GAME_REAL_MIN_MONEY;
//					cgo.txtBuyin.text = "" + buyIn;
					cgo.txtStake.text = "--/--";
				} else {
					cgo.txtStake.text = Utility.GetCommaSeperatedAmount (games.gameList [i].small_blind, games.gameList [i].money_type.Equals (APIConstants.KEY_REAL_MONEY)) + "/" + Utility.GetCommaSeperatedAmount (games.gameList [i].small_blind * 2, games.gameList [i].money_type.Equals (APIConstants.KEY_REAL_MONEY));
				}
				cgo.txtPlayers.text = games.gameList [i].users + "/" + games.gameList [i].maximum_players;

				Color bgColor = new Color ();
				bgColor.a = i % 2 == 0 ? 0f : .25f;
				cgo.imgBackground.color = bgColor;

				cgo.gameID = games.gameList [i].id;

				cgo.index = i;
			}
		

		} else {
			txtMessage.text = APIConstants.MESSAGE_NO_GAMES_FOUND;
		}

		SetContentHeight (games.gameList.Count);

		gameObject.SetActive (true);
	}
Exemplo n.º 3
0
    private void OnGamesListReceived(WWW www)
    {
        UIManager.Instance.lobbyPanel.backgroundLoader.SetActive(false);

        debugString += "\n" + www.text;
        if (www.error != null)
        {
            DebugLog.Log(www.error);
            return;
        }

        DebugLog.LogWarning(www.text);

        API_GameInfo gameInfo = new API_GameInfo(www.text);

        if (UIManager.Instance.lobbyPanel.cashGamePanel.gameObject.activeSelf)
        {
            UIManager.Instance.lobbyPanel.cashGamePanel.loaderPanel.gameObject.SetActive(false);
            UIManager.Instance.lobbyPanel.cashGamePanel.SetCashGameObjects(gameInfo);
        }
        else if (UIManager.Instance.lobbyPanel.regularTournamentPanel.gameObject.activeSelf)
        {
            UIManager.Instance.lobbyPanel.regularTournamentPanel.loaderPanel.gameObject.SetActive(false);
            UIManager.Instance.lobbyPanel.regularTournamentPanel.SetRegularTournamentObjects(gameInfo);
        }
        else if (UIManager.Instance.lobbyPanel.sngTournamentPanel.gameObject.activeSelf)
        {
            UIManager.Instance.lobbyPanel.sngTournamentPanel.loaderPanel.gameObject.SetActive(false);
            UIManager.Instance.lobbyPanel.sngTournamentPanel.SetSngTournamentObjects(gameInfo);
        }

        if (gameInfo.next_page_url != null && gameInfo.next_page_url.Length > 0)
        {
            UIManager.Instance.lobbyPanel.nextPageUrl          = gameInfo.next_page_url;
            UIManager.Instance.lobbyPanel.btnNext.interactable = true;
        }
        else
        {
            UIManager.Instance.lobbyPanel.nextPageUrl          = "";
            UIManager.Instance.lobbyPanel.btnNext.interactable = false;
        }

        if (gameInfo.prev_page_url != null && gameInfo.prev_page_url.Length > 0)
        {
            UIManager.Instance.lobbyPanel.previousPageUrl          = gameInfo.prev_page_url;
            UIManager.Instance.lobbyPanel.btnPrevious.interactable = true;
        }
        else
        {
            UIManager.Instance.lobbyPanel.previousPageUrl          = "";
            UIManager.Instance.lobbyPanel.btnPrevious.interactable = false;
        }

        if (gameInfo.last_page != 0)
        {
            UIManager.Instance.lobbyPanel.txtCurrentPage.text = gameInfo.current_page + "/" + gameInfo.last_page;
        }
        else
        {
            UIManager.Instance.lobbyPanel.txtCurrentPage.text = "0/" + gameInfo.last_page;
        }
    }