/// <summary> /// Initializes a new instance of the PlayerHandViewModel class. /// </summary> /// <param name="ParentTVM">Placeholder for the parent MasterViewModel.</param> /// <param name="ParentPVM">Placeholder for the parent PlayerViewModel.</param> public PlayerHandViewModel(TableViewModel ParentTVM, PlayerViewModel ParentPVM) { m_MasterParent = ParentTVM; m_ParentPlayerViewModel = ParentPVM; m_PlayerHandModel = new PlayerHandModel(); m_PlayerStrategyViewModel = new PlayerStrategyViewModel(m_MasterParent, this); }
/// <summary> /// Initializes a new instance of the TableViewModel class. /// </summary> public TableViewModel() { #region Member Instantiation m_TableModel = new TableModel(); m_TableModel.ResourcesViewModel = new ResourcesViewModel(this); m_TableModel.BenchmarkViewModel = new BenchmarkViewModel(this); m_TableModel.DealerViewModel = new DealerViewModel(this); m_TableModel.HouseRulesViewModel = new HouseRulesViewModel(this); m_TableModel.LoggingViewModel = new LoggingViewModel(this); m_TableModel.GameStatisticsViewModel = new GameStatisticsViewModel(this); m_TableModel.PlayerViewModel = new ObservableCollection<PlayerViewModel>(); m_TableModel.PlayerStatisticsViewModel = new ObservableCollection<PlayerStatisticsViewModel>(); for (int i = 0; i < 7; i++) { m_TableModel.PlayerViewModel.Add(new PlayerViewModel(this, (i + 1))); m_TableModel.PlayerStatisticsViewModel.Add(new PlayerStatisticsViewModel(this, (i + 1))); } m_TableModel.ShoeViewModel = new ShoeViewModel(this); #endregion CurrentPlayerVM = new PlayerViewModel(this, -1); CurrentPlayerHandVM = CurrentPlayerVM.PlayerHandVM[0]; CanDealCards = false; CanStartGame = true; }
/// <summary> /// Advances play to the next player (or dealer). /// </summary> /// <param name="CurrentPlayer">The player currently active.</param> private void AdvanceToNextPlayer(int CurrentPlayer) { if (CurrentPlayer < 6) { for (int tempplayer = CurrentPlayer + 1; tempplayer < PlayerVM.Count; tempplayer++) { if (PlayerVM[tempplayer].PlayerMode != PlayerMode.NotPlaying) { // This is the next player that is playing // Set the new hand as the current hand. PlayerVM[tempplayer].IsActive = true; CurrentPlayerVM = PlayerVM[tempplayer]; PlayerVM[tempplayer].PlayerHandVM[0].IsActive = true; CurrentPlayerHandVM = PlayerVM[tempplayer].PlayerHandVM[0]; return; } } // This was the last hand of the round. CurrentPlayerVM = new PlayerViewModel(this, -1); CurrentPlayerHandVM = CurrentPlayerVM.PlayerHandVM[0]; DealerVM.IsActive = true; } else { // This was the last hand of the round. CurrentPlayerVM = new PlayerViewModel(this, -1); CurrentPlayerHandVM = CurrentPlayerVM.PlayerHandVM[0]; DealerVM.IsActive = true; } }
private void PlayerSeat_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { m_PlayerViewModel = (PlayerViewModel)DataContext; PlayerTableHand1.DataContext = m_PlayerViewModel.PlayerHandVM[0]; PlayerTableHand2.DataContext = m_PlayerViewModel.PlayerHandVM[1]; PlayerTableHand3.DataContext = m_PlayerViewModel.PlayerHandVM[2]; PlayerTableHand4.DataContext = m_PlayerViewModel.PlayerHandVM[3]; }