// 创建版本控制文本 static void CreateVersionText() { VersionText verText = new VersionText(); verText.version = "1.0.0"; AssetBundle ab = AssetBundle.LoadFromFile("Assets/AssetBundles/AssetBundles"); AssetBundleManifest am = ab.LoadAsset <AssetBundleManifest> ("AssetBundleManifest"); string[] bdles = am.GetAllAssetBundles(); verText.assetBds = new BundleItemInfo[bdles.Length]; int i = 0; foreach (var item in bdles) { BundleItemInfo bi = new BundleItemInfo(); bi.BDName = item; // 名称 AssetBundle subAB = AssetBundle.LoadFromFile("Assets/AssetBundles/" + item); bi.hashCode = subAB.GetHashCode(); bi.dependences = am.GetAllDependencies(item); verText.assetBds[i] = bi; i++; } string json = JsonMapper.ToJson(verText); string dirPath = Path.Combine(Application.dataPath, "Vertion"); string filePath = Path.Combine(dirPath, "version.txt"); if (!Directory.Exists(dirPath)) { Directory.CreateDirectory(dirPath); } if (File.Exists(filePath)) { File.Delete(filePath); } File.WriteAllText(filePath, json); Debug.Log("----------------->版本控制文本完成"); }
public override int GetHashCode() => VersionText.GetHashCode();
static void Postfix(VersionText __instance) { versionText(__instance).text += " (MOD)"; }