//加载Multiple Sprite public Asset <T> LoadAsset <T>([NotNull] string asset_name, int multple_index) where T : UObject { #if UI_RESOURCE GameObject asset = ResourcesEx.Load <GameObject>(texturePath + asset_name); if (asset == null) { Develop.LogError("Load Error!Cant find sprite:" + asset_name); return(null); } SpritePrefab sp = asset.GetComponent <SpritePrefab>(); if (sp == null) { Develop.LogError("Sprite Component Missing:" + asset_name); return(null); } T sprite = (T)sp.GetSprite(asset_name, -1); if (sprite == null) { Develop.LogError("Load Error!Cant find sprite:" + asset_name); return(null); } return(new Asset_Real <T>(this, sprite)); #else #if UNITY_EDITOR if (!UseBundleInEditor) { var data_object = Manifest.LoadAssetDataBase <T>(this.BundleName, asset_name, multple_index); return(new Asset_Real <T>(this, data_object)); } #endif if (this.BundleObject == null) { Develop.LogErrorF("Bundle is not loaded {0}.{1}, Index = {2}", this.BundleName, asset_name, multple_index); return(null); } if (!this.BundleObject.Contains(asset_name)) { Develop.LogErrorF("Asset Multiple Sprite CantFind {0}.{1}, Index = {2}", this.BundleName, asset_name, multple_index); return(null); } var asset_object = this.BundleObject.LoadAssetWithSubAssets <T>(asset_name); if (null == asset_object) { Develop.LogErrorF("Asset Multiple Sprite CantFind {0}.{1}, Index = {2}", this.BundleName, asset_name, multple_index); return(null); } if (asset_object.Length > multple_index) { return(new Asset_Real <T>(this, asset_object[multple_index])); } return(null); #endif }
public Asset LoadAssetAsync([NotNull] string asset_name) { #if UI_RESOURCE GameObject asset = ResourcesEx.Load <GameObject>(texturePath + asset_name); if (asset == null) { Develop.LogError("Load Error!Cant find sprite:" + asset_name); return(null); } SpritePrefab sp = asset.GetComponent <SpritePrefab>(); if (sp == null) { Develop.LogError("Sprite Component Missing:" + asset_name); return(null); } Sprite sprite = (Sprite)sp.GetSprite(1); if (sprite == null) { Develop.LogError("Load Error!Cant find sprite:" + asset_name); return(null); } return(new Asset_Real(this, sprite)); #else #if UNITY_EDITOR if (!UseBundleInEditor) { var data_object = Manifest.LoadAssetDataBase <UObject>(this.BundleName, asset_name); return(new Asset_Real(this, data_object)); } #endif if (this.BundleObject == null) { Develop.LogErrorF("Bundle is not loaded {0}.{1}", this.BundleName, asset_name); return(null); } var asset_request = this.BundleObject.LoadAssetAsync(asset_name); if (null == asset_request) { Develop.LogErrorF("Asset LoadFail {0}.{1}", this.BundleName, asset_name); return(null); } return(new Asset_Real(this, asset_request)); #endif }