示例#1
0
        // Wrapper for outbound variables
        private string GetValue(int row, int col)
        {
            if (row < 0 || row >= _gameStateModel.GetState().Count)
            {
                return("OUT_BOUND");
            }
            if (col < 0 || col >= _gameStateModel.GetState()[row].Count)
            {
                return("OUT_BOUND");
            }

            return(_gameStateModel.GetState()[row][col].Peek());
        }
示例#2
0
        private void StartGame(string level)
        {
            Application.Current.MainWindow.WindowState = WindowState.Maximized;
            GameStateModel gs = new GameStateModel("../../Assets/Levels/" + level + ".txt");
            TileMapView    tm = new TileMapView(gs.GetState());

            tm.UpdateViews();
            MainController mc = new MainController(gs, ref tm);

            SoundPlayer player = new SoundPlayer("../../Assets/Audio/LittleRoot.wav");

            player.Load();
            player.Play();

            lbGUI.MouseDoubleClick += tm.SwitchGUIMode;
        }
示例#3
0
        public MainController(GameStateModel gs, ref TileMapView tm)
        {
            // Model
            _gameStateModel = gs;
            _gameHistory    = new Stack <List <List <Stack <string> > > >();
            _gameHistory.Push(_gameStateModel.GetState());

            // Internal Controllers
            ResetRules();
            RecalculateRule();

            // Views
            _tileMapView       = tm;
            _gridMain          = _tileMapView.GetWindow().gridMain;
            _gridMain.KeyDown += new KeyEventHandler(HandleKeyboardInput);
        }