Ejemplo n.º 1
0
        /// <summary>
        /// Triggered when a new entry is added in the debug log.
        /// </summary>
        /// <param name="type">Type of the message.</param>
        /// <param name="message">Message string.</param>
        private void OnEntryAdded(DebugMessageType type, string message)
        {
            // Check if compiler message or reported exception, otherwise parse it as a normal log message
            ParsedLogEntry logEntry = ScriptCodeManager.ParseCompilerMessage(message);

            if (logEntry == null)
            {
                logEntry = Debug.ParseExceptionMessage(message);
            }

            if (logEntry == null)
            {
                logEntry = Debug.ParseLogMessage(message);
            }

            ConsoleEntryData newEntry = new ConsoleEntryData();

            newEntry.type      = type;
            newEntry.callstack = logEntry.callstack;
            newEntry.message   = logEntry.message;

            entries.Add(newEntry);

            if (DoesFilterMatch(type))
            {
                listView.AddEntry(newEntry);
                filteredEntries.Add(newEntry);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Triggered when a new entry is added in the debug log.
        /// </summary>
        /// <param name="message">Message string.</param>
        /// <param name="verbosity">Verbosity level defining message importance.</param>
        /// <param name="category">Category of the sub-system reporting the message.</param>
        private void OnEntryAdded(string message, LogVerbosity verbosity, int category)
        {
            // Check if compiler message or reported exception, otherwise parse it as a normal log message
            ParsedLogEntry logEntry = ScriptCodeManager.ParseCompilerMessage(message);

            if (logEntry == null)
            {
                logEntry = Debug.ParseExceptionMessage(message);
            }

            if (logEntry == null)
            {
                logEntry = Debug.ParseLogMessage(message);
            }

            ConsoleEntryData newEntry = new ConsoleEntryData();

            newEntry.verbosity = verbosity;
            newEntry.category  = category;
            newEntry.callstack = logEntry.callstack;
            newEntry.message   = logEntry.message;

            entries.Add(newEntry);

            if (DoesFilterMatch(verbosity))
            {
                listView.AddEntry(newEntry);
                filteredEntries.Add(newEntry);
            }
        }
Ejemplo n.º 3
0
        #pragma warning restore 0414

        /// <summary>
        /// Constructs a new editor application. Called at editor start-up by the runtime, and any time assembly refresh
        /// occurrs.
        /// </summary>
        internal EditorApplication()
        {
            instance    = this;
            codeManager = new ScriptCodeManager();

            const string soName = "EditorPersistentData";
            SceneObject  so     = Scene.Root.FindChild(soName);

            if (so == null)
            {
                so = new SceneObject(soName, true);
            }

            persistentData = so.GetComponent <EditorPersistentData>();
            if (persistentData == null)
            {
                persistentData = so.AddComponent <EditorPersistentData>();
            }

            // Register controls
            InputConfiguration inputConfig = VirtualInput.KeyConfig;

            inputConfig.RegisterButton(SceneCamera.MoveForwardBinding, ButtonCode.W);
            inputConfig.RegisterButton(SceneCamera.MoveBackBinding, ButtonCode.S);
            inputConfig.RegisterButton(SceneCamera.MoveLeftBinding, ButtonCode.A);
            inputConfig.RegisterButton(SceneCamera.MoveRightBinding, ButtonCode.D);
            inputConfig.RegisterButton(SceneCamera.MoveUpBinding, ButtonCode.E);
            inputConfig.RegisterButton(SceneCamera.MoveDownBinding, ButtonCode.Q);
            inputConfig.RegisterButton(SceneCamera.MoveForwardBinding, ButtonCode.Up);
            inputConfig.RegisterButton(SceneCamera.MoveBackBinding, ButtonCode.Down);
            inputConfig.RegisterButton(SceneCamera.MoveLeftBinding, ButtonCode.Left);
            inputConfig.RegisterButton(SceneCamera.MoveRightBinding, ButtonCode.Right);
            inputConfig.RegisterButton(SceneCamera.FastMoveBinding, ButtonCode.LeftShift);
            inputConfig.RegisterButton(SceneCamera.RotateBinding, ButtonCode.MouseRight);
            inputConfig.RegisterButton(SceneCamera.PanBinding, ButtonCode.MouseMiddle);
            inputConfig.RegisterAxis(SceneCamera.HorizontalAxisBinding, InputAxis.MouseX);
            inputConfig.RegisterAxis(SceneCamera.VerticalAxisBinding, InputAxis.MouseY);
            inputConfig.RegisterAxis(SceneCamera.ScrollAxisBinding, InputAxis.MouseZ);

            inputConfig.RegisterButton(SceneWindow.ToggleProfilerOverlayBinding, ButtonCode.P, ButtonModifier.CtrlAlt);
            inputConfig.RegisterButton(SceneWindow.ViewToolBinding, ButtonCode.Q);
            inputConfig.RegisterButton(SceneWindow.FrameBinding, ButtonCode.F);
            inputConfig.RegisterButton(SceneWindow.MoveToolBinding, ButtonCode.W);
            inputConfig.RegisterButton(SceneWindow.RotateToolBinding, ButtonCode.E);
            inputConfig.RegisterButton(SceneWindow.ScaleToolBinding, ButtonCode.R);

            inputConfig.RegisterButton(CutBinding, ButtonCode.X, ButtonModifier.Ctrl);
            inputConfig.RegisterButton(CopyBinding, ButtonCode.C, ButtonModifier.Ctrl);
            inputConfig.RegisterButton(PasteBinding, ButtonCode.V, ButtonModifier.Ctrl);
            inputConfig.RegisterButton(DuplicateBinding, ButtonCode.D, ButtonModifier.Ctrl);
            inputConfig.RegisterButton(DeleteBinding, ButtonCode.Delete);
            inputConfig.RegisterButton(RenameBinding, ButtonCode.F2);

            if (IsProjectLoaded)
            {
                monitor             = new FolderMonitor(ProjectLibrary.ResourceFolder);
                monitor.OnAdded    += OnAssetModified;
                monitor.OnRemoved  += OnAssetModified;
                monitor.OnModified += OnAssetModified;
            }
        }