示例#1
0
    void UpdateGamesList(Game[] games)
    {
        Vector2 previous = createGame.transform.position;

        gameListItems = new GameObject[games.Length];
        float scale = menu.GetScale();
        int   i     = 0;

        foreach (Game game in games)
        {
            GameObject     newGameListItem = Instantiate(gameListItemPrefab) as GameObject;
            GameListItemUI gameListItem    = newGameListItem.GetComponent <GameListItemUI>();
            gameListItem.Init(game, new Action <Game>(delegate(Game selectedGame) {
                Deactivate();
                menu.CompleteGameSelect(game);
            }));
            newGameListItem.transform.SetParent(gameList.transform, false);
            newGameListItem.transform.position = new Vector2(previous.x, previous.y - (110 / scale));
            previous           = newGameListItem.transform.position;
            gameListItems[i++] = newGameListItem;
        }
    }