public void PrintGameOverWithWinnerMessage(Player i_Winner) { string GameOverMessage; FormClosing -= FormOthloGameBoard_FormClosing; if (i_Winner == null) { GameOverMessage = string.Format( @"Game is over! - We have a tie! Want a new game?"); } else { GameOverMessage = string.Format( @"Game is over! - The winner is {0} Want a new game?", i_Winner.Name); } DialogResult dialogResult = MessageBox.Show(GameOverMessage, "Game Over", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { Dispose(); NewRound.Invoke(); } else if (dialogResult == DialogResult.No) { Close(); } }
void EvaluateTurn() { // if a side lost the battle then end it //if ((currentHpNPC <= 0 || currentHpPlayer <= 0) && Time.timeSinceLevelLoad - timeEnter >= timeExit) // This is infocard case 1 if (currentHpNPC <= 0 || currentHpPlayer <= 0) { Debug.Log("A side has reached 0 HP. Game is over"); nextPhase = new EndBattle(battleManager, playerStats, npcData, playerHand, npcHand); battleManager.nPCDisplay.SetReaction(npcData.endQuotes[Random.Range(0, npcData.endQuotes.Length)], npcData.enemyAngry); DisplayInfoCard(1); } // if challenge is won, even if target isn't reached yet then start a new round // this is infocard case 2 else if (isChallengeWon) { Debug.Log("Challenge is won by opponent. Moving cards to graveyard and starting a new round."); battleManager.SwitchTurn(); // empty table and pot before new round table.ClearTable(CardCollections.Graveyard); pot.EmptyPot(); nextPhase = new NewRound(battleManager, playerStats, npcData, playerHand, npcHand); DisplayInfoCard(2); } // if the target is crossed then start a new round and move cards to pot // this is infocard case 3 else if (battleManager.currentNumber > battleManager.targetNumber) { Debug.Log("Target number is crossed. Moving cards to Pot and starting a new round."); battleManager.SwitchTurn(); table.ClearTable(CardCollections.Pot); nextPhase = new NewRound(battleManager, playerStats, npcData, playerHand, npcHand); DisplayInfoCard(3); } // if the target is reached then start a new round and move cards to graveyard // this is infocard case 4 else if (battleManager.currentNumber == battleManager.targetNumber) { Debug.Log("Target number is reached. Moving cards to Graveyard and starting a new round."); battleManager.SwitchTurn(); // empty table and pot before new round table.ClearTable(CardCollections.Graveyard); pot.EmptyPot(); nextPhase = new NewRound(battleManager, playerStats, npcData, playerHand, npcHand); DisplayInfoCard(4); } // if neither of the above then continue the same round and switch turns // this is infocard case 5 else { Debug.Log(battleManager.playerTurn + " player's turn has ended. Switching sides."); battleManager.SwitchTurn(); nextPhase = new CardDeal(battleManager, playerStats, npcData, playerHand, npcHand); DisplayInfoCard(5); } }
/// <summary> /// Handles the message. /// </summary> /// <param name="message">The message.</param> public void Handle(NewRound message) { if (message.Current <= 1) { return; } events.PublishOnBackgroundThread(new TrayNotification("New round", String.Format("Round #{0}, {1}", message.Current, message.MyTurn ? "your turn" : "enemy turn"), 3000) { BalloonType = BalloonTypes.GameTurns }); }
public List <Block> SplitBlock() { CityCenter = GetCityCenter(); var blocks = new List <Block>(); int round = 1; while (Spread(round++, blocks)) { blocks = blocks.Where(i => i.InCity).ToList(); var left = (from q in blocks orderby q.Center.Lng select q.Center.Lng).FirstOrDefault(); var top = (from q in blocks orderby q.Center.Lat descending select q.Center.Lat).FirstOrDefault(); var bottom = (from q in blocks orderby q.Center.Lat select q.Center.Lat).FirstOrDefault(); var right = (from q in blocks orderby q.Center.Lng descending select q.Center.Lng).FirstOrDefault(); MapPainter mp = new MapPainter(left, top, bottom, right); foreach (var block in blocks) { mp.Draw(block.Center.Lat, block.Center.Lng, block.DistrictColor); } if (NewRound != null) { NewRound.Invoke(this, new NewRoundEventArgs() { Count = blocks.Count, Map = mp.Map }); } } return(blocks); }
/// <summary> /// Handles the message. /// </summary> /// <param name="message">The message.</param> public void Handle(NewRound message) { this.WindowFound = true; Turns = message.Current; MyTurn = message.MyTurn; }
/// <summary>Handles the message.</summary> /// <param name="message">The message.</param> public void Handle(NewRound message) { Turns = message.Current; }
void MoveToNextPhase() { nextPhase = new NewRound(battleManager, playerStats, npcData, base.playerHand, npcHand); stage = Stages.Exit; }