Ejemplo n.º 1
0
        private static void EditorManager_ProcessExternalFileDrop(object sender, ExternalFileDropArgs e)
        {
            if (!e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                return;
            }

            string[] res = e.Data.GetData(DataFormats.FileDrop) as string[];
            if (res == null || res.GetLength(0) == 0)
            {
                return;
            }

            string file = res[0];

            string extension = file.Substring(file.LastIndexOf('.') + 1).ToLower();

            if (extension == "project" || extension == "scene")
            {
                //Make sure the current project is saved
                if (EditorApp.PromptSaveProject() == DialogResult.Cancel)
                {
                    return;
                }
            }
            else
            {
                return; //The file extension was not recognized
            }
            if (extension == "project" && EditorAppDelegates.LoadProjectDelegate != null)
            {
                // now load the project
                EditorAppDelegates.LoadProjectDelegate(file, true);
            }
            else if (extension == "scene" && EditorAppDelegates.LoadSceneDelegate != null)
            {
                // loads the scene if possible

                /* TODO:
                 * Currently the project gets reloaded every time regardless whether it already is loaded.
                 * Maybe it would be faster to check for this case first.
                 */

                EditorAppDelegates.LoadSceneDelegate(file, true);
            }

            e.Processed = true;
        }
Ejemplo n.º 2
0
 public override bool Shutdown(bool bPrompt)
 {
     return(EditorApp.ExitEditorApp(bPrompt));
 }