public static UIPackage AddPackage(string assetPath, UIPackage.LoadResource loadFunc) { if (_packageInstById.ContainsKey(assetPath)) return _packageInstById[assetPath]; TextAsset asset = (TextAsset)loadFunc(assetPath, ".bytes", typeof(TextAsset)); if (asset == null) { if (Application.isPlaying) throw new Exception("FairyGUI: Cannot load ui package in '" + assetPath + "'"); else Debug.LogWarning("FairyGUI: Cannot load ui package in '" + assetPath + "'"); } UIPackage pkg = new UIPackage(); pkg._loadFunc = loadFunc; pkg.Create(asset.text, null, assetPath); if (_packageInstById.ContainsKey(pkg.id)) Debug.LogWarning("FairyGUI: Package id conflicts, '" + pkg.name + "' and '" + _packageInstById[pkg.id].name + "'"); _packageInstById[pkg.id] = pkg; _packageInstByName[pkg.name] = pkg; _packageInstById[assetPath] = pkg; _packageList.Add(pkg); pkg.assetPath = assetPath; return pkg; }
/// <summary> /// Add a UI package from a description text and a assetbundle, with a optional main asset name. /// </summary> /// <param name="desc">Description text.</param> /// <param name="res">A assetbundle contains resources.</param> /// <param name="mainAssetName">Main asset name.</param> /// <returns>UIPackage</returns> public static UIPackage AddPackage(string desc, AssetBundle res, string mainAssetName) { UIPackage pkg = new UIPackage(); pkg.Create(desc, res, mainAssetName); _packageInstById[pkg.id] = pkg; _packageInstByName[pkg.name] = pkg; _packageList.Add(pkg); return pkg; }
public static UIPackage AddPackage(byte[] desc, AssetBundle res, string resourceNamePrefix) { UIPackage pkg = new UIPackage(); pkg.Create(desc, res, resourceNamePrefix); _packageInstById[pkg.id] = pkg; _packageInstByName[pkg.name] = pkg; return(pkg); }
public static UIPackage AddPackage(string descFilePath) { UIPackage pkg = new UIPackage(); pkg.Create(descFilePath); _packageInstById[pkg.id] = pkg; _packageInstByName[pkg.name] = pkg; pkg.customId = descFilePath; return(pkg); }
public static UIPackage AddPackage(string assetPath, UIPackage.LoadResource loadFunc) { if (_packageInstById.ContainsKey(assetPath)) return _packageInstById[assetPath]; TextAsset asset = (TextAsset)loadFunc(assetPath, ".bytes", typeof(TextAsset)); if (asset == null) { if (Application.isPlaying) throw new Exception("FairyGUI: Cannot load ui package in '" + assetPath + "'"); else Debug.LogWarning("FairyGUI: Cannot load ui package in '" + assetPath + "'"); } UIPackage pkg = new UIPackage(); pkg._loadFunc = loadFunc; pkg.Create(asset.text, null, assetPath); _packageInstById[pkg.id] = pkg; _packageInstByName[pkg.name] = pkg; _packageInstById[assetPath] = pkg; _packageList.Add(pkg); pkg.assetPath = assetPath; return pkg; }
public static UIPackage AddPackage(string descFilePath) { UIPackage pkg = new UIPackage(); pkg.Create(descFilePath); _packageInstById[pkg.id] = pkg; _packageInstByName[pkg.name] = pkg; pkg.customId = descFilePath; return pkg; }
public static UIPackage AddPackage(byte[] desc, AssetBundle res, string resourceNamePrefix) { UIPackage pkg = new UIPackage(); pkg.Create(desc, res, resourceNamePrefix); _packageInstById[pkg.id] = pkg; _packageInstByName[pkg.name] = pkg; return pkg; }