private void displayGameStartCountdown() { if (!gameStartCountdownTimerOn) { nextGameStartTime = TimeUtils.calculateNextMultipleAfterTheHour(contentSchedulerService.PresentTime(), islandTargetsPlayground.EveryXMinutesAfterTheHour); } gameStartCountdownTimerOn = true; DateTime value = contentSchedulerService.PresentTime(); float num = (float)nextGameStartTime.Subtract(value).TotalSeconds; if (num <= 30f && num > 5f) { if (SideScoreboards[0].CurrentState != IslandTargetsSideScoreboard.SideScoreboardState.ThirtySecsGameStartMark) { gotoThirtySecsGameStartMarkState(); } } else if (num <= 5f && num > 0f) { gotoFiveSecsGameStartMarkState(); stopGameStartCountdown(clearCountdownText: false); return; } int num2 = (int)num / 60; int num3 = (int)num % 60; GameStartCountdownTimerText.characterSize = scaleCountdownText; GameStartCountdownTimerText.text = $"{num2}:{num3:00}"; }
private void Awake() { dispatcher = playgroundController.EventDispatcher; eventChannel = new EventChannel(dispatcher); contentSchedulerService = Service.Get <ContentSchedulerService>(); localizer = Service.Get <Localizer>(); dataEntityCollection = Service.Get <CPDataEntityCollection>(); evergreenMusicTarget = GameObject.Find(EvergreenMusicTargetPath); EventManager.Instance.PostEvent(MusicEventName, EventAction.PlaySound, evergreenMusicTarget); createCoMusicTarget = GameObject.Find(CrateCoMusicTargetPath); Service.Get <EventDispatcher>().AddListener <ZoneTransitionEvents.ZoneTransition>(onZoneTransition); Service.Get <EventDispatcher>().AddListener <RewardServiceEvents.RewardsEarned>(onRewardsEarned); Service.Get <EventDispatcher>().AddListener <IslandTargetsEvents.ClockTowerStateChanged>(onClockTowerStateChange); if (DisableWhenNoGameServer.IsGameServerAvailable()) { gameTimer = new Timer(1f, repeat: true, delegate { onGameTimerTick(); }); animatorFloatingClock = ClockTimer.GetComponentInChildren <Animator>(); CoroutineRunner.Start(setScarecrowVisible(isVisible: true), this, "setScarecrowVisible"); CoroutineRunner.Start(setClockTimerVisible(isVisible: false), this, "setClockTimerVisible"); eventChannel.AddListener <IslandTargetsEvents.TargetsRemainingUpdated>(onTargetsRemainingUpdated); eventChannel.AddListener <IslandTargetsEvents.GameRoundStarted>(onRoundStarted); eventChannel.AddListener <IslandTargetsEvents.GameRoundEnded>(onRoundEnded); eventChannel.AddListener <IslandTargetsEvents.TargetGameTimeOut>(onGameTimeOut); eventChannel.AddListener <IslandTargetsEvents.StatsUpdated>(onStatsUpdated); if (TimeUtils.isMultipleOfXMinutesAfterTheHour(contentSchedulerService.PresentTime(), islandTargetsPlayground.EveryXMinutesAfterTheHour)) { gotoFiveSecsGameStartMarkState(); } else { InvokeRepeating("displayGameStartCountdown", 0f, 1f); } } else { ClockTimer.SetActive(value: false); WinStreakText.SetText(BestEverStreak.ToString()); DailyRecordText.transform.parent.gameObject.SetActive(value: false); } if (string.IsNullOrEmpty(BI_Tier1Name)) { BI_Tier1Name = "crate_co_game"; Log.LogError(this, $"Error: Tier1 name for BI is not set on '{base.gameObject.GetPath()}'"); } }