Exemplo n.º 1
0
        public async Task LoadGameAsync(String path)
        {
            if (_dataAccess == null)
            {
                throw new InvalidOperationException("No data access is provided.");
            }

            _isLost = false;
            _table  = await _dataAccess.LoadAsync(path);


            switch (_table.Size)
            {
            case 4:
                _gameSize = GameSize.Small;
                break;

            case 8:
                _gameSize = GameSize.Medium;
                break;

            case 12:
                _gameSize = GameSize.Large;
                break;
            }
        }
Exemplo n.º 2
0
        public void NewGame()
        {
            _isLost = false;
            switch (_gameSize)
            {
            case GameSize.Small:
                _table = new TetrisTable(GameSizeSmall);
                NewShapeSpawn();
                break;

            case GameSize.Medium:
                _table = new TetrisTable(GameSizeMedium);
                NewShapeSpawn();
                break;

            case GameSize.Large:
                _table = new TetrisTable(GameSizeLarge);
                NewShapeSpawn();
                break;

            default:
                _table = new TetrisTable();
                NewShapeSpawn();
                break;
            }
        }
Exemplo n.º 3
0
 public TetrisModel(TetrisDataAccessInterface dataAccess = null)
 {
     _gameSize = GameSize.Medium;
     _table    = new TetrisTable();
     NewShapeSpawn();
     _dataAccess = dataAccess;
 }
Exemplo n.º 4
0
 public TetrisEventArgs(TetrisTable newTable, Int32 newGameTime, Boolean newIsLost)
 {
     _table    = newTable;
     _gameTime = newGameTime;
     _isLost   = newIsLost;
 }