public void Show(bool IsBestScore, int oldBestScore, EndGameReason reason) { Debug.LogError("FinishedGamePopup Show"); ResetComponents(); GameState GS = GameSceneManager.Instance.GameState; int StarsToActivate = 0; if (IsBestScore) { StarsToActivate = 3; } else { if (oldBestScore != 0) { float pctToBest = (GS.Score * 100) / oldBestScore; if (pctToBest >= 33f) { StarsToActivate++; } if (pctToBest >= 66f) { StarsToActivate++; } if (pctToBest >= 99f) { StarsToActivate++; } } } if (reason == EndGameReason.OUT_OF_TIME) { GameOverText.SetText(GameUtils.GetTranslatedText("TimeIsUp")); } else { GameOverText.SetText("GAME OVER"); } BestScoreTxt.SetText(oldBestScore.ToString()); ScoreTxt.SetText(GS.Score.ToString()); SavedAliensTxt.SetText(GS.CurrentSavedAliens.ToString()); StolenBriefcasesTxt.SetText(GS.CurrentStolenBriefcases.ToString()); gameObject.SetActive(true); // Debug.LogError("pass 2"); AnimCoroutine = Animate(IsBestScore, StarsToActivate); StartCoroutine(AnimCoroutine); }
private void RaiseResigned(EndGameReason reason, bool whiteFinishedGame) { var statistic = new GameResult { EndReason = reason, TotalMoves = this.movesCount, BoardSize = this.duel.BoardSize }; if (reason == EndGameReason.Resign) { statistic.WinnerName = whiteFinishedGame ? this.duel.BlackBot : this.duel.WhiteBot; statistic.LooserName = !whiteFinishedGame ? this.duel.BlackBot : this.duel.WhiteBot; } else { var score = this.GetFinalScore().Result; statistic.FinalScore = score.Item1; if (score.Item2 == Color.White) { statistic.WinnerName = this.duel.WhiteBot; statistic.LooserName = this.duel.BlackBot; } else if (score.Item2 == Color.Black) { statistic.WinnerName = this.duel.BlackBot; statistic.LooserName = this.duel.WhiteBot; } } if (this.GenerateLastBoard) { statistic.FinalBoard = this.GetLastBoard().Result; } if (this.SaveGameResults) { var fileName = string.Format("{0}{1}", this.duel.Name, DateTime.Now.ToString("yyyy-mm-dd_HH-mm-ss")); this.process.WriteData("printsgf " + fileName + ".sgf"); statistic.ResultsFileName = fileName; this.configurationService.SerializeGameResult(statistic, fileName); } this.Resigned(statistic); }
public void Stop(EndGameReason reason) { _timer.Dispose(); _result.EndGameReason = reason; OnGameEnd?.Invoke(_result); foreach (var p in _playersThreads) { try { p.Abort(); } catch (ThreadAbortException) { } } }
private void RenderEndGameInfo(EndGameReason endGameReason) { Console.Write("Игра завершена. "); switch (endGameReason) { case EndGameReason.Win: Console.WriteLine("Вы победили"); break; case EndGameReason.Defeat: Console.WriteLine("Вы проиграли"); break; case EndGameReason.Manual: Console.WriteLine("Вы завершили игру досрочно"); break; } Console.WriteLine("Ваша статистика:"); Console.WriteLine($"Количество ходов: {_gameModel.GameState.StepsCount}"); }
protected virtual void StateUpdate(State gameState, EndGameReason reason, int execOrder) { RaiseEvent(currentState); PrintState(execOrder); }