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; } }
static public void StopGame() { UpdateHighScore(); if (Social.Active.localUser.authenticated) { for (int ct = 1; ct <= PlayerPrefs.GetInt("clear"); ct++) { GooglePlayServiceManager.UnlockAchievement(ct); } } YellowCard.SetCardContent(int.Parse(modeSub.ToString()), ballHit, score, Time.time - startTime); YellowCard.Show(); button.enable = true; modeSub = '1'; stageID = 0; score = 0; combo = 0; ballHit = 0; level = 1; ballCt = 1; removeAllBall(); RemoveAllWhistle(); LaunchMenu(); }
internal void DisableMe() { YellowCard.Remove(); BlueCard.Remove(); RedCard.Remove(); OffCard.Remove(); }
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 YellowCardEventsAppearInTimeline() { var yellowCard = new YellowCard(0, new Guid(), new Guid()); Assert.True(yellowCard.ShowInTimeline); }
public void YellowCardEventHasCorrectName() { var yellowCard = new YellowCard(0, new Guid(), new Guid()); Assert.Equal("Yellow Card", yellowCard.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}, "); } }
static public void LaunchGame(int n) { PlayerPrefs.SetInt("gamePlayed", PlayerPrefs.GetInt("gamePlayed") + 1); if (PlayerPrefs.GetInt("gamePlayed") >= 100) { GooglePlayServiceManager.UnlockAchievement(6); } if (PlayerPrefs.GetInt("gamePlayed") >= 250) { GooglePlayServiceManager.UnlockAchievement(7); } YellowCard.Hide(); PlayerPrefs.SetInt("lastGameType", n - 1); startTime = Time.time; combo = 1; mode = SceneMode.Game; ballList[0].GetComponent <ballPhysics>().StartKick(); if (n == 4) { modeSub = '4'; maxLevel = 3; g = 0.2f; kickZone = stageKickZone[1]; } if (n == 1) { modeSub = '1'; maxLevel = 1; g = 0.2f; kickZone = stageKickZone[1]; } if (n == 2) { fCallList.Add(new FunctionCall(5, 3)); modeSub = '2'; maxLevel = 1; g = 0.1f; kickZone = stageKickZone[2]; } if (n == 3) { fCallList.Add(new FunctionCall(5, 3)); fCallList.Add(new FunctionCall(5, 5)); modeSub = '3'; maxLevel = 1; g = 0.1f; kickZone = stageKickZone[3]; } button.enable = false; SetGravity(); }
void Update() { if (Input.GetKeyDown("escape")) { if (manager.mode == SceneMode.Game) { manager.pause = !manager.pause; } if (manager.mode == SceneMode.Menu) { if (YellowCard.IsShowing()) { YellowCard.Hide(); } else { Application.Quit(); } } } Update_InGame(); Update_FunctionCall(); Update_TouchCheck(); if (pause) { if (dataInStored == false) { for (int ct = 0; ct < 3; ct++) { if (ballList.Count >= ct + 1) { tempVelo[ct] = ballList[ct].GetComponent <Rigidbody2D>().velocity; ballList[ct].GetComponent <Rigidbody2D>().velocity = Vector2.zero; ballList[ct].GetComponent <Rigidbody2D>().gravityScale = 0; } } dataInStored = true; } } else { if (dataInStored) { for (int ct = 0; ct < 3; ct++) { if (ballList.Count >= ct + 1) { ballList[ct].GetComponent <Rigidbody2D>().velocity = tempVelo[ct]; ballList[ct].GetComponent <Rigidbody2D>().gravityScale = g; } } } dataInStored = false; } if (Input.touchCount >= 5) { StopGame(); } if (transStage == true) { StartCoroutine(Transition()); transStage = false; } }
void OnMouseDown() { YellowCard.Hide(); }
public DataGroupYCPlayers(FootballMatch match, FootballTeam team, Player player, YellowCard yellowCard) { this.match = match; this.team = team; this.player = player; this.yellowCard = yellowCard; }
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; ActiveDataGroupYCPlayersItem.firstTeam = true; } else { ft = ((FootballMatch)this.DefaultViewModel["Match"]).team2; ActiveDataGroupYCPlayersItem.firstTeam = false; } ActiveDataGroupYCPlayersItem.yellowCard.Player_idValue = p.id; ActiveDataGroupYCPlayersItem.player = p; ActiveDataGroupYCPlayersItem.team = ft; ActiveDataGroupYCPlayersItem.yellowCard.Team_idValue = ft.id; int iM = 0; int iAM = 0; try { iM = Int32.Parse(MinuteTextBox.Text); iAM = Int32.Parse(AdditionMinuteTextBox.Text); } catch { iM = 0; iAM = 0; } ActiveDataGroupYCPlayersItem.yellowCard.MinuteValue = iM; ActiveDataGroupYCPlayersItem.yellowCard.Addition_minuteValue = iAM; ActiveDataGroupYCPlayersItem.yellowCard.NoteValue = NoteTextBox.Text; ActiveDataGroupYCPlayersItem.yellowCard.objectStatus = (int)DataSource.status.needUpdate; await ActiveDataGroupYCPlayersItem.yellowCard.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 { if (iM == null) { iM = 0; } if (iAM == null) { iAM = 0; } } YellowCard mp = new YellowCard(0, ((FootballMatch)this.DefaultViewModel["Match"]).id, ft.id, ((Player)PlayerComboBoxEd.SelectedItem).id, 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) // { // DataGroupYCPlayers dgm = new DataGroupYCPlayers(fm, ft, ((Player)PlayerComboBoxEd.SelectedItem), mp); // if (first) // { // dgm.firstTeam = true; // } // else // { // dgm.firstTeam = false; // } //dataGroupsYCPlayer.Add(dgm); // this.DefaultViewModel["dataGroupsMatchPlayer"] = dataGroupsYCPlayer; // this.DefaultViewModel["Team1MatchPlayers"] = dataGroupsYCPlayer.Where((team) => team.team.id.Equals(fm.team1.id)); //this.DefaultViewModel["Team2MatchPlayers"] = dataGroupsYCPlayer.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("Успешно сохранено на сервере."); await DataSource.Save(); dialog.ShowAsync(); } catch (Exception ex) { var dialog = new MessageDialog("Не удалось сохранить данные на сервере."); dialog.ShowAsync(); } finally { LoadState(); synchProgressRing.IsActive = false; loadingRectangle.Visibility = Windows.UI.Xaml.Visibility.Collapsed; } }