private static IEnumerator SaveAllTemplates()
        {
            feedback.StartProcedure("Re-Saving All Templates");

            feedback.LogAction("Rebuild Fsm List");

            FsmEditorUtility.BuildTemplateList();

            yield return(null);

            foreach (var template in FsmEditorUtility.TemplateList)
            {
                try
                {
                    feedback.LogAction("Set Fsm Dirty" + template.fsm.Name);
                    FsmEditor.SetFsmDirty(template.fsm, false);
                    feedback.LogAction("Re-save Template: " + template.name);
                }catch (Exception e)
                {
                    Debug.LogWarning("error : " + e.Message);
                }
            }

            feedback.EndProcedure("Re-Saving All Templates");
        }
Beispiel #2
0
 /// <summary>
 /// Open the first PlayMakerFSM on a GameObject in the Playmaker Editor
 /// </summary>
 public static void OpenInEditor(GameObject go)
 {
     if (go != null)
     {
         OpenInEditor(FsmEditorUtility.FindFsmOnGameObject(go));
     }
 }
Beispiel #3
0
    public static UnityEngine.Object[] GetSceneCustomActionDependencies()
    {
        UnityEngine.Object[] list = new UnityEngine.Object[0];

        FsmEditor.RebuildFsmList();

        List <PlayMakerFSM> fsms = FsmEditor.FsmComponentList;

//		List<System.Type> PlayMakerActions = FsmEditorUtility.Actionslist;

        foreach (PlayMakerFSM fsm in fsms)
        {
            //Debug.Log(FsmEditorUtility.GetFullFsmLabel(fsm));

            //if (fsm.FsmStates != null) fsm.FsmStates.Initialize();

            for (int s = 0; s < fsm.FsmStates.Length; ++s)
            {
                fsm.FsmStates[s].LoadActions();

                Debug.Log(fsm.FsmStates[s].Name + " is loaded:" + fsm.FsmStates[s].ActionsLoaded);

                // Show SendEvent and SendMessage as we find them
                foreach (FsmStateAction action in fsm.FsmStates[s].Actions)
                {
                    UnityEngine.Object _asset = FsmEditorUtility.GetActionScriptAsset(action);
                    string             _name  = action.Name;
                    if (String.IsNullOrEmpty(_name))
                    {
                        if (_asset != null)
                        {
                            _name = _asset.name;
                        }
                        else
                        {
                            _name = FsmEditorUtility.GetActionLabel(action) + "[WARNING: FILE NOT FOUND]";
                        }
                    }

                    if (Enum.IsDefined(typeof(WikiPages), _name))
                    {
                        //	Debug.Log(_name+" : official action");
                    }
                    else
                    {
                        //	Debug.Log(_name+" : custom action");

                        if (_asset != null)
                        {
                            ArrayUtility.Add <UnityEngine.Object>(ref list, _asset);
                        }
                    }
                }
            }
        }

        return(list);
    }    // GetSceneCustomActionDependencies
    public static void LoadAllPrefabsInProject()
    {
        var paths = FsmEditorUtility.LoadAllPrefabsInProject();

        if (paths.Count == 0)
        {
            EditorUtility.DisplayDialog("Loading PlayMaker Prefabs", "No PlayMaker Prefabs Found!", "OK");
        }
        else
        {
            EditorUtility.DisplayDialog("Loaded PlayMaker Prefabs", "Prefabs found: " + paths.Count + "\nCheck console for details...", "OK");
        }
    }
Beispiel #5
0
    public static void LoadAllPrefabsInProject()
    {
        var paths  = FsmEditorUtility.LoadAllPrefabsInProject();
        var output = "";

        foreach (var path in paths)
        {
            output += path + "\n";
        }

        if (output == "")
        {
            EditorUtility.DisplayDialog("Loading PlayMaker Prefabs", "No PlayMaker Prefabs Found!", "OK");
        }
        else
        {
            EditorUtility.DisplayDialog("Loaded PlayMaker Prefabs", output, "OK");
        }
    }
Beispiel #6
0
 public static void ImportGlobals()
 {
     FsmEditorUtility.ImportGlobals();
 }
Beispiel #7
0
 public static void ExportGlobals()
 {
     FsmEditorUtility.ExportGlobals();
 }
Beispiel #8
0
 private static void ImportGlobals()
 {
     FsmEditorUtility.ImportGlobals();
 }
Beispiel #9
0
 private static void ExportGlobals()
 {
     FsmEditorUtility.ExportGlobals();
 }
Beispiel #10
0
    public override void OnInspectorGUI()
    {
#if UNITY_3_4
        if (warningBox == null)
        {
            warningBox = new GUIStyle(EditorStyles.boldLabel)
            {
                wordWrap = true
            };
        }

        GUILayout.Label(Strings.Hint_GlobalsInspector_Shows_DEFAULT_Values, warningBox);
#else
        EditorGUILayout.HelpBox(Strings.Hint_GlobalsInspector_Shows_DEFAULT_Values, MessageType.Info);
#endif

        if (refresh)
        {
            Refresh();
            return;
        }

        GUILayout.Label(Strings.Command_Global_Variables, EditorStyles.boldLabel);

        if (variableList.Count > 0)
        {
            foreach (var fsmVariable in variableList)
            {
                var tooltip = fsmVariable.Name;

                if (!string.IsNullOrEmpty(fsmVariable.Tooltip))
                {
                    tooltip += "\n" + fsmVariable.Tooltip;
                }

                fsmVariable.DoValueGUI(new GUIContent(fsmVariable.Name, tooltip), true);
            }
        }
        else
        {
            GUILayout.Label(Strings.Label_None_In_Table);
        }

        GUILayout.Label(Strings.Label_Global_Events, EditorStyles.boldLabel);

        if (globals.Events.Count > 0)
        {
            foreach (var eventName in globals.Events)
            {
                GUILayout.Label(eventName);
            }
        }
        else
        {
            GUILayout.Label(Strings.Label_None_In_Table);
        }

        GUILayout.Space(5);

        if (GUILayout.Button(Strings.Command_Export_Globals))
        {
            FsmEditorUtility.ExportGlobals();
        }

        if (GUILayout.Button(Strings.Command_Import_Globals))
        {
            FsmEditorUtility.ImportGlobals();
        }
#if UNITY_3_4
        GUILayout.Label(Strings.Hint_Export_Globals_Notes, warningBox);
#else
        EditorGUILayout.HelpBox(Strings.Hint_Export_Globals_Notes, MessageType.None);
#endif
    }
    public override void OnInspectorGUI()
    {
        EditorGUILayout.HelpBox(Strings.Hint_GlobalsInspector_Shows_DEFAULT_Values, MessageType.Info);

        if (refresh)
        {
            Refresh();
            return;
        }

        GUILayout.Label(Strings.Command_Global_Variables, EditorStyles.boldLabel);

        if (variableList.Count > 0)
        {
            var currentCategory = 0;
            for (var index = 0; index < variableList.Count; index++)
            {
                var fsmVariable = variableList[index];
                var categoryID  = fsmVariable.CategoryID;
                if (categoryID > 0 && categoryID != currentCategory)
                {
                    currentCategory = categoryID;
                    GUILayout.Label(globals.Variables.Categories[currentCategory], EditorStyles.boldLabel);
                    //FsmEditorGUILayout.LightDivider();
                }

                var tooltip = fsmVariable.Name;

                if (!string.IsNullOrEmpty(fsmVariable.Tooltip))
                {
                    tooltip += "\n" + fsmVariable.Tooltip;
                }

                if (fsmVariable.Type == VariableType.Array)
                {
                    GUILayout.Label(fsmVariable.Name);
                }
                fsmVariable.DoEditorGUI(new GUIContent(fsmVariable.Name, tooltip), true);
            }
        }
        else
        {
            GUILayout.Label(Strings.Label_None_In_Table);
        }

        GUILayout.Label(Strings.Label_Global_Events, EditorStyles.boldLabel);

        if (globals.Events.Count > 0)
        {
            foreach (var eventName in globals.Events)
            {
                GUILayout.Label(eventName);
            }
        }
        else
        {
            GUILayout.Label(Strings.Label_None_In_Table);
        }

        GUILayout.Space(5);

        if (GUILayout.Button("Refresh"))
        {
            Refresh();
        }

        GUILayout.Space(10);

        //FsmEditorGUILayout.Divider();

        if (GUILayout.Button(Strings.Command_Export_Globals))
        {
            FsmEditorUtility.ExportGlobals();
        }

        if (GUILayout.Button(Strings.Command_Import_Globals))
        {
            FsmEditorUtility.ImportGlobals();
        }
        EditorGUILayout.HelpBox(Strings.Hint_Export_Globals_Notes, MessageType.None);
    }