/// <summary> /// Remove a package. All resources in this package will be disposed. /// </summary> /// <param name="packageIdOrName"></param> /// <param name="allowDestroyingAssets"></param> public static void RemovePackage(string packageIdOrName) { UIPackage pkg = null; if (!_packageInstById.TryGetValue(packageIdOrName, out pkg)) { if (!_packageInstByName.TryGetValue(packageIdOrName, out pkg)) { // LLWANT: 不抛异常,只输出日志提示 Debug.Log("FairyGUI: '" + packageIdOrName + "' is not a valid package id or name. maybe removed"); return; } } pkg.Dispose(); _packageInstById.Remove(pkg.id); if (pkg._customId != null) { _packageInstById.Remove(pkg._customId); } if (pkg.assetPath != null) { _packageInstById.Remove(pkg.assetPath); } _packageInstByName.Remove(pkg.name); _packageList.Remove(pkg); }
public static void RemovePackage(string packageId) { UIPackage pkg = (UIPackage)_packageInstById[packageId]; pkg.Dispose(); _packageInstById.Remove(packageId); if (pkg._customId != null) { _packageInstById.Remove(pkg._customId); } }
/// <summary> /// Remove a package. All resources in this package will be disposed. /// </summary> /// <param name="packageIdOrName"></param> /// <param name="allowDestroyingAssets"></param> public static void RemovePackage(string packageIdOrName, bool allowDestroyingAssets) { UIPackage pkg = null; if (!_packageInstById.TryGetValue(packageIdOrName, out pkg)) { if (!_packageInstByName.TryGetValue(packageIdOrName, out pkg)) throw new Exception("FairyGUI: '" + packageIdOrName + "' is not a valid package id or name."); } pkg.Dispose(allowDestroyingAssets); _packageInstById.Remove(packageIdOrName); if (pkg._customId != null) _packageInstById.Remove(pkg._customId); if (pkg.assetPath != null) _packageInstById.Remove(pkg.assetPath); _packageInstByName.Remove(pkg.name); _packageList.Remove(pkg); }