private void OnExiting() { if (this.isExiting) { return; } this.batcher?.Dispose(); this.batcher = null; this.renderEnv?.Dispose(); this.renderEnv = null; this.engine = null; foreach (var disposable in this.attachedEvent) { disposable.Dispose(); } this.attachedEvent.Clear(); this.ui?.InputBindings.Clear(); GameExt.RemoveKeyboardEvent(this); GameExt.RemoveMouseStateCache(); WcR2Engine.Unload(); ServiceManager.Instance.RemoveService <IMEHandler>(); this.isExiting = true; }
public FrmMapRender2(Wz_Image img) { graphics = new GraphicsDeviceManager(this); graphics.DeviceCreated += Graphics_DeviceCreated; this.mapImg = img; this.MaxElapsedTime = TimeSpan.MaxValue; this.IsFixedTimeStep = false; this.TargetElapsedTime = TimeSpan.FromSeconds(1.0 / 60); this.InactiveSleepTime = TimeSpan.FromSeconds(1.0 / 30); this.IsMouseVisible = true; this.Content = new WcR2ContentManager(this.Services); this.patchVisibility = new PatchVisibility(); this.patchVisibility.FootHoldVisible = false; this.patchVisibility.LadderRopeVisible = false; this.patchVisibility.SkyWhaleVisible = false; var form = Form.FromHandle(this.Window.Handle) as Form; form.Load += Form_Load; form.GotFocus += Form_GotFocus; form.LostFocus += Form_LostFocus; form.FormClosing += Form_FormClosing; form.FormClosed += Form_FormClosed; this.imeHelper = new IMEHandler(this, true); GameExt.FixKeyboard(this); }
protected override void Dispose(bool disposing) { if (disposing) { GameExt.DisposeSwapChain(this.GraphicsDevice); } base.Dispose(disposing); }
protected override void Dispose(bool disposing) { if (disposing) { this.UnloadContent(); this.OnExiting(); GameExt.DisposeSwapChain(this.GraphicsDevice); } base.Dispose(disposing); }
protected override void OnExiting(object sender, EventArgs args) { base.OnExiting(sender, args); this.batcher.Dispose(); this.batcher = null; this.renderEnv.Dispose(); this.renderEnv = null; this.engine = null; GameExt.RemoveKeyboardEvent(this); GameExt.RemoveMouseStateCache(); WcR2Engine.Unload(); }
protected override void OnExiting(object sender, EventArgs args) { base.OnExiting(sender, args); this.batcher.Dispose(); this.batcher = null; this.renderEnv.Dispose(); this.renderEnv = null; this.engine = null; foreach (var disposable in this.attachedEvent) { disposable.Dispose(); } this.attachedEvent.Clear(); this.ui.InputBindings.Clear(); GameExt.RemoveKeyboardEvent(this); GameExt.RemoveMouseStateCache(); WcR2Engine.Unload(); ServiceManager.Instance.RemoveService <IMEHandler>(); }
private void Form_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e) { GameExt.EnsureGameExit(this); }
private void Form_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e) { GameExt.ReleaseKeyboard(this); }