internal void DisableMe() { YellowCard.Remove(); BlueCard.Remove(); RedCard.Remove(); OffCard.Remove(); }
internal void ChangeDrawCard() { switch (ActiveCard) { case Cards.BlueCard: BlueCard.Remove(); RedCard.Add(); ActiveCard = Cards.RedCard; break; case Cards.RedCard: RedCard.Remove(); YellowCard.Add(); ActiveCard = Cards.GoldCard; break; case Cards.GoldCard: YellowCard.Remove(); OffCard.Add(); ActiveCard = Cards.OffCard; break; case Cards.OffCard: OffCard.Remove(); BlueCard.Add(); ActiveCard = Cards.BlueCard; break; } }
private MatchEvent GetMatchEvent(MatchEvents type, Player player, Team team) { MatchEvent matchEvent; switch (type) { case MatchEvents.RedCard: matchEvent = new RedCard(player.Id, Match.Id); break; case MatchEvents.YellowCard: matchEvent = new YellowCard(player.Id, Match.Id); break; case MatchEvents.Assist: matchEvent = new Assist(player.Id, Match.Id); break; case MatchEvents.Goal: matchEvent = new Goal(player.Id, team.Id, Match.Id); break; default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } return(matchEvent); }
public void ShouldNotEquate_Blue_Red() { //assign ICard blueCard = new BlueCard(); ICard redCard = new RedCard(); //act bool matches = blueCard.Matches(redCard); //assert matches.Should().BeFalse(); }
public void ShouldEquate_RedCards() { //assign ICard card1 = new RedCard(); ICard card2 = new RedCard(); //act bool matches = card1.Matches(card2); //assert matches.Should().BeTrue(); }
public void ShouldNotEquate_Red_White() { //assign ICard redCard = new RedCard(); ICard whiteCard = new WhiteCard(); //act bool matches = redCard.Matches(whiteCard); //assert matches.Should().BeFalse(); }
public void ShouldNotEquate_Red_Green() { //assign ICard greenCard = new GreenCard(); ICard redCard = new RedCard(); //act bool matches = redCard.Matches(greenCard); //assert matches.Should().BeFalse(); }
private void InitCards(int id, string name, Elements element, int top, int right, int bottom, int left) { BlueCards[id] = new BlueCard(id, name, element, top, right, bottom, left); RedCards[id] = new RedCard(id, name, element, top, right, bottom, left); }
public void RedCardEventsAppearInTimeline() { var redCard = new RedCard(0, new Guid(), new Guid()); Assert.True(redCard.ShowInTimeline); }
public void RedCardEventHasCorrectName() { var redCard = new RedCard(0, new Guid(), new Guid()); Assert.Equal("Red Card", redCard.Name); }
static void Main(string[] args) { //Generate cards List <ICard> myCards = new List <ICard>(); for (int i = 1; i < 9; i++) { for (int j = 1; j < 6; j++) { switch (j) { case 1: var red = new RedCard(i); myCards.Add(red); break; case 2: var blue = new BlueCard(i); myCards.Add(blue); break; case 3: var green = new GreenCard(i); myCards.Add(green); break; case 4: var yellow = new YellowCard(i); myCards.Add(yellow); break; case 5: var gold = new GoldCard(i); myCards.Add(gold); break; default: throw new InvalidOperationException("Suit is undefined!"); } } } Deck myDeck = new Deck(myCards); IGame myGame = new GameLowWin(myDeck); IPlayer player1 = new Player("player1"); IPlayer player2 = new Player("player2"); IPlayer player3 = new Player("player3"); IPlayer player4 = new PlayerWeak("player4"); IPlayer player5 = new PlayerWeak("player5"); myGame.AddPlayer(player1); myGame.AddPlayer(player2); myGame.AddPlayer(player3); myGame.AddPlayer(player4); myGame.AddPlayer(player5); myGame.DealAllPlayers(5); List <ICard> hand1 = player1.ShowHand(); List <ICard> hand2 = player2.ShowHand(); List <ICard> hand3 = player3.ShowHand(); List <ICard> hand4 = player4.ShowHand(); List <ICard> hand5 = player5.ShowHand(); Console.WriteLine("Hand for PLayer 1: "); foreach (var card in hand1) { Console.WriteLine($"{card.Suit} {card.Number}"); } Console.WriteLine("Hand for PLayer 2: "); foreach (var card in hand2) { Console.WriteLine($"{card.Suit} {card.Number}"); } Console.WriteLine("Hand for PLayer 3: "); foreach (var card in hand3) { Console.WriteLine($"{card.Suit} {card.Number}"); } Console.WriteLine("Hand for PLayer 4: "); foreach (var card in hand4) { Console.WriteLine($"{card.Suit} {card.Number}"); } Console.WriteLine("Hand for PLayer 5: "); foreach (var card in hand5) { Console.WriteLine($"{card.Suit} {card.Number}"); } Console.WriteLine("--------------------------------------------"); foreach (var player in myGame.Players) { Console.WriteLine($"Total value of {player.Name}'s hand is {player.TotalValue()}."); } Console.WriteLine("The winner(s):"); foreach (var winner in myGame.Winner()) { Console.Write($"{winner.Name}, "); } }
public DataGroupRCPlayers(FootballMatch match, FootballTeam team, Player player, RedCard redCard) { this.match = match; this.team = team; this.player = player; this.redCard = redCard; }
private async void AcceptButtonEd_Click(object sender, RoutedEventArgs e) { try { synchProgressRing.IsActive = true; loadingRectangle.Visibility = Windows.UI.Xaml.Visibility.Visible; if (PlayerComboBoxEd.SelectedItem != null && TeamComboBoxEd.SelectedItem != null) { if (PlayerComboBoxEd.SelectedItem.GetType().Equals(typeof(Player))) { if (editorPanel.Tag.ToString() == "Edit") { Player p = (Player)PlayerComboBoxEd.SelectedItem; FootballTeam ft; if (TeamComboBoxEd.SelectedIndex == 0) { ft = ((FootballMatch)this.DefaultViewModel["Match"]).team1; ActiveDataGroupRCPlayersItem.firstTeam = true; } else { ft = ((FootballMatch)this.DefaultViewModel["Match"]).team2; ActiveDataGroupRCPlayersItem.firstTeam = false; } ActiveDataGroupRCPlayersItem.redCard.Player_idValue = p.id; ActiveDataGroupRCPlayersItem.player = p; ActiveDataGroupRCPlayersItem.team = ft; ActiveDataGroupRCPlayersItem.redCard.Team_idValue = ft.id; int iM = 0; int iAM = 0; try { iM = Int32.Parse(MinuteTextBox.Text); iAM = Int32.Parse(AdditionMinuteTextBox.Text); } catch { if (iM == null) { iM = 0; } if (iAM == null) { iAM = 0; } } ActiveDataGroupRCPlayersItem.redCard.MinuteValue = iM; ActiveDataGroupRCPlayersItem.redCard.Addition_minuteValue = iAM; ActiveDataGroupRCPlayersItem.redCard.NoteValue = NoteTextBox.Text; ActiveDataGroupRCPlayersItem.redCard.Is_two_yellowValue = (bool)IsTwoYellowCardEd.IsChecked; ActiveDataGroupRCPlayersItem.redCard.objectStatus = (int)DataSource.status.needUpdate; await ActiveDataGroupRCPlayersItem.redCard.Update(); } else { FootballTeam ft; bool first; if (TeamComboBoxEd.SelectedIndex == 0) { ft = ((FootballMatch)this.DefaultViewModel["Match"]).team1; first = true; } else { ft = ((FootballMatch)this.DefaultViewModel["Match"]).team2; first = false; } int iM = 0; int iAM = 0; try { iM = Int32.Parse(MinuteTextBox.Text); iAM = Int32.Parse(AdditionMinuteTextBox.Text); } catch { iM = 0; iAM = 0; } RedCard mp = new RedCard(0, ((FootballMatch)this.DefaultViewModel["Match"]).id, ft.id, ((Player)PlayerComboBoxEd.SelectedItem).id, (bool)IsTwoYellowCardEd.IsChecked, iM, iAM, NoteTextBox.Text); mp.objectStatus = (int)DataSource.status.needCreate; await mp.Update(); //FootballMatch fm = await DataSource.GetItemAsync(activId); // if (mp.objectStatus != (int)DataSource.status.Deleted || mp.objectStatus != (int)DataSource.status.needDelete) //{ // DataGroupRCPlayers dgm = new DataGroupRCPlayers(fm, ft, ((Player)PlayerComboBoxEd.SelectedItem), mp); // if (first) // { // dgm.firstTeam = true; // } // else // { // dgm.firstTeam = false; // } // dataGroupsRCPlayer.Add(dgm); // this.DefaultViewModel["dataGroupsMatchPlayer"] = dataGroupsRCPlayer; // this.DefaultViewModel["Team1MatchPlayers"] = dataGroupsRCPlayer.Where((team) => team.team.id.Equals(fm.team1.id)); // this.DefaultViewModel["Team2MatchPlayers"] = dataGroupsRCPlayer.Where((team) => team.team.id.Equals(fm.team2.id)); //} //Frame.Navigate(typeof(MatchPlayerPage), activId); } viewPanel.Visibility = Windows.UI.Xaml.Visibility.Visible; editorPanel.Visibility = Windows.UI.Xaml.Visibility.Collapsed; DeleteButtonEd.Visibility = Windows.UI.Xaml.Visibility.Collapsed; } } var dialog = new MessageDialog("Успешно сохранено на сервере."); dialog.ShowAsync(); await DataSource.Save(); } catch (Exception ex) { var dialog = new MessageDialog("Не удалось сохранить данные на сервере."); dialog.ShowAsync(); } finally { LoadState(); synchProgressRing.IsActive = false; loadingRectangle.Visibility = Windows.UI.Xaml.Visibility.Collapsed; } }