private static BundleDependsData CreateDependsData(BundleData data) { BundleDependsData dependsData = new BundleDependsData(); dependsData.depends = new string[data.depends.Count]; for (int i = 0; i < data.depends.Count; i++) { dependsData.depends[i] = Path.GetFileNameWithoutExtension(data.depends[i]); } dependsData.name = data.name; return(dependsData); }
static public BundleDependsData Deserialize(string str) { if (string.IsNullOrEmpty(str)) return null; BundleDependsData data = new BundleDependsData(); var paragraph = str.Split(':'); data.name = paragraph[0]; data.md5 = paragraph[1]; var depends = paragraph[2]; if (string.IsNullOrEmpty(depends)) return data; data.depends = depends.Split(','); return data; }
/// <summary> /// 插入一个bundle数据到lists /// </summary> /// <param name="data"></param> /// <param name="lists"></param> /// <returns>0 错误参数 1 新添加 2 覆盖</returns> private static int InsertBundleData(BundleDependsData data, ref List <BundleDependsData> lists) { if (data == null || lists == null) { return(0); } int index = lists.FindIndex((BundleDependsData value) => { return(data.name == value.name); }); if (index == -1) { lists.Add(data); return(1); } else { lists[index] = data; return(2); } }
public List <BundleDependsData> GetConfig() #endif { #if USE_5_BUNDLE if (mWww == null) { Debug.LogError("加载AssetBundleManifest失败!"); return(new AssetBundleManifest()); } var depends = mWww.Www.assetBundle; AssetBundleManifest resultManifest = (AssetBundleManifest)depends.LoadAsset("AssetBundleManifest"); return(resultManifest); #else if (mWww == null) { return(new List <BundleDependsData>()); } List <BundleDependsData> result = new List <BundleDependsData>(); if (mWww.mState == WaitState.Done) { string textData = mWww.Www.text; var lines = textData.Split(System.Environment.NewLine.ToCharArray()); for (int i = 0; i < lines.Length; i++) { BundleDependsData data = BundleDependsData.Deserialize(lines[i]); if (data != null) { result.Add(data); } } } return(result); #endif }
static public BundleDependsData Deserialize(string str) { if (string.IsNullOrEmpty(str)) { return(null); } BundleDependsData data = new BundleDependsData(); var paragraph = str.Split(':'); data.name = paragraph[0]; data.md5 = paragraph[1]; var depends = paragraph[2]; if (string.IsNullOrEmpty(depends)) { return(data); } data.depends = depends.Split(','); return(data); }
/// <summary> /// 插入一个bundle数据到lists /// </summary> /// <param name="data"></param> /// <param name="lists"></param> /// <returns>0 错误参数 1 新添加 2 覆盖</returns> private static int InsertBundleData(BundleDependsData data, ref List<BundleDependsData> lists) { if (data == null || lists == null) return 0; int index = lists.FindIndex((BundleDependsData value) => { return data.name == value.name; }); if (index == -1) { lists.Add(data); return 1; } else { lists[index] = data; return 2; } }
private static BundleDependsData CreateDependsData(BundleData data) { BundleDependsData dependsData = new BundleDependsData(); dependsData.depends = new string[data.depends.Count]; for (int i = 0; i < data.depends.Count; i++) { dependsData.depends[i] = Path.GetFileNameWithoutExtension(data.depends[i]); } dependsData.name = data.name; return dependsData; }