/// <summary> /// Add if necessary a list of Global events to the PlayMaker Globals resources to be available in the global events list /// </summary> /// <param name="events"></param> public static void CreateGlobalEventsIfNeeded(string[] events) { bool _isDirty = false; foreach (string _eventName in events) { if (!FsmEvent.IsEventGlobal(_eventName)) { PlayMakerGlobals.AddGlobalEvent(_eventName); // Debug.Log("Adding global event: "+_eventName); _isDirty = true; } } if (_isDirty) { FsmEditor.SaveGlobals(); for (int index = 0; index < FsmEvent.globalEvents.Count; ++index) { new FsmEvent(FsmEvent.globalEvents[index]).IsGlobal = true; } FsmEventsWindow.ResetView(); } }
public static void OnPostprocessScene() { /* TODO: Figure out if we need to do this! * // OnPostprocessScene is called when loading a scene in the editor * // Might not want to post process in that case...? * if (EditorApplication.isPlayingOrWillChangePlaymode) * { * return; * }*/ //Debug.Log("OnPostprocessScene"); PlayMakerGlobals.IsBuilding = true; PlayMakerGlobals.InitApplicationFlags(); var fsmList = Resources.FindObjectsOfTypeAll <PlayMakerFSM>(); foreach (var playMakerFSM in fsmList) { //Debug.Log(FsmEditorUtility.GetFullFsmLabel(playMakerFSM)); if (!Application.isPlaying) // actually making a build vs playing in editor { playMakerFSM.Preprocess(); } } PlayMakerGlobals.IsBuilding = false; //Debug.Log("EndPostProcessScene"); }
private static void Initialize() { PlayMakerGlobals.Initialize(); eventList = new List <FsmEvent>(); AddSystemEvents(); AddGlobalEvents(); }
private static void Initialize() { PlayMakerGlobals.Initialize(); SkillEvent.eventList = new List <SkillEvent>(); SkillEvent.AddSystemEvents(); SkillEvent.AddGlobalEvents(); }
public static void Initialize() { if (!PlayMakerGlobals.Initialized) { PlayMakerGlobals.InitApplicationFlags(); Object @object = Resources.Load("PlayMakerGlobals", typeof(PlayMakerGlobals)); if (@object != null) { if (PlayMakerGlobals.IsPlayingInEditor) { PlayMakerGlobals playMakerGlobals = (PlayMakerGlobals)@object; PlayMakerGlobals.instance = ScriptableObject.CreateInstance <PlayMakerGlobals>(); PlayMakerGlobals.instance.Variables = new SkillVariables(playMakerGlobals.variables); PlayMakerGlobals.instance.Events = new List <string>(playMakerGlobals.Events); } else { PlayMakerGlobals.instance = (@object as PlayMakerGlobals); } } else { PlayMakerGlobals.instance = ScriptableObject.CreateInstance <PlayMakerGlobals>(); } PlayMakerGlobals.Initialized = true; } }
void OnEnable() { //Debug.Log("PlayMakerGlobalsInspector: OnEnable"); globals = target as PlayMakerGlobals; BuildVariableList(); }
private void Awake() { PlayMakerGlobals.Initialize(); if (!PlayMakerGlobals.IsEditor) { FsmLog.LoggingEnabled = false; } Init(); }
public static void OnPostprocessScene() { /* TODO: Figure out if we need to do this! * // OnPostprocessScene is called when loading a scene in the editor * // Might not want to post process in that case...? * if (EditorApplication.isPlayingOrWillChangePlaymode) * { * return; * }*/ //Debug.Log("OnPostprocessScene"); if (Application.isPlaying) // playing in editor, not really making a build { return; } PlayMakerGlobals.IsBuilding = true; PlayMakerGlobals.InitApplicationFlags(); var fsmList = Resources.FindObjectsOfTypeAll <PlayMakerFSM>(); foreach (var playMakerFSM in fsmList) { //Debug.Log(FsmEditorUtility.GetFullFsmLabel(playMakerFSM)); #if UNITY_2018_3_OR_NEWER // TODO: we need a new build tool to process prefabs if (FsmPrefabs.IsPrefab(playMakerFSM.Fsm)) { var assetPath = AssetDatabase.GetAssetPath(playMakerFSM); var go = PrefabUtility.LoadPrefabContents(assetPath); var prefabFSMs = go.GetComponents <PlayMakerFSM>(); foreach (var prefabFSM in prefabFSMs) { prefabFSM.Preprocess(); } PrefabUtility.SaveAsPrefabAsset(go, assetPath); PrefabUtility.UnloadPrefabContents(go); continue; } #endif playMakerFSM.Preprocess(); } PlayMakerGlobals.IsBuilding = false; //Debug.Log("EndPostProcessScene"); }
public static void Import() { AssetDatabase.Refresh(); GlobalsAsset.projectGlobals = PlayMakerGlobals.get_Instance(); string text = EditorUtility.OpenFilePanel(Strings.get_Dialog_Import_Globals(), "", "unitypackage"); if (text.get_Length() == 0) { return; } AssetDatabase.ImportPackage("PlayMakerGlobals.unitypackage", false); EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.update, new EditorApplication.CallbackFunction(GlobalsAsset.DoImport)); EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Combine(EditorApplication.update, new EditorApplication.CallbackFunction(GlobalsAsset.DoImport)); }
public static void OnPostprocessScene() { PlayMakerGlobals.set_IsBuilding(true); PlayMakerGlobals.InitApplicationFlags(); PlayMakerFSM[] array = Resources.FindObjectsOfTypeAll <PlayMakerFSM>(); PlayMakerFSM[] array2 = array; for (int i = 0; i < array2.Length; i++) { PlayMakerFSM playMakerFSM = array2[i]; if (!Application.get_isPlaying()) { playMakerFSM.Preprocess(); } } PlayMakerGlobals.set_IsBuilding(false); }
public static void Export() { AssetDatabase.Refresh(); SkillEditor.SaveGlobals(); AssetDatabase.CopyAsset(AssetDatabase.GetAssetPath(PlayMakerGlobals.get_Instance()), "Assets/PlaymakerGlobals_EXPORTED.asset"); AssetDatabase.Refresh(); string text = EditorUtility.SaveFilePanel(Strings.get_Dialog_Export_Globals(), "", "PlayMakerGlobals.unitypackage", "unitypackage"); if (text.get_Length() == 0) { return; } AssetDatabase.ExportPackage("Assets/PlaymakerGlobals_EXPORTED.asset", text); AssetDatabase.DeleteAsset("Assets/PlaymakerGlobals_EXPORTED.asset"); AssetDatabase.Refresh(); Dialogs.OkDialog(Strings.get_Labels_Use_Import_Globals_()); }
// Used to happen in PlayMakerGlobals constructor, // but 5.4 made that illegal...? private static bool InitApplicationFlags() { #if PLAYMAKER_SOURCE PlayMakerGlobals.InitApplicationFlags(); return(true); #else var playMakerGlobals = GetType("PlayMakerGlobals"); if (playMakerGlobals != null) { var init = playMakerGlobals.GetMethod("InitApplicationFlags"); if (init != null) { init.Invoke(null, null); return(true); } } return(false); #endif }
public static void OnPostprocessScene() { /* TODO: Figure out if we need to do this! * // OnPostprocessScene is called when loading a scene in the editor * // Might not want to post process in that case...? * if (EditorApplication.isPlayingOrWillChangePlaymode) * { * return; * }*/ //Debug.Log("OnPostprocessScene: " + SceneManager.GetActiveScene().name); if (Application.isPlaying) // playing in editor, not really making a build { return; } PlayMakerGlobals.IsBuilding = true; PlayMakerGlobals.InitApplicationFlags(); var fsmList = Resources.FindObjectsOfTypeAll <PlayMakerFSM>(); foreach (var playMakerFSM in fsmList) { if (playMakerFSM == null) { continue; // not sure when this happens, but need to catch it... } #if UNITY_5_6_OR_NEWER if (FsmPrefabs.IsPrefab(playMakerFSM)) { // already processed by PlayMakerPreProcessBuild continue; } #endif playMakerFSM.Preprocess(); } PlayMakerGlobals.IsBuilding = false; //Debug.Log("EndPostProcessScene"); }
static PlayMakerEditorStartup() { //Debug.Log(EditorApplication.timeSinceStartup); #if PLAYMAKER PlayMakerGlobals.InitApplicationFlags(); #endif // Resources.Load fails in static constructor (unity bug?) // So we delay some work that needs PlayMakerEditorPrefs until next update EditorApplication.update -= DoWelcomeScreen; EditorApplication.update += DoWelcomeScreen; // Constructor is also called on Playmode change // So we need to handle that case (e.g., don't show welcome window) EditorApplication.playmodeStateChanged -= PlayModeChanged; EditorApplication.playmodeStateChanged += PlayModeChanged; }
public static void OnPostProcessScene() { // No need to post process if playing in editor, // sine we're not really making a build if (Application.isPlaying) { return; } DebugLog("OnPostProcessScene", LogColor.Yellow); PlayMakerGlobals.IsBuilding = true; PlayMakerGlobals.InitApplicationFlags(); var fsmList = Resources.FindObjectsOfTypeAll <PlayMakerFSM>(); foreach (var playMakerFSM in fsmList) { // not sure when this happens, but need to catch it... if (playMakerFSM == null) { continue; } // PlayMakerPreProcessBuild has already processed prefabs if (FsmPrefabs.IsPrefab(playMakerFSM)) { continue; } playMakerFSM.Preprocess(); StripEditorData(playMakerFSM); } PlayMakerGlobals.IsBuilding = false; //Debug.Log("EndPostProcessScene"); }
public static void OnPostprocessScene() { //Debug.Log("OnPostprocessScene"); PlayMakerGlobals.IsBuilding = true; PlayMakerGlobals.Initialize(); var fsmList = Resources.FindObjectsOfTypeAll <PlayMakerFSM>(); foreach (var playMakerFSM in fsmList) { //Debug.Log(FsmEditorUtility.GetFullFsmLabel(playMakerFSM)); if (!Application.isPlaying) // actually making a build vs playing in editor { playMakerFSM.Preprocess(); } } PlayMakerGlobals.IsBuilding = false; //Debug.Log("EndPostProcessScene"); }
private static void DoImport() { EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.update, new EditorApplication.CallbackFunction(GlobalsAsset.DoImport)); Debug.Log(Strings.get_Label_Importing_Globals_()); PlayMakerGlobals[] array = (PlayMakerGlobals[])Resources.FindObjectsOfTypeAll(typeof(PlayMakerGlobals)); if (array.Length == 1) { Dialogs.OkDialog(Strings.get_Dialog_No_Globals_to_import()); return; } string text = ""; PlayMakerGlobals[] array2 = array; for (int i = 0; i < array2.Length; i++) { PlayMakerGlobals playMakerGlobals = array2[i]; if (playMakerGlobals != GlobalsAsset.projectGlobals) { Debug.Log(Strings.get_Label_Importing_() + AssetDatabase.GetAssetPath(playMakerGlobals)); text += SkillBuilder.MergeGlobals(playMakerGlobals, GlobalsAsset.projectGlobals); } } if (!string.IsNullOrEmpty(text)) { Dialogs.OkDialog(Strings.get_Dialog_ImportGlobals_Error() + Environment.get_NewLine() + text); } PlayMakerGlobals[] array3 = array; for (int j = 0; j < array3.Length; j++) { PlayMakerGlobals playMakerGlobals2 = array3[j]; if (playMakerGlobals2 != GlobalsAsset.projectGlobals) { AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(playMakerGlobals2)); } } SkillEditor.SaveGlobals(); }
public static void ResetInstance() { instance = null; }
public void OnDestroy() { Initialized = false; instance = null; }
public static void ResetInstance() { PlayMakerGlobals.instance = null; }
void OnEnable() { globals = target as PlayMakerGlobals; BuildVariableList(); }
public void OnDestroy() { PlayMakerGlobals.Initialized = false; PlayMakerGlobals.instance = null; }
public void OnEnable() { globals = target as PlayMakerGlobals; Init(); }