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; }
protected override void Initialize() { //init services this.Services.AddService <Random>(new Random()); this.Services.AddService <IRandom>(new ParticleRandom(this.Services.GetService <Random>())); this.Services.AddService <IMEHandler>(this.imeHelper); ServiceManager.Instance.AddService <IMEHandler>(this.imeHelper); //init components this.renderEnv = new RenderEnv(this, this.graphics); this.batcher = new MeshBatcher(this.GraphicsDevice) { CullingEnabled = true }; this.resLoader = new ResourceLoader(this.Services); this.ui = new MapRenderUIRoot(); this.BindingUIInput(); this.tooltip = new Tooltip2(this.Content); this.tooltip.StringLinker = this.StringLinker; this.cm = new CoroutineManager(this); this.cm.StartCoroutine(OnStart()); //entry this.Components.Add(cm); this.fpsCounter = new FpsCounter(this) { UseStopwatch = true }; this.Components.Add(fpsCounter); this.ApplySetting(); SwitchResolution(Resolution.Window_800_600); base.Initialize(); }
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>(); }
protected override void Initialize() { this.renderEnv = new RenderEnv(this, this.graphics); this.batcher = new MeshBatcher(this.GraphicsDevice); this.resLoader = new ResourceLoader(this.Services); this.ui = new MapRenderUIRoot(); this.BindingUIInput(); this.tooltip = new Tooltip2(this.GraphicsDevice); this.tooltip.StringLinker = this.StringLinker; this.cm = new CoroutineManager(this); this.cm.StartCoroutine(OnStart()); //entry this.Components.Add(cm); this.fpsCounter = new FpsCounter(this) { UseStopwatch = true }; this.Components.Add(fpsCounter); this.ApplySetting(); SwitchResolution(Resolution.Window_800_600); base.Initialize(); }