public MainWindow() { InitializeComponent(); LoadData(); DiceList = DiceHelper.NewDiceSet(); HeldDiceList = new List <DieModel>(); OpenDiceImages = new List <Image>(); OpenHeldImages = new List <Image>(); DiceImages = new List <Image> { rollingOneIMG, rollingTwoIMG, rollingThreeIMG, rollingFourIMG, rollingFiveIMG, }; HeldDiceImages = new List <Image> { heldOneIMG, heldTwoIMG, heldThreeIMG, heldFourIMG, heldFiveIMG, }; rollBTN.Visibility = Visibility.Collapsed; CurrentGame = CreateNewGame(); ShowNewGame(); }
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; }