コード例 #1
0
 private void Awake()
 {
     instance = this;
 }
コード例 #2
0
        private void handleNewGame(Level g)
        {
            if (board != null)
            {
                animations.halfFade(board);
            }
            if (!inited && g.adventure != null)
            {
                Level[] levels = g.adventure.Levels;
                foreach (Level level in levels)
                {
                    UnityEngine.Debug.Log("adventure part");
                    if (g == level)
                    {
                        break;
                    }
                    game = level;
                    calculateCellSize();
                    calculatePositions();
                    createBoard(game);
                    if (board != null)
                    {
                        animations.halfFade(board);
                    }
                    Cell[,] array = board;
                    int length  = array.GetLength(0);
                    int length2 = array.GetLength(1);
                    for (int j = 0; j < length; j++)
                    {
                        for (int k = 0; k < length2; k++)
                        {
                            Cell cell = array[j, k];
                            if (cell != null)
                            {
                                cell.openCell();
                            }
                            try
                            {
                                cell.transform.Find("BG").localScale = Vector3.one;
                            }
                            catch (Exception)
                            {
                            }
                        }
                    }
                }
            }
            game = g;
            printBoard();
            calculateCellSize();
            calculatePositions();
            createBoard(game);
            loadHints();
            SaveLoad.instance.loadGame();
            try
            {
                initDailyStar();
            }
            catch (Exception)
            {
                PlayerPrefsManager.deleteStarPos();
                initDailyStar();
            }
            if (game.mode == GameMode.DAILY)
            {
                DailyController dailyController = DailyController.instance;
                dailyController.onStarFound = (DailyController.NoParam)Delegate.Combine(dailyController.onStarFound, new DailyController.NoParam(handleStarFound));
            }
            float num = 0.5f;

            if (game.mode == GameMode.ADVENTURE)
            {
                if (!inited)
                {
                    Movements.instance.executeWithDelay((Movements.Execute)AnimController.instance.initGameAnims, 0f);
                    num = 1.5f;
                }
                if (game.part != AdventurePart.START)
                {
                    Movements.instance.executeWithDelay((Movements.Execute)animWrapper, num);
                    Movements.instance.scale(cellHolder.parent.gameObject, cellHolder.parent.localScale, game.scale, num);
                }
                else
                {
                    animations.initAnim(board);
                    cellHolder.parent.localScale = game.scale;
                }
            }
            else
            {
                animations.initAnim(board);
                cellHolder.parent.localScale = game.scale;
                Movements.instance.executeWithDelay((Movements.Execute)AnimController.instance.initGameAnims, 0f);
            }
            inited = true;
        }