【打包工具】添加IOS打包工工具的部分功能
parent
f46357527d
commit
28dbfe57eb
|
@ -36,7 +36,7 @@ public class AutoPack : EditorWindow
|
||||||
#elif UNITY_IOS
|
#elif UNITY_IOS
|
||||||
static string Platform = "IOS";
|
static string Platform = "IOS";
|
||||||
static string ConfigFileName = "config.txt";
|
static string ConfigFileName = "config.txt";
|
||||||
static string VersionFileName = "game.info";
|
static string VersionFileName = "version.txt";
|
||||||
#else
|
#else
|
||||||
static string Platform = "Android";
|
static string Platform = "Android";
|
||||||
static string ConfigFileName = "config.txt";
|
static string ConfigFileName = "config.txt";
|
||||||
|
@ -171,16 +171,32 @@ public class AutoPack : EditorWindow
|
||||||
string tpath = ClientConfigManager.Instance.GetClientConfigPath() + "/Version/" + PackConfig[i].version + "/" + VersionFileName;
|
string tpath = ClientConfigManager.Instance.GetClientConfigPath() + "/Version/" + PackConfig[i].version + "/" + VersionFileName;
|
||||||
GameEditor.Util.ProcessUtil.OpenText(tpath);
|
GameEditor.Util.ProcessUtil.OpenText(tpath);
|
||||||
}
|
}
|
||||||
if (GUILayout.Button("编辑Gradle", GUILayout.Height(20f)))
|
if (GameLogic.AppConst.PlatformPath.Equals("Android"))
|
||||||
{
|
{
|
||||||
string tpath = _MomPackPath + PackConfig[i].project + "/build.gradle";
|
if (GUILayout.Button("编辑Gradle", GUILayout.Height(20f)))
|
||||||
GameEditor.Util.ProcessUtil.OpenText(tpath);
|
{
|
||||||
|
string tpath = _MomPackPath + PackConfig[i].project + "/build.gradle";
|
||||||
|
GameEditor.Util.ProcessUtil.OpenText(tpath);
|
||||||
|
}
|
||||||
|
if (GUILayout.Button("更新蓝鲸SDK", GUILayout.Height(20f)))
|
||||||
|
{
|
||||||
|
File.Copy(_MomPackPath + "BlueWhaleJar/app/build/outputs/aar/app-release.aar", _MomPackPath + PackConfig[i].project + "/libs/BlueWhale.aar", true);
|
||||||
|
Debug.Log("更新完成");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (GUILayout.Button("更新蓝鲸SDK", GUILayout.Height(20f)))
|
else
|
||||||
{
|
{
|
||||||
File.Copy(_MomPackPath + "BlueWhaleJar/app/build/outputs/aar/app-release.aar", _MomPackPath + PackConfig[i].project + "/libs/BlueWhale.aar", true);
|
if (GUILayout.Button("同步配置文件", GUILayout.Height(20f)))
|
||||||
Debug.Log("更新完成");
|
{
|
||||||
|
ReplaceConfigAndVersion(i);
|
||||||
|
}
|
||||||
|
if (GUILayout.Button("开始混淆", GUILayout.Height(20f)))
|
||||||
|
{
|
||||||
|
EncryptAB(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EditorGUILayout.EndHorizontal();
|
EditorGUILayout.EndHorizontal();
|
||||||
}
|
}
|
||||||
EditorGUILayout.EndVertical();
|
EditorGUILayout.EndVertical();
|
||||||
|
@ -422,6 +438,10 @@ public class AutoPack : EditorWindow
|
||||||
private static void EncryptAB(int index)
|
private static void EncryptAB(int index)
|
||||||
{
|
{
|
||||||
string toPath = _MomPackPath + PackConfig[index].project + "/src/main/assets/Android";
|
string toPath = _MomPackPath + PackConfig[index].project + "/src/main/assets/Android";
|
||||||
|
if (GameLogic.AppConst.PlatformPath.Equals("IOS"))
|
||||||
|
{
|
||||||
|
toPath = _MomPackPath + PackConfig[index].project + "/Data/Raw/IOS";
|
||||||
|
}
|
||||||
|
|
||||||
string json = File.ReadAllText(toPath + "/"+ VersionFileName);
|
string json = File.ReadAllText(toPath + "/"+ VersionFileName);
|
||||||
VersionTxt version = JsonUtility.FromJson<VersionTxt>(json);
|
VersionTxt version = JsonUtility.FromJson<VersionTxt>(json);
|
||||||
|
@ -449,16 +469,29 @@ public class AutoPack : EditorWindow
|
||||||
// 替换配置文件
|
// 替换配置文件
|
||||||
private static void ReplaceConfigAndVersion(int index)
|
private static void ReplaceConfigAndVersion(int index)
|
||||||
{
|
{
|
||||||
EditorUtility.DisplayProgressBar("替换配置文件1", "", 0.5f);
|
if (GameLogic.AppConst.PlatformPath.Equals("Android")) {
|
||||||
string fromPath = ClientConfigManager.Instance.GetClientConfigPath() + "/Version/" + PackConfig[index].version + "/";
|
|
||||||
string toPath = _MomPackPath + PackConfig[index].project + "/Config/";
|
//EditorUtility.DisplayProgressBar("替换配置文件1", "", 0.5f);
|
||||||
File.Copy(fromPath + ConfigFileName, toPath + ConfigFileName, true);
|
string fromPath = ClientConfigManager.Instance.GetClientConfigPath() + "/Version/" + PackConfig[index].version + "/";
|
||||||
File.Copy(fromPath + VersionFileName, toPath + VersionFileName, true);
|
string toPath = _MomPackPath + PackConfig[index].project + "/Config/";
|
||||||
EditorUtility.DisplayProgressBar("替换配置文件2", "", 0.5f);
|
File.Copy(fromPath + ConfigFileName, toPath + ConfigFileName, true);
|
||||||
fromPath = toPath;
|
File.Copy(fromPath + VersionFileName, toPath + VersionFileName, true);
|
||||||
toPath = _MomPackPath + PackConfig[index].project + "/src/main/assets/Android/";
|
//EditorUtility.DisplayProgressBar("替换配置文件2", "", 0.5f);
|
||||||
File.Copy(fromPath + ConfigFileName, toPath + ConfigFileName, true);
|
fromPath = toPath;
|
||||||
File.Copy(fromPath + VersionFileName, toPath + VersionFileName, true);
|
toPath = _MomPackPath + PackConfig[index].project + "/src/main/assets/Android/";
|
||||||
|
File.Copy(fromPath + ConfigFileName, toPath + ConfigFileName, true);
|
||||||
|
File.Copy(fromPath + VersionFileName, toPath + VersionFileName, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//EditorUtility.DisplayProgressBar("替换配置文件", "", 0.5f);
|
||||||
|
string fromPath = ClientConfigManager.Instance.GetClientConfigPath() + "/Version/" + PackConfig[index].version + "/";
|
||||||
|
string toPath = _MomPackPath + PackConfig[index].project + "/Data/Raw/IOS/";
|
||||||
|
File.Copy(fromPath + ConfigFileName, toPath + ConfigFileName, true);
|
||||||
|
File.Copy(fromPath + VersionFileName, toPath + VersionFileName, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Debug.Log(PackConfig[index].name+":配置文件替换完成");
|
Debug.Log(PackConfig[index].name+":配置文件替换完成");
|
||||||
EditorUtility.ClearProgressBar();
|
EditorUtility.ClearProgressBar();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue