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();
        }
Beispiel #3
0
 private void UpdateNode(MapSceneNode node, GameTime gameTime, RenderEnv renderEnv)
 {
     if (node.Patch != null)
     {
         node.Patch.Update(gameTime, renderEnv);
     }
     foreach (var child in node.Nodes)
     {
         UpdateNode(child, gameTime, renderEnv);
     }
 }
Beispiel #4
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();
        }
Beispiel #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;

            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>();
        }
Beispiel #6
0
        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();
        }
 protected override void Initialize()
 {
     base.Initialize();
     this.renderEnv = new RenderEnv(this.graphics);
 }
Beispiel #8
0
 public void Draw(GameTime gameTime, RenderEnv renderEnv)
 {
     renderEnv.Sprite.Begin(SpriteSortMode.Deferred, StateEx.NonPremultipled_Hidef());
     DrawNode(Base, gameTime, renderEnv);
     renderEnv.Sprite.End();
 }
Beispiel #9
0
 public void Update(GameTime gameTime, RenderEnv renderEnv)
 {
     UpdateNode(Base, gameTime, renderEnv);
 }