예제 #1
0
        public static void ExportPackageWithTime()
        {
            //拼接时间字符串合成文件名
            string fileName = "Assets/RushDevelopFW_" + RDTimer.GetTime() + ".unitypackage";

            EditorUtility.DisplayProgressBar("R.D.PackageManager", "正在导出UnityPackage,请不要关闭编辑器...", 99);
            //自动导出
            AssetDatabase.ExportPackage("Assets", fileName, ExportPackageOptions.Recurse);
            //导出后,打开package所在文件夹

            RDIO.OpenFolder(Application.dataPath);
            Debug.LogFormat("已成功导出Packagez至{0}!", "Assets/");
            EditorUtility.ClearProgressBar();
        }
예제 #2
0
 private void OnGUI()
 {
     GUILayout.BeginArea(middleCenterRect);
     GUILayout.BeginVertical();
     EditorGUILayout.LabelField("R.D.设置脚本头信息", labelStyle, GUILayout.Width(220));
     GUILayout.Space(20);
     //uiAssetsUrl = EditorGUILayout.TextField(new GUIContent("UIAssetsUrl", "UI资源路径"), uiAssetsUrl);
     //输入条目
     copyRight = EditorGUILayout.TextField(new GUIContent("Team"), copyRight);
     fileName  = EditorGUILayout.TextField(new GUIContent("FileName"), fileName);
     author    = EditorGUILayout.TextField(new GUIContent("Author"), author);
     version   = EditorGUILayout.TextField(new GUIContent("Version"), version);
     desc      = EditorGUILayout.TextField(new GUIContent("Description"), desc);
     hist      = EditorGUILayout.TextField(new GUIContent("History"), hist);
     GUILayout.Space(20);
     GUILayout.BeginHorizontal();
     if (copyRight != "" || fileName != "" || author != "" || version != "" || desc != "" || hist != "")
     {
         headlineContent = beginInfo + copyRightHead + "#" + copyRight + "#" + rightInfo + fileNameInfo + "#" + fileName + "#"
                           + authorInfo + "#" + author + "#" + versionInfo + "#" + version + "#" + dateInfo + "#" + RDTimer.GetTime() + "#" + descInfo + "#" + desc + "#"
                           + histInfo + "#" + hist + "#" + endInfo;
     }
     else
     {
         if (File.Exists(Application.dataPath + "/RushDevelopFW/Scripts/SystemDefine/GlobalDefine/HeadInfo.json"))
         {
             headlineContent = File.ReadAllText(Application.dataPath + "/RushDevelopFW/Scripts/SystemDefine/GlobalDefine/HeadInfo.json");
         }
     }
     isInfoSet = GUILayout.Toggle(isInfoSet, new GUIContent("是否需要设置头信息"), GUILayout.Width(200));
     if (GUILayout.Button("保存", GUILayout.Width(80)))
     {
         //File.WriteAllText(Application.dataPath + "/RushDevelopFW/Scripts/SystemDefine/GlobalDefine/HeadInfoTool.cs",
         //    "public class HeadInfoTool\n{\npublic static bool isNeedHeadInfo=" + isInfoSet.ToString().ToLower() + ";\npublic const string headInfo = @\"" + headlineContent + "\";\n}");
         File.WriteAllText(Application.dataPath + "/RushDevelopFW/Scripts/SystemDefine/GlobalDefine/HeadInfoTool.cs",
                           "public class HeadInfoTool\n{\npublic static bool isNeedHeadInfo=" + isInfoSet.ToString().ToLower() + ";\n}");
         File.WriteAllText(Application.dataPath + "/RushDevelopFW/Scripts/SystemDefine/GlobalDefine/HeadInfo.json", headlineContent);
         EditorUtility.DisplayDialog("R.D.UI设置脚本头信息", "保存成功!", "好的");
         AssetDatabase.Refresh();
     }
     GUILayout.Space(20);
     //HeadInfoTool.isNeedHeadInfo = GUILayout.Toggle(isInfoSet, new GUIContent("是否需要设置头信息"), GUILayout.Width(200));
     GUILayout.EndHorizontal();
     GUILayout.Space(30);
     EditorGUILayout.LabelField(new GUIContent(headlineContent), labelStyle, GUILayout.Width(500));
     GUILayout.Space(10);
     GUILayout.EndVertical();
     GUILayout.EndArea();
 }