Ejemplo n.º 1
0
    private void UpdateGamesView()
    {
        if (currentPlayerMenuData != null)
        {
            GameObject gameButtonPrefab = Resources.Load("GameButton") as GameObject;
            RemoveAllGames();
            foreach (PlayerMenuGamesDataContainer game in currentPlayerMenuData.games)
            {
                GameObject           gameButton = Instantiate(gameButtonPrefab);
                GameButtonController controller = gameButton.GetComponent <GameButtonController>();
                controller.OnClick += (gameid) => {
                    LoggedInUser.Instance.currentGameId = gameid;
                    SceneManager.LoadScene("Match/Match");
                };
                controller.GameId = game.gameid;
                Vector3 localScale = gameButton.transform.localScale;

                gameButton.transform.SetParent(YourTurnSection.transform);

                /* if (game.turn == LoggedInUser.Instance.GetUserUID())
                 * {
                 *  gameButton.transform.SetParent(YourTurnSection.transform);
                 * }
                 * else
                 * {
                 *  gameButton.transform.SetParent(TheirTurnSection.transform);
                 * } */

                gameButton.transform.localScale = localScale;

                gameButtons.Add(gameButton);
            }

            RefreshContent();
        }
    }
Ejemplo n.º 2
0
 void Start()
 {
     gameButtonController = gameObject.GetComponent <GameButtonController> ();
 }