public void InvokeCompletion() { EventBinder <Action> onDispose = new EventBinder <Action>(e => OnSoftDispose += e, e => OnSoftDispose -= e); onDispose.IsOneTime = true; onDispose.SetHandler(() => { OnCompletion?.Invoke(); // Wait for completion timeout to auto navigate to results. SynchronizedTimer autoExitTimer = new SynchronizedTimer() { Limit = 2f, }; autoExitTimer.OnFinished += Model.ExitGameToResult; autoExitTimer.Start(); }); SynchronizedTimer initialTimer = new SynchronizedTimer() { Limit = 0.5f }; initialTimer.OnFinished += InvokeSoftDispose; initialTimer.Start(); }
/// <summary> /// Starts displaying the cover image for the specified mapset. /// </summary> public void Setup(OnlineMapset mapset) { Reset(); this.mapset = mapset; if (mapset == null) { return; } string cardImage = mapset.CardImage; // If the image is already loaded in cacher, just load image immediately. if (WebImageCacher.IsCached(cardImage)) { Load(cardImage); } // Else, load the image after delay to reduce performance implications when scrolling quickly. else { loadDelay = new SynchronizedTimer() { Limit = 1f }; loadDelay.OnFinished += () => { loadDelay = null; Load(cardImage); }; loadDelay.Start(); } }
public NotificationsCenterBase(TimeSpan dueTime, TimeSpan interval, int eventsPerInterval) { _users = new OrderedDictionary(); _timer = new SynchronizedTimer(OnTimertick, dueTime, interval); _eventsPerInterval = eventsPerInterval; Start(); }
/// <summary> /// Hides the cover image. /// </summary> public void Reset() { this.mapset = null; Unload(); if (loadDelay != null) { loadDelay.Stop(); loadDelay = null; } }
void Awake() { InitializeModules(); var timer = new SynchronizedTimer() { Limit = 0.01f, WaitFrameOnStart = true, }; timer.OnFinished += PostInitialize; timer.Start(); }
/// <summary> /// Waits for a certain amount of time and navigates away to initialize screen. /// </summary> protected override void OnPostShow() { base.OnPostShow(); var timer = new SynchronizedTimer(); timer.OnFinished += () => { if (ScreenNavigator != null) { ScreenNavigator.Show <InitializeScreen>(); } }; timer.Limit = 1f; timer.Start(); }
protected virtual void Dispose(bool disposing) { if (disposing) { if (null != _timer) { Stop(); _timer.Dispose(); _timer = null; } if (null != _users) { _users.Clear(); _users = null; } } }
private void RunDummyTask(ManualTask <DummyCacherData> task, string key) { var timer = new SynchronizedTimer() { Limit = 1f }; timer.OnFinished += () => { task.SetFinished(new DummyCacherData() { Key = key, IsDestroyed = false }); }; timer.OnProgress += task.SetProgress; timer.Start(); }