public IEnumerator LoadUIAsset(CUILoadState loadState, UILoadRequest request) { string path = string.Format("ui/{0}.prefab{1}", loadState.TemplateName, KEngine.AppEngine.GetConfig("KEngine", "AssetBundleExt")); var assetLoader = KStaticAssetLoader.Load(path); loadState.UIResourceLoader = assetLoader; // 基本不用手工释放的 while (!assetLoader.IsCompleted) yield return null; request.Asset = assetLoader.TheAsset; }
public virtual IEnumerator LoadUIAsset(UILoadState loadState, UILoadRequest request) { string path = string.Format("ui/{0}.prefab", loadState.TemplateName); var assetLoader = StaticAssetLoader.Load(path); loadState.UIResourceLoader = assetLoader; // 基本不用手工释放的 while (!assetLoader.IsCompleted) { yield return(null); } request.Asset = assetLoader.TheAsset; }
public IEnumerator LoadUIAsset(CUILoadState loadState, UILoadRequest request) { string path = string.Format("UI/{0}_UI{1}", loadState.TemplateName, KEngine.AppEngine.GetConfig("AssetBundleExt")); var assetLoader = KStaticAssetLoader.Load(path); loadState.UIResourceLoader = assetLoader; // 基本不用手工释放的 while (!assetLoader.IsCompleted) { yield return(null); } request.Asset = assetLoader.TheAsset; }
public IEnumerator LoadUIAsset(UILoadState loadState, UILoadRequest request) { #if UNITY_5 string path = string.Format("UI/{0}.prefab", loadState.TemplateName); #else string path = string.Format("UI/{0}_UI", loadState.TemplateName); #endif var assetLoader = StaticAssetLoader.Load(path); loadState.UIResourceLoader = assetLoader; // 基本不用手工释放的 while (!assetLoader.IsCompleted) yield return null; request.Asset = assetLoader.TheAsset; }
public IEnumerator LoadUIAsset(CUILoadState openState, UILoadRequest request) { var name = openState.TemplateName; // 具体加载逻辑 // manifest string manifestPath = ResourceDepUtils.GetBuildPath(string.Format("BundleResources/NGUI/{0}.prefab.manifest{1}", name, AppEngine.GetConfig(KEngineDefaultConfigs.AssetBundleExt))); var manifestLoader = KBytesLoader.Load(manifestPath, KResourceInAppPathType.PersistentAssetsPath, KAssetBundleLoaderMode.PersitentDataPathSync); while (!manifestLoader.IsCompleted) { yield return(null); } var manifestBytes = manifestLoader.Bytes; manifestLoader.Release(); // 释放掉文本字节 var utf8NoBom = new UTF8Encoding(false); var manifestList = utf8NoBom.GetString(manifestBytes).Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); for (var i = 0; i < manifestList.Length; i++) { var depPath = manifestList[i] + AppEngine.GetConfig(KEngineDefaultConfigs.AssetBundleExt); var depLoader = KAssetFileLoader.Load(depPath); while (!depLoader.IsCompleted) { yield return(null); } } string path = ResourceDepUtils.GetBuildPath(string.Format("BundleResources/NGUI/{0}.prefab{1}", name, KEngine.AppEngine.GetConfig("AssetBundleExt"))); var assetLoader = KStaticAssetLoader.Load(path); openState.UIResourceLoader = assetLoader; // 基本不用手工释放的 while (!assetLoader.IsCompleted) { yield return(null); } request.Asset = assetLoader.TheAsset; }
public IEnumerator LoadUIAsset(CUILoadState openState, UILoadRequest request) { var name = openState.TemplateName; // 具体加载逻辑 // manifest string manifestPath = ResourceDepUtils.GetBuildPath(string.Format("BundleResources/NGUI/{0}.prefab.manifest{1}", name, AppEngine.GetConfig(KEngineDefaultConfigs.AssetBundleExt))); var manifestLoader = KBytesLoader.Load(manifestPath, KResourceInAppPathType.PersistentAssetsPath, KAssetBundleLoaderMode.PersitentDataPathSync); while (!manifestLoader.IsCompleted) yield return null; var manifestBytes = manifestLoader.Bytes; manifestLoader.Release(); // 释放掉文本字节 var utf8NoBom = new UTF8Encoding(false); var manifestList = utf8NoBom.GetString(manifestBytes).Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); for (var i = 0; i < manifestList.Length; i++) { var depPath = manifestList[i] + AppEngine.GetConfig(KEngineDefaultConfigs.AssetBundleExt); var depLoader = KAssetFileLoader.Load(depPath); while (!depLoader.IsCompleted) { yield return null; } } string path = ResourceDepUtils.GetBuildPath(string.Format("BundleResources/NGUI/{0}.prefab{1}", name, KEngine.AppEngine.GetConfig("AssetBundleExt"))); var assetLoader = KStaticAssetLoader.Load(path); openState.UIResourceLoader = assetLoader; // 基本不用手工释放的 while (!assetLoader.IsCompleted) yield return null; request.Asset = assetLoader.TheAsset; }