private void OnGUI()
{
GUILayout.Label("新包路径:" + Application.dataPath.Replace("Assets", EditorUtil.AssetBundlesOutputPath));
if (GUILayout.Button("Build新包" + Util.GetPlatformName()))
{
EditorUtil.BundleTime += 1;
string temp = Application.dataPath.Replace("Assets", EditorUtil.BundlePath) + "/";
temp = temp.Replace("\\", "/");
if (Packager.BuildAssetResource(EditorUserBuildSettings.activeBuildTarget, temp))
{
m_JustBundlePath = temp;
}
}
GUILayout.Label("现在打包版本为当前Editor设置的平台");
GUILayout.Label("注意,上面按钮打包会自动更新当前的小版本号!!");
if (GUILayout.Button("还原当Version号"))
{
EditorUtil.BundleTime = 0;
}
GUILayout.Label("刚打包的目录:" + m_JustBundlePath);
GUILayout.Label("游戏包资源目录:" + Application.streamingAssetsPath);
if (GUILayout.Button("清理StreamingAssets并向其拷贝刚打包资源"))
{
if (m_JustBundlePath != null)
{
CopyDir(m_JustBundlePath, Application.streamingAssetsPath);
}
else
{
EditorUtility.DisplayDialog("提示", "还未进行打包!", "开始打包", "取消拷贝");
}
}
GUILayout.Label("下面按钮会打包到路径:" + pathToStoreAB);
GUILayout.Label("当前Lua包版本号:" + EditorUtil.luaPackVersion);
if (GUILayout.Button("选择打包目录"))
{
pathToStoreAB = EditorUtility.OpenFolderPanel("选择你想拷贝到的目录", pathToStoreAB, "");
}
if (GUILayout.Button("Build iPhone Resource"))
{
BuildTarget target;
#if UNITY_5
target = BuildTarget.iOS;
#else
target = BuildTarget.iPhone;
#endif
m_JustBundlePath = pathToStoreAB + "/" + EditorUtil.luaPackVersion + "/iOS/";
Packager.BuildAssetResource(target, m_JustBundlePath);
}
if (GUILayout.Button("Build Android Resource"))
{
m_JustBundlePath = pathToStoreAB + "/" + EditorUtil.luaPackVersion + "/Android/";
Packager.BuildAssetResource(BuildTarget.Android, m_JustBundlePath);
}
if (GUILayout.Button("Build Windows Resource"))
{
m_JustBundlePath = pathToStoreAB + "/" + EditorUtil.luaPackVersion + "/Windows/";
Packager.BuildAssetResource(BuildTarget.StandaloneWindows, m_JustBundlePath);
}
}