예제 #1
0
    public static void CreateLuaTemplate()
    {
        string basePath = GetSelectedPath();
        //获取最后一级文件夹名,即选中的文件夹的名称
        string dirName = basePath.Substring(basePath.LastIndexOf(@"/") + 1);

        //拷贝模板文件并创建新的文件
        string moduleFilePath     = basePath + "/" + dirName + "_Module.lua";
        string controllerFilePath = basePath + "/" + dirName + "_Controller.lua";

        CreateCSharpScriptEndAction.CreateScriptAssetFromTemplate(moduleFilePath, LuaTemplateModulePath);
        CreateCSharpScriptEndAction.CreateScriptAssetFromTemplate(controllerFilePath, LuaTemplateControllerPath);

        //刷新资源
        AssetDatabase.Refresh();
    }
    public static void CreateTemplates()
    {
        string basePath = GetSelectedPath();
        //获取最后一级文件夹名,即选中的文件夹的名称
        string dirName = basePath.Substring(basePath.LastIndexOf(@"/") + 1);
        //创建对应的View和Module子路径
        string uiviewPath = Path.Combine(GetSelectedPath(), "View/");
        string modulePath = Path.Combine(GetSelectedPath(), "Module/");
        string dataPath   = Path.Combine(GetSelectedPath(), "Data/");

        CommonHelper.CheckLocalFileExist(uiviewPath);
        CommonHelper.CheckLocalFileExist(modulePath);
        CommonHelper.CheckLocalFileExist(dataPath);

        //拷贝模板文件并创建新的文件
        string uiviewFileName = uiviewPath + dirName + "_UIView.cs";
        string moduleFileName = modulePath + dirName + "_Module.cs";

        CreateCSharpScriptEndAction.CreateScriptAssetFromTemplate(uiviewFileName, CSharpTemplateUIViewPath);
        CreateCSharpScriptEndAction.CreateScriptAssetFromTemplate(moduleFileName, CSharpTemplateModulePath);

        //刷新资源
        AssetDatabase.Refresh();
    }