public FUIPackage AddPackage(string assetPath, FUIPackage.LoadResource loadFunc) { if (_packageInstById.ContainsKey(assetPath)) { return(_packageInstById[assetPath]); } TextAsset asset = (TextAsset)loadFunc(assetPath + "_fui", ".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 + "'"); } } FUIByteBuffer buffer = new FUIByteBuffer(asset.bytes); FUIPackage pkg = new FUIPackage(); pkg.m_loadFunc = loadFunc; pkg.AssetPath = assetPath; if (!pkg.LoadPackage(buffer, assetPath, assetPath)) { return(null); } _packageInstById[pkg.Id] = pkg; _packageInstByName[pkg.Name] = pkg; _packageInstById[assetPath] = pkg; _packageList.Add(pkg); return(pkg); }
public bool LoadPackage(FUIByteBuffer buffer, string packageSource, string assetNamePrefix) { return(false); }