public async ETTask AddPackageAsync(string type) { if (s_Packages.ContainsKey(type)) { await ETTask.CompletedTask; } TextAsset desTextAsset = await XAssetLoader.LoadAssetAsync <TextAsset>(XAssetPathUtilities.GetFGUIDesPath($"{type}_fui")); s_Packages.Add(type, UIPackage.AddPackage(desTextAsset.bytes, type, LoadPackageInternalAsync)); }
/// <summary> /// 移除一个包,并清理其asset /// </summary> /// <param name="type"></param> public void RemovePackage(string type) { UIPackage package; if (s_Packages.TryGetValue(type, out package)) { var p = UIPackage.GetByName(package.name); if (p != null) { UIPackage.RemovePackage(package.name); XAssetLoader.UnLoadAsset(XAssetPathUtilities.GetFGUIDesPath($"{type}_fui")); XAssetLoader.UnLoadAsset(XAssetPathUtilities.GetFGUIResPath($"{type}_atlas0", ".png")); } s_Packages.Remove(package.name); } }