Exemplo n.º 1
0
        /// <inheritdoc />
        public override void OnInit()
        {
            Assert.IsNull(MainWindow);

            _windowsLayoutPath = StringUtils.CombinePaths(Globals.ProjectCacheFolder, "WindowsLayout.xml");

            // Create main window
            var dpiScale = Platform.DpiScale;
            var settings = CreateWindowSettings.Default;

            settings.Title         = "Flax Editor";
            settings.Size          = new Vector2(1300 * dpiScale, 900 * dpiScale);
            settings.StartPosition = WindowStartPosition.CenterScreen;

            if (!Editor.Instance.Options.Options.Interface.UseNativeWindowSystem)
            {
                settings.HasBorder      = false;
                settings.HasSizingFrame = false;
            }

            MainWindow = Window.Create(settings);

            if (MainWindow == null)
            {
                // Error
                Editor.LogError("Failed to create editor main window!");
                return;
            }
            UpdateWindowTitle();

            // Link for main window events
            MainWindow.Closing += MainWindow_OnClosing;
            MainWindow.Closed  += MainWindow_OnClosed;

            // Create default editor windows
            ContentWin         = new ContentWindow(Editor);
            EditWin            = new EditGameWindow(Editor);
            GameWin            = new GameWindow(Editor);
            PropertiesWin      = new PropertiesWindow(Editor);
            SceneWin           = new SceneTreeWindow(Editor);
            DebugLogWin        = new DebugLogWindow(Editor);
            OutputLogWin       = new OutputLogWindow(Editor);
            ToolboxWin         = new ToolboxWindow(Editor);
            GraphicsQualityWin = new GraphicsQualityWindow(Editor);
            GameCookerWin      = new GameCookerWindow(Editor);
            ProfilerWin        = new ProfilerWindow(Editor);
            EditorOptionsWin   = new EditorOptionsWindow(Editor);
            PluginsWin         = new PluginsWindow(Editor);

            // Bind events
            SceneManager.SceneSaveError     += OnSceneSaveError;
            SceneManager.SceneLoaded        += OnSceneLoaded;
            SceneManager.SceneLoadError     += OnSceneLoadError;
            SceneManager.SceneLoading       += OnSceneLoading;
            SceneManager.SceneSaved         += OnSceneSaved;
            SceneManager.SceneSaving        += OnSceneSaving;
            SceneManager.SceneUnloaded      += OnSceneUnloaded;
            SceneManager.SceneUnloading     += OnSceneUnloading;
            ScriptsBuilder.ScriptsReloadEnd += OnScriptsReloadEnd;
        }
Exemplo n.º 2
0
        /// <inheritdoc />
        public override void OnInit()
        {
            Assert.IsNull(MainWindow);

            _windowsLayoutPath = StringUtils.CombinePaths(Globals.ProjectCacheFolder, "WindowsLayout.xml");

            // Create main window
            var settings = CreateWindowSettings.Default;

            settings.Title         = "Flax Editor";
            settings.Size          = new Vector2(1300, 900);
            settings.StartPosition = WindowStartPosition.CenterScreen;
            MainWindow             = Window.Create(settings);
            if (MainWindow == null)
            {
                // Error
                Debug.LogError("Failed to create editor main window!");
                return;
            }
            UpdateWindowTitle();

            // Link for main window events
            MainWindow.OnClosing += MainWindow_OnClosing;
            MainWindow.OnClosed  += MainWindow_OnClosed;

            // Create default editor windows
            ContentWin         = new ContentWindow(Editor);
            EditWin            = new EditGameWindow(Editor);
            GameWin            = new GameWindow(Editor);
            PropertiesWin      = new PropertiesWindow(Editor);
            SceneWin           = new SceneTreeWindow(Editor);
            DebugWin           = new DebugLogWindow(Editor);
            ToolboxWin         = new ToolboxWindow(Editor);
            GraphicsQualityWin = new GraphicsQualityWindow(Editor);
            GameCookerWin      = new GameCookerWindow(Editor);
            ProfilerWin        = new ProfilerWindow(Editor);
            EditorOptionsWin   = new EditorOptionsWindow(Editor);

            // Bind events
            SceneManager.SceneSaveError += OnSceneSaveError;
            SceneManager.SceneLoaded    += OnSceneLoaded;
            SceneManager.SceneLoadError += OnSceneLoadError;
            SceneManager.SceneLoading   += OnSceneLoading;
            SceneManager.SceneSaved     += OnSceneSaved;
            SceneManager.SceneSaving    += OnSceneSaving;
            SceneManager.SceneUnloaded  += OnSceneUnloaded;
            SceneManager.SceneUnloading += OnSceneUnloading;
        }
Exemplo n.º 3
0
        /// <inheritdoc />
        public override void OnInit()
        {
            Assert.IsNull(MainWindow);

            _windowsLayoutPath = StringUtils.CombinePaths(Globals.ProjectCacheFolder, "WindowsLayout.xml");

            // Create main window
            var dpiScale = Platform.DpiScale;
            var settings = CreateWindowSettings.Default;

            settings.Title               = "Flax Editor";
            settings.Size                = Platform.DesktopSize;
            settings.StartPosition       = WindowStartPosition.CenterScreen;
            settings.ShowAfterFirstPaint = true;

#if PLATFORM_WINDOWS
            if (!Editor.Instance.Options.Options.Interface.UseNativeWindowSystem)
#endif
            {
                settings.HasBorder = false;
#if PLATFORM_WINDOWS
                // Skip OS sizing frame and implement it using LeftButtonHit
                settings.HasSizingFrame = false;
#endif
            }

            MainWindow = Platform.CreateWindow(ref settings);

            if (MainWindow == null)
            {
                // Error
                Editor.LogError("Failed to create editor main window!");
                return;
            }
            UpdateWindowTitle();

            // Link for main window events
            MainWindow.Closing += MainWindow_OnClosing;
            MainWindow.Closed  += MainWindow_OnClosed;

            // Create default editor windows
            ContentWin              = new ContentWindow(Editor);
            EditWin                 = new EditGameWindow(Editor);
            GameWin                 = new GameWindow(Editor);
            PropertiesWin           = new PropertiesWindow(Editor);
            SceneWin                = new SceneTreeWindow(Editor);
            DebugLogWin             = new DebugLogWindow(Editor);
            OutputLogWin            = new OutputLogWindow(Editor);
            ToolboxWin              = new ToolboxWindow(Editor);
            GraphicsQualityWin      = new GraphicsQualityWindow(Editor);
            GameCookerWin           = new GameCookerWindow(Editor);
            ProfilerWin             = new ProfilerWindow(Editor);
            EditorOptionsWin        = new EditorOptionsWindow(Editor);
            PluginsWin              = new PluginsWindow(Editor);
            VisualScriptDebuggerWin = new VisualScriptDebuggerWindow(Editor);

            // Bind events
            Level.SceneSaveError             += OnSceneSaveError;
            Level.SceneLoaded                += OnSceneLoaded;
            Level.SceneLoadError             += OnSceneLoadError;
            Level.SceneLoading               += OnSceneLoading;
            Level.SceneSaved                 += OnSceneSaved;
            Level.SceneSaving                += OnSceneSaving;
            Level.SceneUnloaded              += OnSceneUnloaded;
            Level.SceneUnloading             += OnSceneUnloading;
            ScriptsBuilder.ScriptsReloadEnd  += OnScriptsReloadEnd;
            Editor.StateMachine.StateChanged += OnEditorStateChanged;
        }