private void ScheduleCrateExpireBadgeUpdate() { ViewTimerManager viewTimerManager = Service.Get <ViewTimerManager>(); uint time = ServerTime.Time; if (this.expireBadgeTimerId != 0u) { viewTimerManager.KillViewTimer(this.expireBadgeTimerId); } if (!Service.IsSet <CurrentPlayer>()) { return; } CrateData crateSoonestToExpire = this.GetCrateSoonestToExpire(time); if (crateSoonestToExpire == null) { return; } uint expiresTimeStamp = crateSoonestToExpire.ExpiresTimeStamp; uint num = expiresTimeStamp - time; if (num <= 432000u) { this.expireBadgeTimerId = viewTimerManager.CreateViewTimer(num, false, new TimerDelegate(this.UpdateBadgesAfterCrateExpire), null); } }
private void ScheduleCrateExpireToast() { ViewTimerManager viewTimerManager = Service.Get <ViewTimerManager>(); uint num = (uint)(GameConstants.CRATE_EXPIRATION_WARNING_TOAST * 60); uint time = ServerTime.Time; uint afterTime = time + num; if (this.expireToastTimerId != 0u) { viewTimerManager.KillViewTimer(this.expireToastTimerId); } if (!Service.IsSet <CurrentPlayer>()) { return; } CrateData crateSoonestToExpire = this.GetCrateSoonestToExpire(afterTime); if (crateSoonestToExpire == null) { return; } uint num2 = crateSoonestToExpire.ExpiresTimeStamp - num; uint num3 = num2 - time; if (num3 <= 432000u) { this.nextCrateExpireTime = crateSoonestToExpire.ExpiresTimeStamp; this.expireToastTimerId = viewTimerManager.CreateViewTimer(num3, false, new TimerDelegate(this.AttemptShowCrateExpireToast), null); } }
private void OnOfferingUpdated(GetShardOfferingResponse response, object cookie) { bool flag; if (this.CurrentShopData == null) { flag = (response.ShopData != null); } else { flag = this.CurrentShopData.HasOfferChanged(response.ShopData); } if (flag) { this.CurrentShopData = response.ShopData; Service.EventManager.SendEvent(EventId.ShardOfferChanged, null); } ViewTimerManager viewTimerManager = Service.ViewTimerManager; if (this.expirationTimer != 0u) { viewTimerManager.KillViewTimer(this.expirationTimer); } int num = (int)(Service.ServerAPI.ServerTime + (uint)((int)(this.CurrentShopData.OffsetMinutes * 60f))); float num2 = (float)((ulong)this.CurrentShopData.Expiration - (ulong)((long)num)); num2 = Math.Max(1f, Math.Min(num2, 432000f)); this.expirationTimer = viewTimerManager.CreateViewTimer(num2, false, new TimerDelegate(this.OnOfferExpired), null); if (cookie != null) { Action action = (Action)cookie; action(); } this.AdjustOfferQuantities(); }
private void ScheduleNextRefresh() { Service.Logger.Debug("Next Scheduled Episode Refresh at: " + this.nextScheduledRefreshDate.ToString()); ViewTimerManager viewTimerManager = Service.ViewTimerManager; if (this.scheduleTimerId != 0u) { viewTimerManager.KillViewTimer(this.scheduleTimerId); } TimeSpan timeSpan = this.nextScheduledRefreshDate.Subtract(Service.ServerAPI.ServerDateTime); if (timeSpan.TotalMilliseconds > 0.0 && timeSpan.TotalMilliseconds < 432000000.0) { this.scheduleTimerId = viewTimerManager.CreateViewTimer((float)timeSpan.TotalSeconds, false, new TimerDelegate(this.AttemptRefresh), null); } }
public void ScheduleGivingNextDailyCrate() { this.CancelDailyCrateScheduledTimer(); ViewTimerManager viewTimerManager = Service.Get <ViewTimerManager>(); InventoryCrates crates = Service.Get <CurrentPlayer>().Prizes.Crates; uint nextDailCrateTimeWithSyncBuffer = crates.GetNextDailCrateTimeWithSyncBuffer(); uint time = ServerTime.Time; uint num = 0u; if (nextDailCrateTimeWithSyncBuffer > time) { num = nextDailCrateTimeWithSyncBuffer - time; } if (num <= 432000u) { this.nextDailyCrateTimerId = viewTimerManager.CreateViewTimer(num, false, new TimerDelegate(this.UpdateDailyCrateInventory), null); } }
public EatResponse OnScroll(float delta, Vector2 screenPosition) { this.camera.StopAddonBehaviors(); this.camera.SetCameraFeel(CameraFeel.Fast); if (this.CameraZoom(delta * 20f, this.scrollImmediate)) { this.scrollImmediate = true; } ViewTimerManager viewTimerManager = Service.Get <ViewTimerManager>(); if (this.scrollTimer != 0u) { viewTimerManager.KillViewTimer(this.scrollTimer); } this.scrollTimer = viewTimerManager.CreateViewTimer(0.1f, false, new TimerDelegate(this.OnScrollTimer), null); Service.Get <EventManager>().SendEvent(EventId.UserStartedCameraMove, null); return(EatResponse.Eaten); }
public void PlayAudioRepeat(string id, int repeatCount, float delay, float interval) { if (repeatCount == 0) { this.logger.WarnFormat("Trying to play audio {0} with repeat count = 0, use PlayAudio", new object[] { id }); return; } uint[] array = new uint[repeatCount]; ViewTimerManager viewTimerManager = Service.ViewTimerManager; for (int i = 0; i < repeatCount; i++) { float delay2 = delay + (float)(i + 1) * interval; array[i] = viewTimerManager.CreateViewTimer(delay2, false, new TimerDelegate(this.PlayAudioDelayedCallback), id); } this.SetAudioRepeatTimers(id, array); }
public void OnVantageSwitch(bool topDown) { ViewTimerManager viewTimerManager = Service.Get <ViewTimerManager>(); if (this.switchingVantage) { viewTimerManager.KillViewTimer(this.switchingVantageTimer); } else { this.switchingVantage = true; } this.switchingVantageTimer = viewTimerManager.CreateViewTimer(0.5f, false, new TimerDelegate(this.OnVantageSwitchTimer), null); if (topDown) { this.mapHighYSuper = this.mapHighYSuperTopDown; this.mapHighYEarly = this.mapHighYEarlyTopDown; return; } this.mapHighYSuper = this.mapHighYSuperTopDown - 200f; this.mapHighYEarly = this.mapHighYEarlyTopDown - 200f; }