Ejemplo n.º 1
0
    private void RefreshDisplay()
    {
        currentGames.RemoveAll(x => x == null);

        foreach (KeyValuePair <string, BBGame> currentGame in gameRunner.Games)
        {
            string gameID = currentGame.Value.GameID;
            if (currentGames.Find(x => x.GameID == gameID))
            {
                continue;
            }

            BBGameState state = currentGame.Value.current;

            GameButtonBehaviour.GameType gametype = GameButtonBehaviour.GameType.FORECAST;
            if (state.gameComplete)
            {
                gametype = GameButtonBehaviour.GameType.HISTORICAL;
            }
            else if (state.gameStart)
            {
                gametype = GameButtonBehaviour.GameType.CURRENT;
            }

            GameObject          newGameButton = Instantiate(GameButtonPrefab);
            GameButtonBehaviour gbb           = newGameButton.GetComponent <GameButtonBehaviour>();
            gbb.gameType = gametype;
            gbb.GameID   = gameID;
            gbb.self.onClick.AddListener(() => ViewGame(gbb));

            switch (gametype)
            {
            case GameButtonBehaviour.GameType.CURRENT:
                newGameButton.transform.SetParent(currentGameList);
                break;

            case GameButtonBehaviour.GameType.FORECAST:
                newGameButton.transform.SetParent(futureGameList);
                break;

            default:
                newGameButton.transform.SetParent(historicalGameList);
                break;
            }

            currentGames.Add(gbb);
        }
    }
Ejemplo n.º 2
0
 public void ViewGame(GameButtonBehaviour button)
 {
     Debug.Log($"Loading Game: {button.GameID}");
     gameRunner.GameIDFocus = button.GameID;
     SceneManager.LoadScene(Constants.SCENE_VIEWER);
 }