Example #1
0
        public MainWindowViewModel()
        {
            game           = new Game();
            game.Random    = random;
            Distribution   = game.Generate(16, 30, 99);
            game.game_type = GameType.Expert;
            Row            = game.row;
            Col            = game.col;
            Mine_number    = game.mine_number;
            Left_mine      = (Mine_number - Count_flag).ToString("D3");

            Ininitialize(game);
            Height      = mine_size * Row;
            Width       = mine_size * Col;
            Main_height = Height + height_margin;
            Main_width  = Width + width_margin;

            player           = new AutoPlayer(row, col, Mines, Rectangles);
            player.inBorder  = InBorder;
            player.lRClick   = LRClick;
            player.openBlock = OpenBlock;
            player.openEmpty = OpenEmpty;
            player.flagBlock = FlagBlock;
            player.borders   = BorderSet;
            //player.clickBlock = ClickBlock;
            record = new Record();
        }
Example #2
0
        public MainWindowViewModel()
        {
            PositionProperty = DependencyProperty.Register("Position", typeof(Position), typeof(Rectangle));

            game           = new Game();
            game.Random    = random;
            Distribution   = game.Generate(16, 30, 99);
            game.game_type = GameType.Expert;
            Row            = game.row;
            Col            = game.col;
            Mine_number    = game.mine_number;
            Left_mine      = (Mine_number - Count_flag).ToString("D3");

            Ininitialize(game);
            Height      = mine_size * Row;
            Width       = mine_size * Col;
            Main_height = Height + height_margin;
            Main_width  = Width + width_margin;

            dispatcherTimer.Tick    += new EventHandler(dispatcherTimer_Tick);
            dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 10);

            player              = new AutoPlayer(row, col, Mines, Rectangles);
            player.inBorder     = InBorder;
            player.lRClick      = LRClick;
            player.openBlock    = OpenBlock;
            player.flagBlock    = FlagBlock;
            player.borders      = BorderSet;
            player.getGameState = GetGameState;

            record = new Record();
        }