Exemplo n.º 1
0
        private TurnModel NewTurn()
        {
            var _newTurn = new TurnModel
            {
                StartTime = DateTime.Now.TimeOfDay.ToString(),
                Player    = ActivePlayer,
            };

            return(_newTurn);
        }
Exemplo n.º 2
0
        private void StartNextTurn()
        {
            if (ActiveTurn == null)
            {
                ActiveTurn = NewTurn();
            }
            else
            {
                ActiveTurn.EndTime = DateTime.Today.TimeOfDay.ToString();
                CurrentGame.TurnList.Add(ActiveTurn);
                var _activeIndex = CurrentGame.Players.IndexOf(ActivePlayer);
                if (_activeIndex == CurrentGame.Players.Count - 1)
                {
                    ActivePlayer = CurrentGame.Players[0];
                }
                else
                {
                    ActivePlayer = CurrentGame.Players[_activeIndex + 1];
                }

                ActiveTurn = NewTurn();
            }

            DiceList = DiceHelper.NewDiceSet();
            RollingImageDictionary = CreateRollingDictionary();
            HeldImageDictionary    = CreateHeldDictionary();

            playerTB.Text = $"Player: {ActivePlayer.Name}";
            turnTB.Text   = $"Turn: {CurrentGame.TurnList.Count + 1}";
            rollTB.Text   = $"Roll: 1 of 3";
            scoreTB.Text  = $"Score: {ActivePlayer.Scorecard.TotalScore()}";

            availableLB.ItemsSource = null;
            availableLB.ItemsSource = ActivePlayer.Scorecard.AvailableScores();

            scorePointsTB.Visibility = Visibility.Collapsed;
            scoreNameTB.Visibility   = Visibility.Collapsed;
            heldOneIMG.Visibility    = Visibility.Collapsed;
            heldTwoIMG.Visibility    = Visibility.Collapsed;
            heldThreeIMG.Visibility  = Visibility.Collapsed;
            heldFourIMG.Visibility   = Visibility.Collapsed;
            heldFiveIMG.Visibility   = Visibility.Collapsed;
            nextTurnBTN.Visibility   = Visibility.Collapsed;
            rollBTN.Visibility       = Visibility.Visible;
            UseScoreBTN.Visibility   = Visibility.Visible;
        }