Exemplo n.º 1
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.º 2
0
	private void UpdateStack (string gameID, string stack)
	{
		foreach (GameObject go in cashGameObjectList) {
			CashGameObject cgo = go.GetComponent<CashGameObject> ();

			if (cgo.gameID.Equals (gameID)) {
				GameData gd = gameInfo.gameList [cgo.index];

				long smallBlind = long.Parse (stack.Split ('/') [0]);
				gd.small_blind = smallBlind;

				cgo.txtStake.text = Utility.GetCommaSeperatedAmount (smallBlind) + "/" + Utility.GetCommaSeperatedAmount (smallBlind * 2);
			}
		}
	}
Exemplo n.º 3
0
	private void UpdatePlayersCount (string gameID, int totalPlayers)
	{
		totalPlayers = totalPlayers < 0 ? 0 : totalPlayers;

		foreach (GameObject go in cashGameObjectList) {
			CashGameObject cgo = go.GetComponent<CashGameObject> ();
//			DebugLog.Log (".... "+gameID +" == "+cgo.gameID);
			if (cgo.gameID.Equals (gameID)) {
				GameData gd = gameInfo.gameList [cgo.index];
				gd.users = totalPlayers;
				cgo.txtPlayers.text = gd.users + "/" + gd.maximum_players; 
//				DebugLog.Log (".... "+gameID +" == "+cgo.txtPlayers.text.ToString());
				break;
			}
		}
	}