private void OnApplicationPause(bool pause) { if (pause) { OnQuit?.Invoke(); } }
public static void ProcessEvents() { while (SDL_PollEvent(out var ev) == 1) { switch (ev.type) { case SDL_EventType.SDL_QUIT: OnQuit?.Invoke(); break; case SDL_EventType.SDL_KEYDOWN: case SDL_EventType.SDL_KEYUP: ProcessKeyEvent(ev); break; case SDL_EventType.SDL_MOUSEBUTTONDOWN: case SDL_EventType.SDL_MOUSEBUTTONUP: case SDL_EventType.SDL_MOUSEMOTION: ProcessMouseEvent(ev); break; case SDL_EventType.SDL_WINDOWEVENT: ProcessWindowEvent(ev); break; case SDL_EventType.SDL_CONTROLLERDEVICEADDED: break; case SDL_EventType.SDL_CONTROLLERDEVICEREMOVED: break; } } }
public void Quit() { OnQuit?.Invoke(); OnQuit = null; Time.timeScale = 1; SceneManager.LoadScene(0); }
private void OnApplicationFocus(bool focus) { if (!focus) { OnQuit?.Invoke(); } }
internal void Quit(string msg) { if (OnQuit != null) { OnQuit.Invoke(this, msg); } }
private void Update() { if (input.Esc) { OnQuit.Invoke(); } }
private void Update() { if (Input.GetKey(KeyCode.Escape)) { OnQuit?.Invoke(); } }
public void Execute(string[] args) { var ts = new TemplateSpecification(); foreach (var q in ts.Questions) { string answer = q.AskQuestion(); if (IsQuit(answer)) { OnQuit.Invoke(this, null); } } ts.ProcessChoices(); Console.WriteLine(); var json = JsonConvert.SerializeObject(ts, Formatting.Indented); Console.WriteLine(); Console.WriteLine("Serialised Result (that is passed to template creation service):"); Console.WriteLine(); Console.WriteLine(json); }
private static void BeforeQuit() { OnBeforeQuit?.Invoke(); Console.WriteLine("Press a key to complete..."); Console.ReadKey(); OnQuit?.Invoke(); }
/// <summary> /// Stops the API. /// </summary> public void Stop() { //Mark the API as not running. IsRunning = false; Logger.Log("EliteAPI has been terminated."); OnQuit?.Invoke(this, EventArgs.Empty); }
/// <summary> /// Verarbeitet das Verlassen eines Users des Servers /// </summary> /// <seealso cref="OnQuit"/> private void _connection_OnQuit(object sender, QuitEventArgs e) { Log.Information("{Nickname} hat den Server verlassen ({QuitMessage})", e.Who, e.QuitMessage); MaintainUser(e.Who); ThreadPool.QueueUserWorkItem(x => { OnQuit?.Invoke(this, e); }); }
public void OnQuitIconClicked() { if (OnQuit != null) { OnQuit.Invoke(); } OnUnfocus(); Application.Quit(); }
private void load(OsuColour colours) { AddButton("Continue", colours.Green, () => OnResume?.Invoke()); AddButton("Retry", colours.YellowDark, () => OnRetry?.Invoke()); AddButton("Quit", new Color4(170, 27, 39, 255), () => OnQuit?.Invoke()); AddInternal(pauseLoop = new SkinnableSound(new SampleInfo("pause-loop")) { Looping = true, Volume = { Value = 0 } }); }
private static void HandleStandardKey(ConsoleKeyInfo?keyInfo) { string key = keyInfo.Value.KeyChar.ToString(); switch (key) { case " ": // Refresh Console.Clear(); break; case "|": ConsoleEx.WriteLineEnh("*Cancelling..*"); _cts.Cancel(); ShortDelay(); Console.Clear(); break; case "^": // Restart (forget all state) if (ConsoleEx.PromptEnhForInputKeysUpper("Are you sure? Y/N ", "yn") == "Y") { ConsoleEx.WriteLineEnh("*Restarting..* (if supported)"); ShortDelay(); OnRestart?.Invoke(); ShortDelay(); Console.Clear(); } else { ShortDelay(); Console.Clear(); } break; case "q": // Quit (lower) if (ConsoleEx.PromptEnhForInputKeysUpper("Are you sure? Y/N ", "yn") == "Y") { ConsoleEx.WriteLineEnh("\n*Quitting..*"); ShortDelay(); OnQuit?.Invoke(); ShortDelay(); _running = false; } else { ShortDelay(); Console.Clear(); } break; case "Q": // Quit (upper) ConsoleEx.WriteLineEnh("*Quitting..*"); ShortDelay(); OnQuit?.Invoke(); ShortDelay(); _running = false; break; default: break; } }
public override Task StopAsync(CancellationToken cancellationToken) { streams.ForEach(stream => { stream.Dispose(); }); //close all FileStreams to allow for deletion OnQuit?.Invoke(); //delete unfinished files var serializer = new BinaryFormatter(); serializer.Serialize(File.Open($@"{FwgetterDir}\ipsw\last.bin", FileMode.OpenOrCreate), lastUpdates);//write log of downloaded files _logger.LogCritical("successfully saved update log "); return(base.StopAsync(cancellationToken)); }
private void load(OsuColour colours) { AddButton("Continue", colours.Green, () => OnResume?.Invoke()); AddButton("Retry", colours.YellowDark, () => OnRetry?.Invoke()); AddButton("Quit", new Color4(170, 27, 39, 255), () => OnQuit?.Invoke()); AddInternal(pauseLoop = new SkinnableSound(new SampleInfo("pause-loop")) { Looping = true, }); // SkinnableSound only plays a sound if its aggregate volume is > 0, so the volume must be turned up before playing it pauseLoop.VolumeTo(minimum_volume); }
public RuntimeService() { _runtimeGameObject = new GameObject("RuntimeClients"); Object.DontDestroyOnLoad(_runtimeGameObject); _runtimeClient = RegisterClient <RuntimeClient>(); _runtimeClient.OnUpdate += () => OnUpdate?.Invoke(); _runtimeClient.OnFixedUpdate += () => OnFixedUpdate?.Invoke(); _runtimeClient.OnLateUpdate += () => OnLateUpdate?.Invoke(); _runtimeClient.OnQuit += () => OnQuit?.Invoke(); _runtimeClient.OnPause += pause => OnPause?.Invoke(pause); }
public void Exit(string input) { if (!pauseMode) { OnQuit?.Invoke(); #if UNITY_EDITOR UnityEditor.EditorApplication.isPlaying = false; #else Application.Quit(); #endif } else { SceneManager.LoadScene("MainMenu"); } }
internal void Stop() { if (hasStopped) { return; } LogMuxer.Instance.Debug("Killing child processes"); foreach (var wrapper in _programPool) { wrapper.Stop(); } // First we notify all running process to quit LogMuxer.Instance.Debug("Killing subprocesses"); foreach (var pid in ProgramWrapper.GetChildProcessIds(ProgramWrapper.SelfProcessId)) { ProgramWrapper.QuitProcess(Process.GetProcessById(pid)); } // ExecStop // only if the service started successfully if (hasStartedSuccessfully) { LogMuxer.Instance.Debug("Executing ExecStop"); for (var i = 0; i < Globals.Config.ExecStop.Count; ++i) { Run(Globals.Config.ExecStop[i], "ExecStop", i, isAsync: false); } } // ExecStopPost LogMuxer.Instance.Debug("Executing ExecStopPost"); for (var i = 0; i < Globals.Config.ExecStopPost.Count; ++i) { Run(Globals.Config.ExecStopPost[i], "ExecStopPost", i, isAsync: false); } OnQuit?.Invoke(this, null); hasStopped = true; }
private void load(OsuColour colours) { AddButton("Retry", colours.YellowDark, () => OnRetry?.Invoke()); AddButton("Quit", new Color4(170, 27, 39, 255), () => OnQuit?.Invoke()); Add(new Container { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.X, Height = TwoLayerButton.SIZE_EXTENDED.Y, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Color4Extensions.FromHex("#333") }, new FillFlowContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, AutoSizeAxes = Axes.X, RelativeSizeAxes = Axes.Y, Spacing = new Vector2(5), Padding = new MarginPadding(10), Direction = FillDirection.Horizontal, Children = new Drawable[] { new SaveScoreButton() { OnSave = OnSave, RelativeSizeAxes = Axes.Y, Width = 300 }, } } } }); }
private void load(OsuColour colours) { AddButton("Continue", colours.Green, () => OnResume?.Invoke()); AddButton("Retry", colours.YellowDark, () => OnRetry?.Invoke()); AddButton("Quit", new Color4(170, 27, 39, 255), () => OnQuit?.Invoke()); }
public static void Run(string title, int width, int height, ErrorHandler errorHandler) { App.errorHandler = errorHandler; if (errorHandler != null) { try { Run(); } catch (Exception e) { errorHandler(e); } } else { Run(); } void Run() { if (platform == null) { throw new Exception("App has not been initialized."); } if (Running) { throw new Exception("App is already running."); } Running = true; platform.Init(title, width, height); platform.CenterWindow(); platform.OnQuit += Quit; platform.OnWinClose += Quit; platform.OnWinFocusGained += () => Focused = true; platform.OnWinFocusLost += () => Focused = false; GL.Init(); Time.Init(1f / 60f); Screen.Init(); Mouse.Init(); Keyboard.Init(); Joystick.Init(); OnInit?.Invoke(); double prevTime = platform.GetTime(); double frameTimer = 0.0; while (Running) { platform.PollEvents(); if (!Focused && !UpdateWhileFocused) { prevTime = (float)platform.GetTime(); continue; } if (Running) { double currTime = platform.GetTime(); double deltaTime = currTime - prevTime; if (deltaTime > 0.0) { FPS = (int)(1.0 / (currTime - prevTime)); } prevTime = currTime; if (FixedFramerate) { if (!Screen.VSync) { frameTimer += deltaTime; while (frameTimer >= frameDuration) { frameTimer -= frameDuration; Update(frameDuration); } } else { Update(frameDuration); } } else { Update(deltaTime); } void Update(double dt) { Time.PreUpdate((float)dt); Mouse.PreUpdate(); OnUpdate?.Invoke(); Mouse.PostUpdate(); Keyboard.PostUpdate(); Joystick.PostUpdate(); Texture.UnbindAll(); DrawCall.Begin(); OnRender?.Invoke(); DrawCall.End(); platform.SwapBuffers(); } } } OnQuit?.Invoke(); platform.Quit(); } }
private void OnApplicationQuit() { OnQuit.Invoke(); }
public virtual void Quit() { AudioManager.Instance.PlaySound(cancelClip); if (OnQuit != null) OnQuit.Invoke(); }
private void RenderWindowOnClosed(object sender, EventArgs e) { OnQuit?.Invoke(this); RenderWindow.Close(); }
public override void PollEvents() { while (SDL.PollEvent(out ev) == 1) { switch (ev.Type) { case EventType.Quit: OnQuit?.Invoke(); break; case EventType.KeyDown: OnKeyDown?.Invoke(ev.Key.Keysym.Sym, ev.Key.Keysym.ScanCode); break; case EventType.KeyUp: OnKeyUp?.Invoke(ev.Key.Keysym.Sym, ev.Key.Keysym.ScanCode); break; case EventType.MouseMotion: OnMouseMove?.Invoke(ev.Motion.X, ev.Motion.Y); break; case EventType.MouseButtonDown: OnMouseButtonDown?.Invoke(ev.Button.Button); break; case EventType.MouseButtonUp: OnMouseButtonUp?.Invoke(ev.Button.Button); break; case EventType.MouseWheel: OnMouseScroll?.Invoke(ev.Wheel.X, ev.Wheel.Y); break; case EventType.JoyDeviceAdded: OnJoyDeviceAdd?.Invoke(ev.JDevice.Which); break; case EventType.JoyDeviceRemoved: OnJoyDeviceRemove?.Invoke(ev.JDevice.Which); break; case EventType.JoyButtonDown: OnJoyButtonDown?.Invoke(ev.JButton.Which, ev.JButton.Button); break; case EventType.JoyButtonUp: OnJoyButtonDown?.Invoke(ev.JButton.Which, ev.JButton.Button); break; case EventType.JoyAxisMotion: OnJoyAxisMove?.Invoke(ev.JAxis.Which, ev.JAxis.Axis, ev.JAxis.Value / (float)short.MaxValue); break; case EventType.WindowEvent: if (ev.Window.WindowID == windowID) { switch (ev.Window.Event) { case WindowEventID.Close: OnWinClose?.Invoke(); break; case WindowEventID.Shown: OnWinShown?.Invoke(); break; case WindowEventID.Hidden: OnWinHidden?.Invoke(); break; case WindowEventID.Exposed: OnWinExposed?.Invoke(); break; case WindowEventID.Moved: OnWinMoved?.Invoke(); break; case WindowEventID.Resized: OnWinResized?.Invoke(); break; case WindowEventID.Minimized: OnWinMinimized?.Invoke(); break; case WindowEventID.Maximized: OnWinMaximized?.Invoke(); break; case WindowEventID.Restored: OnWinRestored?.Invoke(); break; case WindowEventID.Enter: OnWinEnter?.Invoke(); break; case WindowEventID.Leave: OnWinLeave?.Invoke(); break; case WindowEventID.FocusGained: OnWinFocusGained?.Invoke(); break; case WindowEventID.FocusLost: OnWinFocusLost?.Invoke(); break; default: OnWinOtherEvent?.Invoke((int)ev.Window.Event); break; } } break; default: OnOtherEvent?.Invoke((int)ev.Type); break; } } }
public void OnQuickClicked() { OnQuit?.Invoke(this, EventArgs.Empty); }
void OnPlatformClose(object sender, EventArgs e) { OnQuit?.Invoke(this, e); }
private static void RaiseOnQuit() { IsQuitting = true; OnQuit?.Invoke(); OnQuit = null; }
public void quitGame() { Time.timeScale = 1f; SceneManager.LoadScene("Main Menu"); OnQuit?.Invoke(); }