private static void CreateScript(string name, AssetCreator.AssetClassType classType, bool cSharp) { string text = AssetDatabase.GetAssetPath(Selection.activeObject); if (text == string.Empty) { text = "Assets"; } else if (Path.GetExtension(text) != string.Empty) { text = text.Replace(Path.GetFileName(AssetDatabase.GetAssetPath(Selection.activeObject)), string.Empty); } string path = AssetDatabase.GenerateUniqueAssetPath(text + "/" + name + ((!cSharp) ? ".js" : ".cs")); StreamWriter streamWriter = new StreamWriter(path, false); string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(path); string value = string.Empty; switch (classType) { case AssetCreator.AssetClassType.Action: value = AssetCreator.ActionTaskContents(fileNameWithoutExtension, cSharp); break; case AssetCreator.AssetClassType.Conditional: value = AssetCreator.ConditionalTaskContents(fileNameWithoutExtension, cSharp); break; case AssetCreator.AssetClassType.SharedVariable: value = AssetCreator.SharedVariableContents(fileNameWithoutExtension); break; } streamWriter.Write(value); streamWriter.Close(); AssetDatabase.Refresh(); }
public static void ShowWindow(AssetCreator.AssetClassType classType, bool cSharp) { AssetCreator window = EditorWindow.GetWindow <AssetCreator>(true, "Asset Name"); EditorWindow arg_25_0 = window; Vector2 vector = new Vector2(300f, 55f); window.maxSize = vector; arg_25_0.minSize = vector; window.ClassType = classType; window.CSharp = cSharp; }