Exemple #1
0
        /// <summary>
        /// Initializes the part of Duality that requires a valid rendering context.
        /// Should be called before performing any rendering related operations with Duality.
        /// Is called implicitly when using <see cref="OpenWindow"/>.
        /// </summary>
        public static void InitPostWindow()
        {
            DefaultContent.Init();

            // Post-Window init is the last thing that happens before loading game
            // content and entering simulation. When done in a game context, notify
            // plugins that the game is about to start - otherwise, exec context changes
            // will trigger the same code later.
            if (execContext == ExecutionContext.Game)
            {
                pluginManager.InvokeGameStarting();
            }
        }
Exemple #2
0
        /// <summary>
        /// Terminates this DualityApp. This does not end the current Process, but will instruct the engine to
        /// leave main loop and message processing as soon as possible.
        /// </summary>
        public static void Terminate()
        {
            if (!initialized)
            {
                return;
            }
            if (isUpdating)
            {
                terminateScheduled = true;
                return;
            }

            /*if (environment == ExecutionEnvironment.Editor && execContext == ExecutionContext.Game) {
             *  Scene.Current.Dispose();
             *  //Log.Core.Write("DualityApp Sandbox terminated");
             *  terminateScheduled = false;
             *  return;
             * }*/

            //if (execContext != ExecutionContext.Editor) {
            OnTerminating();
            //}

            DefaultContent.Dispose();

            // Discard plugin data (Resources, current Scene) ahead of time. Otherwise, it'll get shut down in ClearPlugins, after the backend is gone.
            pluginManager.DiscardPluginData();

            sound.Dispose();
            sound = null;
            ShutdownBackend(ref graphicsBack);
            ShutdownBackend(ref audioBack);
            pluginManager.ClearPlugins();

            PathOp.UnmountAll();

            ShutdownBackend(ref systemBack);

            // Shut down the plugin manager and plugin loader
            pluginManager.Terminate();
            pluginManager.PluginsRemoving -= pluginManager_PluginsRemoving;
            pluginManager.PluginsRemoved  -= pluginManager_PluginsRemoved;
            assemblyLoader.Terminate();
            assemblyLoader = null;

            initialized = false;
            execContext = ExecutionContext.Terminated;
        }
Exemple #3
0
        /// <summary>
        /// Terminates this DualityApp. This does not end the current Process, but will instruct the engine to
        /// leave main loop and message processing as soon as possible.
        /// </summary>
        public static void Terminate()
        {
            if (!initialized)
            {
                return;
            }
            if (isUpdating)
            {
                terminateScheduled = true;
                return;
            }

            OnTerminating();

            DefaultContent.Dispose();

            // Discard plugin data (Resources, current Scene) ahead of time. Otherwise, it'll get shut down in ClearPlugins, after the backend is gone.
            pluginManager.DiscardPluginData();

            sound.Dispose();
            sound = null;
            ShutdownBackend(ref graphicsBack);
            ShutdownBackend(ref audioBack);
            pluginManager.ClearPlugins();

            PathOp.UnmountAll();

            ShutdownBackend(ref systemBack);

            // Shut down the plugin manager and plugin loader
            pluginManager.Terminate();
            pluginManager.PluginsRemoving -= pluginManager_PluginsRemoving;
            pluginManager.PluginsRemoved  -= pluginManager_PluginsRemoved;
            assemblyLoader.Terminate();
            assemblyLoader = null;

            initialized = false;
            execContext = ExecutionContext.Terminated;
        }
Exemple #4
0
        /// <summary>
        /// Initializes the part of Duality that requires a valid rendering context.
        /// Should be called before performing any rendering related operations with Duality.
        /// Is called implicitly when using <see cref="OpenWindow"/>.
        /// </summary>
        public static void InitPostWindow()
        {
            AsyncManager.Init();

            DefaultContent.Init();
        }
Exemple #5
0
 /// <summary>
 /// Initializes the part of Duality that requires a valid rendering context.
 /// Should be called before performing any rendering related operations with Duality.
 /// Is called implicitly when using <see cref="OpenWindow"/>.
 /// </summary>
 public static void InitPostWindow()
 {
     DefaultContent.Init();
 }