Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         GameExt.DisposeSwapChain(this.GraphicsDevice);
     }
     base.Dispose(disposing);
 }
Ejemplo n.º 4
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         this.UnloadContent();
         this.OnExiting();
         GameExt.DisposeSwapChain(this.GraphicsDevice);
     }
     base.Dispose(disposing);
 }
Ejemplo n.º 5
0
        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();
        }
Ejemplo n.º 6
0
        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>();
        }
Ejemplo n.º 7
0
 private void Form_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e)
 {
     GameExt.EnsureGameExit(this);
 }
Ejemplo n.º 8
0
 private void Form_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e)
 {
     GameExt.ReleaseKeyboard(this);
 }