Пример #1
0
        private void editor_view_ScriptNotify(object sender, NotifyEventArgs e)
        {
            if (e.Value.Contains("command://"))
            {
                EditorCommands?.Invoke(this, new EventSCEE {
                    message = e.Value
                });
            }

            if (e.Value.Contains("console://"))
            {
                Debug.WriteLine(e.Value.Replace("console://", ""));
            }

            switch (e.Value)
            {
            case "click":
                EditorCommands?.Invoke(this, new EventSCEE {
                    message = "click"
                });
                break;

            case "loaded":
                Initialized = true;
                EditorLoaded?.Invoke(this, new EventArgs());
                break;
            }

            if (e.Value.Contains("tab_select:///"))
            {
                EditorTextShortcutTabs?.Invoke(this, new EventSCEE {
                    message = e.Value.Replace("tab_select:///", "")
                });
            }
        }
Пример #2
0
        /**
         * Called every frame.
         */
        private static void Update()
        {
            // Reinitialize modified fsms and repaint all if some fsms were modified.
            foreach (PlayMakerFSM playMakerFSM in m_dirtyPlayMakerFSMs)
            {
                playMakerFSM.Fsm.Reinitialize();
            }
            m_dirtyPlayMakerFSMs.Clear();
            if (m_fsmEditorDirty)
            {
                m_fsmEditorDirty = false;
                EditorCommands.UpdateGraphView();
                FsmEditor.SetFsmDirty();
                FsmEditor.RepaintAll();
            }

            // Lock all fsms that were temporarily unlocked before saving the scene.
            if (m_unlockedPlayMakerFSMs.Count > 0)
            {
                LockAllFsms();
            }

            // Lock all fsms that are on a locked game object.
            foreach (PlayMakerFSM playMakerFSM in m_playMakerFSMsToBeLocked)
            {
                LockFsm(playMakerFSM);
            }
            m_playMakerFSMsToBeLocked.Clear();
        }
Пример #3
0
        /// <summary>
        /// Validates the <see cref="ModelTag"/> that the user added.
        /// </summary>
        /// <param name="inSender">The originator of the event.</param>
        /// <param name="inEventArguments">Whether or not to discard the input.</param>
        private void NewTagTextBox_Validating(object inSender, System.ComponentModel.CancelEventArgs inEventArguments)
        {
            var newText = EditorCommands.NormalizeWhitespace(NewTagTextBox.Text);

            NewTagTextBox.Text = newText;
            if (EditorCommands.TextIsReserved(newText))
            {
                newText = "";
                _       = MessageBox.Show(EditorCommands.ReservedWordMessage, Resources.CaptionWorkflow,
                                          MessageBoxButtons.OK, MessageBoxIcon.Warning);
                inEventArguments.Cancel = true;
            }
            NewTag = newText;
        }
Пример #4
0
        public void OnCommand(string cmd)
        {
            switch (cmd)
            {
            case "OpenProject":
                EditorCommands.OpenProject(pluginBaseDir);
                break;

            case "AOT":
                AotSupport.AOT();
                break;

            default:
                break;
            }
        }
Пример #5
0
        /// <summary>
        /// Validates the integer that the user added to the <see cref="RecipeElement"/>.
        /// </summary>
        /// <param name="inSender">The originator of the event.</param>
        /// <param name="inEventArguments">Whether or not to discard the input.</param>
        private void ElementAmountTextBox_Validating(object inSender, System.ComponentModel.CancelEventArgs inEventArguments)
        {
            var newText = EditorCommands.NormalizeWhitespace(ElementAmountTextBox.Text);

            ElementAmountTextBox.Text = newText;
            if (!int.TryParse(newText, out var parsedAmount) ||
                parsedAmount < 1)
            {
                parsedAmount = 0;
                ElementAmountTextBox.Text = "";
                _ = MessageBox.Show(Resources.ErrorPositiveIntegersOnly, Resources.CaptionWorkflow,
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                inEventArguments.Cancel = true;
            }
            newAmount = parsedAmount;
        }
Пример #6
0
 /// <summary>
 /// Attempts to load the most recently-edited project.
 /// </summary>
 /// <param name="inSender">The originator of the event.</param>
 /// <param name="inEventArguments">Additional event data.</param>
 private void LinkLabelMostRecent_LinkClicked(object inSender, LinkLabelLinkClickedEventArgs inEventArguments)
 {
     if (!string.IsNullOrEmpty(Settings.Default.MostRecentProject))
     {
         All.ProjectDirectory = Settings.Default.MostRecentProject;
         if (EditorCommands.LoadDataFiles())
         {
             ScribeProgram.ShowEditor();
             Close();
         }
         else
         {
             SystemSounds.Beep.Play();
             Logger.Log(LogLevel.Error, Resources.ErrorLoadFailed);
         }
     }
 }
Пример #7
0
        /// <summary>
        /// Attempts to load a saved project.
        /// </summary>
        /// <param name="inSender">The originator of the event.</param>
        /// <param name="inEventArguments">Additional event data.</param>
        private void ButtonLoadProject_Click(object inSender, EventArgs inEventArguments)
        {
            if (!EditorCommands.SelectProjectFolder(Resources.InfoMessageLoad, Resources.FolderNameOldProject))
            {
                return;
            }

            if (EditorCommands.LoadDataFiles())
            {
                ScribeProgram.ShowEditor();
                Close();
            }
            else
            {
                SystemSounds.Beep.Play();
                Logger.Log(LogLevel.Error, Resources.ErrorLoadFailed);
            }
        }
Пример #8
0
        public static IEditorCommands CreateEditorCommands(ITextArea textView)
        {
            if (textView == null)
            {
                throw new ArgumentNullException("textView");
            }

            IPropertyOwner  owner    = textView;
            IEditorCommands property = null;

            if (!owner.TryGetProperty <IEditorCommands>("IEditorCommandsProvider", out property))
            {
                property = new EditorCommands(textView);
                owner.AddProperty("IEditorCommandsProvider", property);
            }

            return(property);
        }
Пример #9
0
 /// <summary>
 /// Attempts to create new, blank game data files and folders in the current folder.
 /// </summary>
 /// <returns><c>true</c> if the files were successfully created; otherwise, <c>false</c>.</returns>
 internal static bool CreateTemplatesInProjectFolder()
 {
     while (Directory.GetFiles(All.ProjectDirectory).Length > 0)
     {
         // Loop here to allow the user to empty the given directory if desired.
         SystemSounds.Beep.Play();
         if (MessageBox.Show(Resources.ErrorFolderNotEmpty,
                             Resources.CaptionFolderNotEmptyError,
                             MessageBoxButtons.RetryCancel,
                             MessageBoxIcon.Error) == DialogResult.Cancel)
         {
             // If they cancel, simply abort.
             return(false);
         }
     }
     EditorCommands.CreateGraphicalAssetFolders();
     EditorCommands.CreateTemplateFiles();
     return(true);
 }
Пример #10
0
        /// <summary>
        /// Attempts to create a new project.
        /// </summary>
        /// <param name="inSender">The originator of the event.</param>
        /// <param name="inEventArguments">Additional event data.</param>
        private void ButtonNewProject_Click(object inSender, EventArgs inEventArguments)
        {
            if (!EditorCommands.SelectProjectFolder(Resources.InfoMessageNew, Resources.FolderNameNewProject))
            {
                return;
            }

            if (TemplatesMessageBox.CreateTemplatesInProjectFolder() &&
                EditorCommands.LoadDataFiles())
            {
                ScribeProgram.ShowEditor();
                Close();
            }
            else
            {
                SystemSounds.Beep.Play();
                Logger.Log(LogLevel.Error, Resources.ErrorNewFailed);
            }
        }
Пример #11
0
 public static void OnlineManual()
 {
     EditorCommands.OpenWikiHelp();
     //Application.OpenURL("https://hutonggames.fogbugz.com/default.asp?W1");
 }
 internal static void OpenAboutWindow()
 {
     EditorCommands.OpenAboutWindow();
 }
 internal static void OpenPreferenceWindow()
 {
     EditorCommands.OpenPreferenceWindow();
 }
 internal static void OpenHotkeysWindow()
 {
     EditorCommands.OpenHotkeyWindow();
 }
 internal static void OpenEditor()
 {
     EditorCommands.OpenEditorWindow();
 }
Пример #16
0
 public static void OnlineManual()
 {
     EditorCommands.OpenWikiHelp();
 }
Пример #17
0
    public void OnGUI()
    {
        fsmEditor.OnGUI();

/*		BeginWindows();
 *
 *              fsmEditor.DoPopupWindows();
 *
 *              EndWindows();*/

        if (Event.current.type == EventType.ValidateCommand)
        {
            //Debug.Log(Event.current.commandName);

            switch (Event.current.commandName)
            {
            case "UndoRedoPerformed":
                FsmEditor.UndoRedoPerformed();
                break;

            case "Copy":
                EditorCommands.CopyStateSelection();
                break;

            case "Paste":
                EditorCommands.PasteStates();
                break;
            }
        }

        if (Event.current.type == EventType.ExecuteCommand)
        {
            //Debug.Log(Event.current.commandName);

            switch (Event.current.commandName)
            {
            case "OpenToolWindow":
                toolWindow = GetWindow <ContextToolWindow>();
                break;

            case "OpenFsmSelectorWindow":
                fsmSelectorWindow = GetWindow <FsmSelectorWindow>();
                fsmSelectorWindow.ShowUtility();
                break;

            case "OpenFsmTemplateWindow":
                fsmTemplateWindow = GetWindow <FsmTemplateWindow>();
                break;

            case "OpenStateSelectorWindow":
                stateSelectorWindow = GetWindow <FsmStateWindow>();
                break;

            case "OpenActionWindow":
                actionWindow = GetWindow <FsmActionWindow>();
                break;

            case "OpenErrorWindow":
                errorWindow = GetWindow <FsmErrorWindow>();
                break;

            case "OpenFsmLogWindow":
                logWindow = GetWindow <FsmLogWindow>();
                break;

            case "OpenAboutWindow":
                aboutWindow = GetWindow <AboutWindow>();
                break;

            case "AddFsmComponent":
                AddFsmToSelected();
                break;

            case "RepaintAll":
                RepaintAllWindows();
                break;
            }

            GUIUtility.ExitGUI();
        }
    }
Пример #18
0
 public static void ReleaseNotes()
 {
     EditorCommands.OpenWikiPage(WikiPages.ReleaseNotes);
     //Application.OpenURL("https://hutonggames.fogbugz.com/default.asp?W311");
 }