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(); }
public void InvokeRetry() { EventBinder <Action> onDispose = new EventBinder <Action>(e => OnSoftDispose += e, e => OnSoftDispose -= e); onDispose.IsOneTime = true; onDispose.SetHandler(() => { OnRetry?.Invoke(); InvokeSoftInit(); }); InvokeSoftDispose(); }
public void InvokeForceQuit() { EventBinder <Action> onDispose = new EventBinder <Action>(e => OnSoftDispose += e, e => OnSoftDispose -= e); onDispose.IsOneTime = true; onDispose.SetHandler(() => { OnForceQuit?.Invoke(); Model.ExitGameForceful(); }); InvokeSoftDispose(); }
/// <summary> /// Event called on selecting offset option. /// </summary> private void OnOffsetOption() { // Show the offset overlay. OffsetsOverlay overlay = OverlayNavigator.Show <OffsetsOverlay>(); // Bind temporary hide event listener to overlay. EventBinder <Action> closeBinder = new EventBinder <Action>( e => overlay.OnHide += e, e => overlay.OnHide -= e ); closeBinder.IsOneTime = true; // Show pause overlay once the offset overlay has been closed. closeBinder.SetHandler(() => OverlayNavigator.Show <PauseOverlay>()); }