Exemplo n.º 1
0
        /// <summary>
        /// Called by MonoGame when the framework has initialized but before the game loop starts.
        /// This method is used to load graphics-dependant content.  Do not call this method manually.
        /// </summary>
        protected override void LoadContent()
        {
            Blur = FrameworkContent.Load <Effect>("GuiEffects/Blur");

            // Initialize the renderer.
            _renderer = new SpriteRocket2D(GraphicsDevice);

            // Load all third-party modules.
            foreach (var mod in ModuleLoader.LoadThirdPartyModules(this))
            {
                this.RegisterModule(mod);
            }

            // Tell any modules that have been loaded so far to load content.
            foreach (var mod in _activeModules)
            {
                mod.LoadContent();
            }

            // Future modules can load content now.
            _reachedLoadContent = true;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Called by MonoGame when the framework initially loads.  Do not ever call this manually.
        /// </summary>
        protected override void Initialize()
        {
            // Module loader can now initialize modules.
            _reachedInit = true;

            // holds modules that need to be registered with the dev console when the console's been initialized.
            var execsToSeek = new List <object>();

            // dev console instance once we've loaded it.
            DevConsole console = null;

            // Speaking of which, initialize core modules.
            foreach (var mod in ModuleLoader.LoadModules(this, this.GetType().Assembly))
            {
                if (mod is DevConsole con && console == null)
                {
                    console = con;
                    while (execsToSeek.Count > 0)
                    {
                        var o = execsToSeek.First();
                        console.RegisterCommandsInternal(o);

                        execsToSeek.RemoveAt(0);
                    }
                }

                if (console == null)
                {
                    execsToSeek.Add(mod);
                }

                RegisterModule(mod);
            }

            base.Initialize();
        }