void StateMachineEnter_LoadSavedGame(Enum state, GeneralOptions options = null)
    {
        Debug.Log("StateMachineEnter_LoadSavedGame");

        level        = Settings.Level;
        gameStrategy = StrategyFactory.CreateInstance(GetGameStrategy(level));
        score        = Settings.Score;
        remainTime   = Settings.RemainTime;
        SearchNum    = Settings.SearchNum;
        ShuffeNum    = Settings.ShuffeNum;
        pairNum      = Settings.PairNum;
        TimeNum      = Settings.TimeNum;

        int[] tempMatrix = Settings.Matrix;
        Debug.LogWarning("length: " + tempMatrix.Length);
        matrix = new int[row, col];
        for (int i = 0; i < row; i++)
        {
            for (int j = 0; j < col; j++)
            {
                Debug.LogWarning("i: " + i + " j: " + j + " value: " + matrix[i, j]);
                matrix[i, j] = tempMatrix[col * i + j];
            }
        }
        mapUI.Initialize(matrix, this, (GameStrategy)level);
        currentPairCellIds = CoreGame.GetAvailablePair(matrix);
        StateMachineChange(GameState.EnterLevel);
    }
 protected virtual void NewGame()
 {
     pairNum     = (row - 2) * (col - 2) / 2;
     this.matrix = CoreGame.CreateMatrix(row, col);
     if (CoreGame.GetAvailablePair(this.matrix).Count == 0)
     {
         ResetMap();
     }
     gameStrategy = StrategyFactory.CreateInstance(GetGameStrategy(level));
     mapUI.Initialize(matrix, this, (GameStrategy)level);
     remainTime = matchTime;
 }
 protected override void NewGame()
 {
     pairNum            = (row - 2) * (col - 2) / 2;
     this.matrix        = CoreGame.CreateMatrix(row, col);
     currentPairCellIds = CoreGame.GetAvailablePair(this.matrix);
     if (currentPairCellIds.Count == 0)
     {
         ResetMap();
     }
     gameStrategy = StrategyFactory.CreateInstance(GetGameStrategy(level));
     mapUI.Initialize(matrix, this, GetGameStrategy(level));
 }
示例#4
0
 protected override void NewGame()
 {
     pairNum            = (row - 2) * (col - 2) / 2;
     this.matrix        = CoreGame.CreateMatrix(row, col);
     currentPairCellIds = CoreGame.GetAvailablePair(this.matrix);
     if (currentPairCellIds.Count == 0)
     {
         ResetMap();
     }
     gameStrategy = StrategyFactory.CreateInstance(GetGameStrategy(level));
     // gameMode = GameMode.Top;
     mapUI.Initialize(matrix, this, GetGameStrategy(level));
     if (difficultLevel == DifficultLevel.Hard && level > 9)
     {
         matchTime -= 10;
         if (matchTime < 180)
         {
             matchTime = 180;
         }
     }
     remainTime = matchTime;
 }