Exemplo n.º 1
0
    private static void CreateClassScript()
    {
        string path    = ExtractPath();
        string newPath = EditorUtility.SaveFilePanelInProject("New CSharp Class", "MyClass.cs", "cs", "Save", path);

        if (!PathUtility.ValidateScriptPath(newPath))
        {
            return;
        }

        path = Path.GetDirectoryName(newPath);
        string className = Path.GetFileNameWithoutExtension(newPath);

        Debug.Log("Creating " + className + " at path " + newPath);
        IScriptGenerator generator = new SimpleClassStubGenerator(className);

        ScriptSaver.GenerateScript(path, className + ".cs", generator);
    }
Exemplo n.º 2
0
    private static void Create(MonoScript script)
    {
        if (EditorApplication.isCompiling)
        {
            Debug.LogError("Busy compiling");
            return;
        }
        Type type = script.GetClass();

        if (type == null)
        {
            Debug.LogError(script.name + " is not a valid MonoBehvaiour. (Make sure the class name match the filename)");
            return;
        }
        string           folderPath = PathUtility.CreateEditorScriptPath(script);
        string           filename   = type.Name + "Editor.cs";
        IScriptGenerator generator  = new SimpleInspectorGenerator(type.Name, type.Namespace);

        ScriptSaver.GenerateScript(folderPath, filename, generator);
    }
Exemplo n.º 3
0
    private static void CreateEditorScript()
    {
        string path    = ExtractPath();
        string newPath = EditorUtility.SaveFilePanelInProject("New Editor Class", "EditorClass.cs", "cs", "Save", path);

        if (!PathUtility.PathIsEditorFolder(newPath))
        {
            Debug.LogError("Path has to be in Editor folder");
            return;
        }

        if (!PathUtility.ValidateScriptPath(newPath))
        {
            return;
        }

        path = Path.GetDirectoryName(newPath);
        string className = Path.GetFileNameWithoutExtension(newPath);

        Debug.Log("Creating " + className + " at path " + newPath);
        IScriptGenerator generator = new SimpleEditorStubGenerator(className);

        ScriptSaver.GenerateScript(path, className + ".cs", generator);
    }
Exemplo n.º 4
0
    void Generate()
    {
        IScriptGenerator generator = new SimpleWindowStubGenerator(settings);

        ScriptSaver.GenerateScript(path, settings.ClassName + ".cs", generator);
    }