AB打包策略移用, 删除多余Log
This commit is contained in:
parent
fa33842fce
commit
d439c7596f
@ -24,8 +24,11 @@ public class AssetBundleMap : EditorWindow
|
||||
|
||||
private const string MatAbName_UI = "mat_UI.unity3d";
|
||||
private const string MatAbName_Icon = "mat_Icon.unity3d";
|
||||
private const string MatAbName_Effect = "mat_Effect.unity3d";
|
||||
private const string MatAbName_Actor = "mat_Actor.unity3d";
|
||||
private const string MatAbName_Effect = "_Effect_mat.unity3d";
|
||||
private const string MatAbName_Actor_Prefix = "_model_mat.unity3d";
|
||||
private const string Launch_effect = "Launch_effect.unity3d";
|
||||
private const string Launch_UI = "prefabsuicommon.unity3d";
|
||||
private const string Launch_effect_assetPath = "Assets/Content/Prefabs/Effects/UI/FX_UI_DianJi.prefab";
|
||||
/// <summary>
|
||||
/// 临时ab生成目录
|
||||
/// </summary>
|
||||
@ -43,7 +46,6 @@ public class AssetBundleMap : EditorWindow
|
||||
private static readonly BuildAssetBundleOptions BuildOptions = BuildAssetBundleOptions.DeterministicAssetBundle |
|
||||
BuildAssetBundleOptions.ChunkBasedCompression;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 构建全部资源
|
||||
/// </summary>
|
||||
@ -217,7 +219,7 @@ public class AssetBundleMap : EditorWindow
|
||||
Directory.Delete(assetBundleCCDPath, true);
|
||||
}
|
||||
Directory.CreateDirectory(assetBundleCCDPath);
|
||||
|
||||
|
||||
// 拷贝临时打包目录中的ab资源到对应的StreamingAssets目录下
|
||||
foreach (string file in Directory.GetFiles(dirPath))
|
||||
{
|
||||
@ -348,6 +350,10 @@ public class AssetBundleMap : EditorWindow
|
||||
maps.Maps = new Dictionary<string, HashSet<string>>(1024);
|
||||
maps.AllAssets = new HashSet<string>();
|
||||
|
||||
|
||||
addBuildAssetsCommonUI_Launch(maps);
|
||||
addBuildAssetsCommonEffect_Launch(maps);
|
||||
AddBuildAssetsUIAnimation(maps);
|
||||
// 增加公共shader
|
||||
addBuildAssetsCommon(maps, ShaderAbName, Constants.ShaderDir, "*.shader");
|
||||
addBuildAssetsCommon(maps, ShaderAbName, Constants.ShaderDir, "*.shadervariants");
|
||||
@ -367,6 +373,10 @@ public class AssetBundleMap : EditorWindow
|
||||
addBuildAssetsCommon(maps, "config.unity3d", Constants.CsvConfig, "*.csv");
|
||||
addBuildAssetsCommon(maps, "xml.unity3d", Constants.XmlConfig, "*.xml");
|
||||
|
||||
if (showProcessBar)
|
||||
EditorUtility.DisplayProgressBar("Generate Bundle Build Map", "UI...", 0.8f);
|
||||
addBuildAssetsUI(maps);
|
||||
|
||||
// audio
|
||||
if (showProcessBar)
|
||||
EditorUtility.DisplayProgressBar("Generate Bundle Build Map", "Audio...", 0.4f);
|
||||
@ -384,6 +394,16 @@ public class AssetBundleMap : EditorWindow
|
||||
EditorUtility.DisplayProgressBar("Generate Bundle Build Map", "Camera...", 0.6f);
|
||||
addBuildAssetsCamera(maps);
|
||||
|
||||
if (showProcessBar)
|
||||
EditorUtility.DisplayProgressBar("Generate Bundle Build Map", "Lua...", 0.9f);
|
||||
|
||||
addBuildAssetsLua(maps);
|
||||
|
||||
if (showProcessBar)
|
||||
EditorUtility.DisplayProgressBar("Generate Bundle Build Map", "Effect...", 0.75f);
|
||||
|
||||
addBuildAssetsEffect(maps);
|
||||
|
||||
if (showProcessBar)
|
||||
EditorUtility.DisplayProgressBar("Generate Bundle Build Map", "Animator...", 0.65f);
|
||||
addBuildAssetsAnimator(maps);
|
||||
@ -392,23 +412,11 @@ public class AssetBundleMap : EditorWindow
|
||||
EditorUtility.DisplayProgressBar("Generate Bundle Build Map", "Actor...", 0.7f);
|
||||
addBuildAssetsActor(maps);
|
||||
|
||||
if (showProcessBar)
|
||||
EditorUtility.DisplayProgressBar("Generate Bundle Build Map", "Effect...", 0.75f);
|
||||
|
||||
addBuildAssetsEffect(maps);
|
||||
|
||||
if (showProcessBar)
|
||||
EditorUtility.DisplayProgressBar("Generate Bundle Build Map", "UI...", 0.8f);
|
||||
addBuildAssetsUI(maps);
|
||||
|
||||
if (showProcessBar)
|
||||
EditorUtility.DisplayProgressBar("Generate Bundle Build Map", "Scene...", 0.85f);
|
||||
addBuildAssetsScene(maps);
|
||||
|
||||
if (showProcessBar)
|
||||
EditorUtility.DisplayProgressBar("Generate Bundle Build Map", "Lua...", 0.9f);
|
||||
|
||||
addBuildAssetsLua(maps);
|
||||
|
||||
|
||||
List<AssetBundleBuild> bm = new List<AssetBundleBuild>(maps.Maps.Count);
|
||||
foreach (var items in maps.Maps)
|
||||
@ -499,7 +507,7 @@ public class AssetBundleMap : EditorWindow
|
||||
}
|
||||
}
|
||||
|
||||
#region 处理各个模块的assetbundle
|
||||
#region 处理各个模块的assetbundle
|
||||
|
||||
private static void addBuildAssetsCommon(AssetMap maps, string abName, string dir,
|
||||
string filter)
|
||||
@ -566,6 +574,95 @@ public class AssetBundleMap : EditorWindow
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddBuildAssetsUIAnimation(AssetMap maps)
|
||||
{
|
||||
string[] dirList = Directory.GetDirectories(Constants.UI_Common_Anim);
|
||||
for (int idx = 0; idx < dirList.Length; idx++)
|
||||
{
|
||||
string fullPath = dirList[idx];
|
||||
string relativePath = FileUtils.ExtractAssetRelativePath(fullPath);
|
||||
|
||||
string abName = relativePath.Replace("Assets/", "").Replace("/", "_") + ".unity3d";
|
||||
string[] files = FileUtils.TraverseFiles(relativePath, "*.*");
|
||||
for (int jdx = 0; jdx < files.Length; jdx++)
|
||||
{
|
||||
string filePathName = files[jdx];
|
||||
if (filePathName.Contains(".meta")) continue;
|
||||
|
||||
string fileRelativePath = FileUtils.ExtractAssetRelativePath(filePathName);
|
||||
addData(maps, abName, fileRelativePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void addBuildAssetsCommonUIMater(AssetMap maps)
|
||||
{
|
||||
string[] fileList = FileUtils.TraverseFiles(Constants.UI_3D_Mater, "*.*");
|
||||
for (int idx = 0; idx < fileList.Length; idx++)
|
||||
{
|
||||
string fullPath = fileList[idx];
|
||||
string relativePath = FileUtils.ExtractAssetRelativePath(fullPath);
|
||||
|
||||
if (relativePath.Contains(".meta")) continue;
|
||||
|
||||
addData(maps, MatAbName_UI, relativePath);
|
||||
}
|
||||
}
|
||||
private static void addBuildAssetsCommonEffect_Launch(AssetMap maps)
|
||||
{
|
||||
string[] fileList = FileUtils.TraverseFiles(Constants.UIEffectPath, "*.*");
|
||||
for (int idx = 0; idx < fileList.Length; idx++)
|
||||
{
|
||||
string fullPath = fileList[idx];
|
||||
string relativePath = FileUtils.ExtractAssetRelativePath(fullPath);
|
||||
if (relativePath.Contains(".meta")) continue;
|
||||
|
||||
if (relativePath == Launch_effect_assetPath)
|
||||
{
|
||||
addData(maps, Launch_effect, relativePath);
|
||||
string[] dependencyAssets = AssetDatabase.GetDependencies(relativePath);
|
||||
for (int kdx = 0; kdx < dependencyAssets.Length; kdx++)
|
||||
{
|
||||
string dependencyAssetName = dependencyAssets[kdx];
|
||||
|
||||
string fileType = dependencyAssetName.Substring(dependencyAssetName.LastIndexOf('.') + 1);
|
||||
fileType = fileType.ToLower();
|
||||
if (fileType == "shader")
|
||||
{
|
||||
addData(maps, Launch_effect, dependencyAssetName);
|
||||
}
|
||||
else if (fileType == "mat")
|
||||
{
|
||||
addData(maps, Launch_effect, dependencyAssetName);
|
||||
}
|
||||
else if (fileType == "jpg" || fileType == "png" || fileType == "tga" || fileType == "tif" ||
|
||||
fileType == "psd")
|
||||
{
|
||||
addData(maps, Launch_effect, dependencyAssetName);
|
||||
}
|
||||
else if (fileType != "cs")
|
||||
{
|
||||
addData(maps, Launch_effect, dependencyAssetName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
private static void addBuildAssetsCommonUI_Launch(AssetMap maps)
|
||||
{
|
||||
string[] fileList = FileUtils.TraverseFiles(Constants.UICommonPath, "*.*");
|
||||
for (int idx = 0; idx < fileList.Length; idx++)
|
||||
{
|
||||
string fullPath = fileList[idx];
|
||||
string relativePath = FileUtils.ExtractAssetRelativePath(fullPath);
|
||||
|
||||
if (relativePath.Contains(".meta")) continue;
|
||||
|
||||
addData(maps, Launch_UI, relativePath);
|
||||
}
|
||||
}
|
||||
|
||||
private static void addBuildAssetsBGM(AssetMap maps)
|
||||
{
|
||||
string[] files = FileUtils.TraverseAllFiles(Constants.BGMAudioPath, "*.ogg");
|
||||
@ -678,13 +775,33 @@ public class AssetBundleMap : EditorWindow
|
||||
string textureABName = FileUtils.ExtractPureName(dirName) + "_texture.unity3d";
|
||||
string fbxABName = FileUtils.ExtractPureName(dirName) + "_model.unity3d";
|
||||
|
||||
string MatAbName_Actor = FileUtils.ExtractPureName(dirName) + MatAbName_Actor_Prefix; //不同文件夹材质分类
|
||||
|
||||
string[] files = FileUtils.TraverseAllFiles(dirName, "*.prefab");
|
||||
for (int idx = 0; idx < files.Length; idx++)
|
||||
{
|
||||
string fullPath = files[idx];
|
||||
string relativePath = FileUtils.ExtractAssetRelativePath(fullPath);
|
||||
|
||||
addData(maps, abName, relativePath);
|
||||
string abNameSceneMonster = relativePath.Replace("Assets/", "").Replace("/", "_") + ".unity3d";
|
||||
|
||||
int SceneId = 0; //按不同场景打包monster model 改成 所有monster 拆成单个包
|
||||
if (dirName.Contains("Monster") || dirName.Contains("monster"))
|
||||
{
|
||||
SceneId = 100;
|
||||
}
|
||||
if(dirName.Contains("Parter") || dirName.Contains("parter")) //所有的parter 拆成单个包
|
||||
{
|
||||
SceneId = 99;
|
||||
}
|
||||
if (SceneId > 0)
|
||||
{
|
||||
addData(maps, string.Format("{0}_{1}", SceneId, abNameSceneMonster), relativePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
addData(maps, abName, relativePath);
|
||||
}
|
||||
|
||||
string[] dependencyAssets = AssetDatabase.GetDependencies(relativePath);
|
||||
for (int jdx = 0; jdx < dependencyAssets.Length; jdx++)
|
||||
@ -699,20 +816,46 @@ public class AssetBundleMap : EditorWindow
|
||||
else if (fileType == "mat")
|
||||
{
|
||||
// addData(maps, MatAbName, dependencyAssetName);
|
||||
addData(maps, MatAbName_Actor, dependencyAssetName);
|
||||
|
||||
if(SceneId > 0)
|
||||
{
|
||||
// addData(maps, string.Format("{0}_{1}", SceneId, MatAbName_Actor), dependencyAssetName);
|
||||
addData(maps, string.Format("{0}_{1}", SceneId, abNameSceneMonster), dependencyAssetName);
|
||||
}
|
||||
else
|
||||
{
|
||||
addData(maps, MatAbName_Actor, dependencyAssetName);
|
||||
}
|
||||
}
|
||||
else if (fileType == "jpg" || fileType == "png" || fileType == "tga" || fileType == "tif" ||
|
||||
fileType == "psd")
|
||||
{
|
||||
addData(maps, textureABName, dependencyAssetName);
|
||||
if (SceneId > 0)
|
||||
{
|
||||
// addData(maps, string.Format("{0}_{1}", SceneId, textureABName), dependencyAssetName);
|
||||
addData(maps, string.Format("{0}_{1}", SceneId, abNameSceneMonster), dependencyAssetName);
|
||||
}
|
||||
else
|
||||
addData(maps, textureABName, dependencyAssetName);
|
||||
}
|
||||
else if (fileType == "fbx")
|
||||
{
|
||||
addData(maps, fbxABName, dependencyAssetName);
|
||||
if (SceneId > 0)
|
||||
{
|
||||
// addData(maps, string.Format("{0}_{1}", SceneId, fbxABName), dependencyAssetName);
|
||||
addData(maps, string.Format("{0}_{1}", SceneId, abNameSceneMonster), dependencyAssetName);
|
||||
}
|
||||
else
|
||||
addData(maps, fbxABName, dependencyAssetName);
|
||||
}
|
||||
else if (fileType != "cs")
|
||||
{
|
||||
addData(maps, abName, dependencyAssetName);
|
||||
if (SceneId > 0)
|
||||
{
|
||||
addData(maps, string.Format("{0}_{1}", SceneId, abNameSceneMonster), dependencyAssetName);
|
||||
}
|
||||
else
|
||||
addData(maps, abName, dependencyAssetName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -755,22 +898,37 @@ public class AssetBundleMap : EditorWindow
|
||||
|
||||
private static void addBuildAssetsEffect(AssetMap maps)
|
||||
{
|
||||
string effectTextureABName = "effect_texture.unity3d";
|
||||
string effectAnimABName = "effect_dep.unity3d";
|
||||
string abName = "effect.unity3d";
|
||||
string _effectTextureABName = "_effect_texture.unity3d";
|
||||
string _effectAnimABName = "_effect_dep.unity3d";
|
||||
string _abName = "_effect.unity3d";
|
||||
|
||||
|
||||
string[] dirs = Directory.GetDirectories(Constants.EffectPath, "*", SearchOption.AllDirectories);
|
||||
for (int idx = 0; idx < dirs.Length; idx++)
|
||||
string effectTextureABName = "";
|
||||
string effectAnimABName = "";
|
||||
string abName = "";
|
||||
string effectMaterABName = "";
|
||||
|
||||
string[] Topdirs = Directory.GetDirectories(Constants.EffectPath, "*", SearchOption.TopDirectoryOnly);
|
||||
for (int idxTop = 0; idxTop < Topdirs.Length; idxTop++) ///最上层 effect: UI, scene, Monster, Hero ..拆散成小AB包
|
||||
{
|
||||
string dirName = dirs[idx];
|
||||
string[] fileList = FileUtils.TraverseAllFiles(dirName, "*.prefab");
|
||||
string dirNameTop = Topdirs[idxTop];
|
||||
string fixName = FileUtils.RemoveExtension(FileUtils.ExtractPureName(dirNameTop));
|
||||
string findAssetName = FileUtils.ExtractAssetRelativePath(dirNameTop);
|
||||
abName = fixName + _abName;
|
||||
effectAnimABName = fixName + _effectAnimABName;
|
||||
effectTextureABName = fixName + _effectTextureABName;
|
||||
effectMaterABName = fixName + MatAbName_Effect;
|
||||
|
||||
string[] fileList = FileUtils.TraverseAllFiles(findAssetName, "*.prefab");
|
||||
for (int jdx = 0; jdx < fileList.Length; jdx++)
|
||||
{
|
||||
string fullPath = fileList[jdx];
|
||||
string relativePath = FileUtils.ExtractAssetRelativePath(fullPath);
|
||||
|
||||
if(relativePath == Launch_effect_assetPath)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
addData(maps, abName, relativePath);
|
||||
|
||||
string[] dependencyAssets = AssetDatabase.GetDependencies(relativePath);
|
||||
@ -786,10 +944,10 @@ public class AssetBundleMap : EditorWindow
|
||||
else if (fileType == "mat")
|
||||
{
|
||||
// addData(maps, MatAbName, dependencyAssetName);
|
||||
addData(maps, MatAbName_Effect, dependencyAssetName);
|
||||
addData(maps, effectMaterABName, dependencyAssetName);
|
||||
}
|
||||
else if (fileType == "jpg" || fileType == "png" || fileType == "tga" || fileType == "tif" ||
|
||||
fileType == "psd")
|
||||
fileType == "psd")
|
||||
{
|
||||
addData(maps, effectTextureABName, dependencyAssetName);
|
||||
}
|
||||
@ -799,6 +957,7 @@ public class AssetBundleMap : EditorWindow
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -844,7 +1003,6 @@ public class AssetBundleMap : EditorWindow
|
||||
}
|
||||
else if (fileType == "mat")
|
||||
{
|
||||
// addData(maps, MatAbName, dependencyAssetName);
|
||||
addData(maps, MatAbName_UI, dependencyAssetName);
|
||||
}
|
||||
else if (fileType == "jpg" || fileType == "png" || fileType == "tga" || fileType == "tif" ||
|
||||
@ -865,6 +1023,8 @@ public class AssetBundleMap : EditorWindow
|
||||
{
|
||||
string[] allAbNames = AssetDatabase.GetAllAssetBundleNames();
|
||||
|
||||
string[] filterUINames = { "GridViewItem", "UINotifyTips", "UICommonTips" }; //需要拆散的 ui Prefab
|
||||
|
||||
string[] dirs = Directory.GetDirectories(Constants.UIPath, "*", SearchOption.AllDirectories);
|
||||
for (int idx = 0; idx < dirs.Length; idx++)
|
||||
{
|
||||
@ -880,6 +1040,13 @@ public class AssetBundleMap : EditorWindow
|
||||
abName = FileUtils.ExtractPureName(dirName) + "_uiprefab.unity3d";
|
||||
}
|
||||
|
||||
bool bNeedBreakup = false;
|
||||
|
||||
if(filterUINames.Contains(FileUtils.ExtractPureName(dirName))) //加载依赖过多的文件夹 不打包进 ab
|
||||
{
|
||||
bNeedBreakup = true;
|
||||
}
|
||||
|
||||
if (allAbNames.Contains(abName))
|
||||
{
|
||||
AssetDatabase.RemoveAssetBundleName(abName, true);
|
||||
@ -891,6 +1058,11 @@ public class AssetBundleMap : EditorWindow
|
||||
string fullPath = files[jdx];
|
||||
string relativePath = FileUtils.ExtractAssetRelativePath(fullPath);
|
||||
|
||||
if(bNeedBreakup) //每个文件都进行拆散打包
|
||||
{
|
||||
abName = FileUtils.ExtractPureName(dirName) + FileUtils.RemoveExtension(FileUtils.ExtractPureName(fullPath)) + ".unity3d";
|
||||
}
|
||||
|
||||
addData(maps, abName, relativePath);
|
||||
|
||||
string rootParent;
|
||||
@ -909,7 +1081,7 @@ public class AssetBundleMap : EditorWindow
|
||||
else if (fileType == "mat")
|
||||
{
|
||||
// addData(maps, MatAbName, dependencyAssetName);
|
||||
addData(maps, MatAbName_UI, dependencyAssetName);
|
||||
// addData(maps, MatAbName_UI, dependencyAssetName);
|
||||
}
|
||||
else if (fileType == "jpg" || fileType == "png" || fileType == "tga" || fileType == "tif" ||
|
||||
fileType == "psd")
|
||||
@ -1050,9 +1222,9 @@ public class AssetBundleMap : EditorWindow
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region 处理lua文件
|
||||
#region 处理lua文件
|
||||
|
||||
private static void addBuildAssetsLua(AssetMap maps)
|
||||
{
|
||||
@ -1064,6 +1236,7 @@ public class AssetBundleMap : EditorWindow
|
||||
|
||||
ProcessConfigAndLua(maps);
|
||||
}
|
||||
|
||||
private static void CopyPbAssets(string sourceDir, string destDir)
|
||||
{
|
||||
// Delete old
|
||||
@ -1077,6 +1250,7 @@ public class AssetBundleMap : EditorWindow
|
||||
srcFI.CopyTo(Path.Combine(destDir, srcFI.Name));
|
||||
}
|
||||
}
|
||||
|
||||
private static void CopyLuaAssets(string sourceDir, string destDir, bool optimize = false)
|
||||
{
|
||||
string path = Application.dataPath;
|
||||
@ -1275,7 +1449,7 @@ public class AssetBundleMap : EditorWindow
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
private static HashSet<string> s_ValidExtMap = new HashSet<string>()
|
||||
{
|
||||
@ -1303,4 +1477,5 @@ public class AssetBundleMap : EditorWindow
|
||||
}
|
||||
return all;
|
||||
}
|
||||
|
||||
}
|
||||
@ -136,7 +136,8 @@ public static class Constants
|
||||
public const string UIItemDir = "Assets/Content/Prefabs/UI/GridViewItem";
|
||||
public const string AnimatorPath = "Assets/Content/Prefabs/Animator";
|
||||
public const string UICommonPath = "Assets/Content/Prefabs/UI/Common";
|
||||
|
||||
public const string UI_3D_Mater = "Assets/Content/Raw_Art/UI3D/Skills";
|
||||
public const string UI_Common_Anim = "Assets/Content/Raw_Art/Anim";
|
||||
#endregion Directory
|
||||
|
||||
public const string go_name_camera_target = "camera_target";
|
||||
|
||||
@ -615,7 +615,7 @@ public class AssetsMgr : SingletonMono<AssetsMgr>
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugHelper.LogError("33 Load AssetsMapping Fail:" + www.error + " filePath:" + path);
|
||||
DebugHelper.LogError("Load AssetsMapping Fail:" + www.error + " filePath:" + path);
|
||||
}
|
||||
|
||||
string assetbundleName = AssetsObscureUtil.GetABFileName("assetbundle");
|
||||
@ -635,8 +635,6 @@ public class AssetsMgr : SingletonMono<AssetsMgr>
|
||||
yield return assetBundleRequest;
|
||||
assetBundleManifest = (AssetBundleManifest)assetBundleRequest.asset;
|
||||
if (completeCB != null) completeCB(true);
|
||||
|
||||
DebugHelper.LogError("Load AssetsMapping && AssetBundleManifest Success !!" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -31,7 +31,6 @@ public class LuaLauncher : LuaClient
|
||||
|
||||
protected override void CallMain()
|
||||
{
|
||||
DebugHelper.LogError("开始拉起lua manager文件!!!");
|
||||
StartLooper();
|
||||
LuaMgr.Instance.CallMain();
|
||||
}
|
||||
@ -39,7 +38,6 @@ public class LuaLauncher : LuaClient
|
||||
protected override void StartMain()
|
||||
{
|
||||
#if UNITY_WEBGL && !UNITY_EDITOR
|
||||
DebugHelper.LogError("开始加载lua文件!!!");
|
||||
LuaMgr.Instance.StartMain();
|
||||
CallMain();
|
||||
UpdateTimer();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user