Esempio n. 1
0
        public DicesViewModel(PlayerEngine _playerEngine)
        {
            Player       = new Player();
            playerEngine = _playerEngine;
            dbOps        = new DbOperations();
            random       = new Random();

            gameType      = playerEngine.SetGameType();
            ActivePlayers = playerEngine.SetPlayers();
            ActivePlayer  = playerEngine.SetActivePlayer();
            GenerateDices();
            GetGameEngine();
            DiceImages();
            SetWarningTimer();
            SetEndTimer();

            pgv        = new PlayGameView(0);
            count      = 0;
            throwsLeft = 3;
            gameEnded  = false;
            SetThrowsLeft(throwsLeft);

            SaveDiceCommand  = new RelayCommand(SaveDice, CanSaveDices);
            RollDicesCommand = new RelayCommand(RollDices, IsTriesEnabled);
            Ones             = new RelayCommand(ChooseScoreCategory, IsOnesEnabled);
            Twos             = new RelayCommand(ChooseScoreCategory, IsTwosEnabled);
            Threes           = new RelayCommand(ChooseScoreCategory, IsThreesEnabled);
            Fours            = new RelayCommand(ChooseScoreCategory, IsFoursEnabled);
            Fives            = new RelayCommand(ChooseScoreCategory, IsFivesEnabled);
            Sixes            = new RelayCommand(ChooseScoreCategory, IsSixesEnabled);
            Pair             = new RelayCommand(ChooseScoreCategory, IsPairEnabled);
            TwoPair          = new RelayCommand(ChooseScoreCategory, IsTwoPairEnabled);
            Threeofakind     = new RelayCommand(ChooseScoreCategory, IsThreeOfaKindEnabled);
            Fourofakind      = new RelayCommand(ChooseScoreCategory, IsFourOfaKindEnabled);
            Smallstraight    = new RelayCommand(ChooseScoreCategory, IsSmalLadderEnabled);
            Largestraight    = new RelayCommand(ChooseScoreCategory, IsLargeLadderEnabled);
            Fullhouse        = new RelayCommand(ChooseScoreCategory, IsFullHouseEnabled);
            Chance           = new RelayCommand(ChooseScoreCategory, IsChanceEnabled);
            Yatzy            = new RelayCommand(ChooseScoreCategory, IsYatzyEnabled);
            QuitGameCommand  = new RelayCommand(QuitGame, CanExecuteMethod);
        }