public static void Open(LZFighterStateData data) { LZFighterStateEditor window = EditorWindow.GetWindow <LZFighterStateEditor>(); window.data = data; window.Init(); window.Show(); }
public static bool step1(int instanceID, int line) { UnityEngine.Object obj = EditorUtility.InstanceIDToObject(instanceID); if (obj is LZFighterStateData) { LZFighterStateEditor window = EditorWindow.GetWindow <LZFighterStateEditor>(); window.data = (LZFighterStateData)obj; window.Show(); //window.Init(); return(true); } return(false); // we did not handle the open }
public void DrawState(StateMachineNode state) { if (state.IsShortcut) { DrawShortcut(state); return; } LabelTitle(state.name); state.data = (LZFighterStateData)EditorGUILayout.ObjectField(state.data, typeof(LZFighterStateData), false); if (state.data != null && state.name == "") { state.name = state.data.name; } // Edit instance if (GUILayout.Button("Edit")) { if (state.data == null) { LZFighter fighter = LZFighterEditor.Instance.fighter; string path = AssetDatabase.GetAssetPath(fighter); string filename = Path.GetFileNameWithoutExtension(path); string directory = Path.GetDirectoryName(path); if (!AssetDatabase.IsValidFolder(directory + "/" + filename)) { AssetDatabase.CreateFolder(directory, filename); } LZFighterStateData newData = ScriptableObject.CreateInstance <LZFighterStateData>(); AssetDatabase.CreateAsset(newData, directory + "/" + filename + "/" + state.name + ".asset"); Debug.Log(Path.GetDirectoryName(path)); state.data = newData; } LZFighterStateEditor.Open(state.data); } string currentName = state.name; string newName = EditorGUILayout.TextField("Name:", currentName); /*if (currentName != newName && state.data != null) { * AssetDatabase.RenameAsset(AssetDatabase.GetAssetPath(state.data), newName); * }*/ state.name = newName; state.velocity = EditorGUILayout.Vector2Field("StateVelocity: ", state.velocity); if (state.data != null) { state.data.velocity = EditorGUILayout.Vector2Field("DataVelocity:", state.data.velocity); } state.invert = EditorGUILayout.Toggle("Invert", state.invert); state.loop = EditorGUILayout.Toggle("Loop", state.loop); GUITools.ScriptListField(state.scripts, fighter); }