public override IEnumerator LoadAsync() { if (IsLoad) { yield break; } IsLoad = false; Request_ = CreateBundleRequestAsync(AssetPath); yield return(Request_); if (Request_ == null || !Request_.isDone) { LLogger.LWarning($"Load AssetBundle : {AssetPath} Failed"); } else { RefCount_ = 0; IsLoad = true; Bundle_ = Request_.assetBundle; OnLoad(); Request_ = null; } yield break; }
protected BaseAssetBundleCache(AssetCacheType AssetType, string AssetPath, UnityEngine.AssetBundleManifest Manifest) : base(AssetType, AssetPath) { this.Manifest_ = Manifest; this.Request_ = null; this.Bundle_ = null; }
static StackObject *Ctor_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *__ret = ILIntepreter.Minus(__esp, 0); var result_of_this_method = new UnityEngine.AssetBundleCreateRequest(); return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
static int _m_LoadFromStreamAsync_xlua_st_(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); int gen_param_count = LuaAPI.lua_gettop(L); if (gen_param_count == 1 && translator.Assignable <System.IO.Stream>(L, 1)) { System.IO.Stream _stream = (System.IO.Stream)translator.GetObject(L, 1, typeof(System.IO.Stream)); UnityEngine.AssetBundleCreateRequest gen_ret = UnityEngine.AssetBundle.LoadFromStreamAsync( _stream); translator.Push(L, gen_ret); return(1); } if (gen_param_count == 2 && translator.Assignable <System.IO.Stream>(L, 1) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2)) { System.IO.Stream _stream = (System.IO.Stream)translator.GetObject(L, 1, typeof(System.IO.Stream)); uint _crc = LuaAPI.xlua_touint(L, 2); UnityEngine.AssetBundleCreateRequest gen_ret = UnityEngine.AssetBundle.LoadFromStreamAsync( _stream, _crc); translator.Push(L, gen_ret); return(1); } if (gen_param_count == 3 && translator.Assignable <System.IO.Stream>(L, 1) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3)) { System.IO.Stream _stream = (System.IO.Stream)translator.GetObject(L, 1, typeof(System.IO.Stream)); uint _crc = LuaAPI.xlua_touint(L, 2); uint _managedReadBufferSize = LuaAPI.xlua_touint(L, 3); UnityEngine.AssetBundleCreateRequest gen_ret = UnityEngine.AssetBundle.LoadFromStreamAsync( _stream, _crc, _managedReadBufferSize); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.AssetBundle.LoadFromStreamAsync!")); }
static int _m_LoadFromFileAsync_xlua_st_(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); int gen_param_count = LuaAPI.lua_gettop(L); if (gen_param_count == 1 && (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)) { string _path = LuaAPI.lua_tostring(L, 1); UnityEngine.AssetBundleCreateRequest gen_ret = UnityEngine.AssetBundle.LoadFromFileAsync( _path); translator.Push(L, gen_ret); return(1); } if (gen_param_count == 2 && (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2)) { string _path = LuaAPI.lua_tostring(L, 1); uint _crc = LuaAPI.xlua_touint(L, 2); UnityEngine.AssetBundleCreateRequest gen_ret = UnityEngine.AssetBundle.LoadFromFileAsync( _path, _crc); translator.Push(L, gen_ret); return(1); } if (gen_param_count == 3 && (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && (LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) || LuaAPI.lua_isuint64(L, 3))) { string _path = LuaAPI.lua_tostring(L, 1); uint _crc = LuaAPI.xlua_touint(L, 2); ulong _offset = LuaAPI.lua_touint64(L, 3); UnityEngine.AssetBundleCreateRequest gen_ret = UnityEngine.AssetBundle.LoadFromFileAsync( _path, _crc, _offset); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.AssetBundle.LoadFromFileAsync!")); }
static int _g_get_assetBundle(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); try { UnityEngine.AssetBundleCreateRequest __cl_gen_to_be_invoked = (UnityEngine.AssetBundleCreateRequest)translator.FastGetCSObj(L, 1); translator.Push(L, __cl_gen_to_be_invoked.assetBundle); } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } return(1); }
static StackObject *get_assetBundle_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.AssetBundleCreateRequest instance_of_this_method = (UnityEngine.AssetBundleCreateRequest) typeof(UnityEngine.AssetBundleCreateRequest).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 0); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.assetBundle; return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if (LuaAPI.lua_gettop(L) == 1) { UnityEngine.AssetBundleCreateRequest gen_ret = new UnityEngine.AssetBundleCreateRequest(); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.AssetBundleCreateRequest constructor!")); }
public override void LoadSync() { IsLoad = false; var Bundle = Request_ != null ? Request_.assetBundle : CreateBundleRequestSync(AssetPath); if (!Bundle) { LLogger.LWarning($"Load AssetBundle : {AssetPath} Failed"); } else { RefCount_ = 0; IsLoad = true; Bundle_ = Bundle; OnLoad(); Request_ = null; } }
static int _m_LoadFromMemoryAsync_xlua_st_(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); int __gen_param_count = LuaAPI.lua_gettop(L); try { if (__gen_param_count == 1 && (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)) { byte[] binary = LuaAPI.lua_tobytes(L, 1); UnityEngine.AssetBundleCreateRequest __cl_gen_ret = UnityEngine.AssetBundle.LoadFromMemoryAsync(binary); translator.Push(L, __cl_gen_ret); return(1); } if (__gen_param_count == 2 && (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2)) { byte[] binary = LuaAPI.lua_tobytes(L, 1); uint crc = LuaAPI.xlua_touint(L, 2); UnityEngine.AssetBundleCreateRequest __cl_gen_ret = UnityEngine.AssetBundle.LoadFromMemoryAsync(binary, crc); translator.Push(L, __cl_gen_ret); return(1); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.AssetBundle.LoadFromMemoryAsync!")); }
public override void start(System.Object obj) { m_request = UnityEngine.AssetBundle.LoadFromFileAsync(m_bundlePath); }
public FLoadBundle(string bundlePath) { m_bundlePath = bundlePath; m_request = null; }
/** CoroutineMain */ public System.Collections.IEnumerator CoroutineMain(Fee.AssetBundleList.OnAssetBundleListCoroutine_CallBackInterface a_callback_interface, string a_assetbundle_name) { //result this.result = new ResultType(); { AssetBundleItem t_assetbundle_item = Fee.AssetBundleList.AssetBundleList.GetInstance().GetAssetBundleItem(a_assetbundle_name); if (t_assetbundle_item != null) { //成功。 this.result.assetbundle_item = t_assetbundle_item; yield break; } } PathItem t_pathitem = AssetBundleList.GetInstance().GetPathItem(a_assetbundle_name); if (t_pathitem == null) { //失敗。 this.result.errorstring = "Coroutine_LoadPathItemAssetBundleItem : Not Found Path : " + a_assetbundle_name; yield break; } //ダミーアセットバンドルの読み込み。 #if (UNITY_EDITOR) if (t_pathitem.assetbundle_pathtype == AssetBundlePathType.AssetsPathDummyAssetBundle) { string t_result_string = null; { Fee.File.Item t_item_dummy_assetbundle_json = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadAssetsPathTextFile, t_pathitem.assetbundle_path); if (t_item_dummy_assetbundle_json == null) { //失敗。 this.result.errorstring = "Coroutine_LoadPathItemAssetBundleItem : item_json = null : " + a_assetbundle_name; yield break; } do { if (a_callback_interface != null) { a_callback_interface.OnAssetBundleListCoroutine(t_item_dummy_assetbundle_json.GetResultProgress()); } yield return(null); }while(t_item_dummy_assetbundle_json.IsBusy() == true); if (t_item_dummy_assetbundle_json.GetResultAssetType() == Asset.AssetType.Text) { t_result_string = t_item_dummy_assetbundle_json.GetResultAssetText(); } if (t_result_string == null) { //失敗。 this.result.errorstring = "Coroutine_LoadPathItemAssetBundleItem : result_string == null : " + a_assetbundle_name; yield break; } } //DummryAssetBundle Fee.AssetBundleList.DummryAssetBundle t_dummyassetbundle = Fee.JsonItem.Convert.JsonStringToObject <Fee.AssetBundleList.DummryAssetBundle>(t_result_string); if (t_dummyassetbundle == null) { //失敗。 this.result.errorstring = "Coroutine_LoadPathItemAssetBundleItem : dummyassetbundle = null : " + a_assetbundle_name; yield break; } AssetBundleItem t_assetbundle_item = new AssetBundleItem(t_dummyassetbundle, t_pathitem); //登録。 Fee.AssetBundleList.AssetBundleList.GetInstance().RegistAssetBundleItem(a_assetbundle_name, t_assetbundle_item); //成功。 this.result.assetbundle_item = t_assetbundle_item; yield break; } #endif //アセットバンドルの読み込み。 { //アセットバンドル。 Fee.Pattern.Progress t_progress = new Fee.Pattern.Progress(new float[] { 0.5f, 0.5f }); //アセットバンドルのバイナリ読み込み。 byte[] t_result_binary = null; { Fee.File.Item t_item_bianry = null; switch (t_pathitem.assetbundle_pathtype) { #if (UNITY_EDITOR) case AssetBundlePathType.AssetsPathAssetBundle: { //アセットフォルダにあるアセットバンドルの相対パス。 t_item_bianry = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadAssetsPathBinaryFile, t_pathitem.assetbundle_path); } break; #endif case AssetBundlePathType.UrlAssetBundle: { //URL。 t_item_bianry = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadUrlBinaryFile, t_pathitem.assetbundle_path); } break; case AssetBundlePathType.StreamingAssetsAssetBundle: { //ストリーミングアセット。 t_item_bianry = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadStreamingAssetsBinaryFile, t_pathitem.assetbundle_path); } break; case AssetBundlePathType.LocalAssetBundle: { //ローカル。 t_item_bianry = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadLocalBinaryFile, t_pathitem.assetbundle_path); } break; case AssetBundlePathType.FullPathAssetBundle: { //フルパス。 t_item_bianry = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadFullPathBinaryFile, t_pathitem.assetbundle_path); } break; default: { //失敗。 this.result.errorstring = "Coroutine_LoadPathItemAssetBundleItem : PathTypeError : " + a_assetbundle_name; yield break; } break; } if (t_item_bianry == null) { //失敗。 this.result.errorstring = "Coroutine_LoadPathItemAssetBundleItem : item_bianry = null : " + a_assetbundle_name; yield break; } do { //■ステップ0。 if (a_callback_interface != null) { t_progress.SetStep((int)Progress_MainStep.Progress_MainStep_0_LoadBinary, 0, 1); a_callback_interface.OnAssetBundleListCoroutine(t_progress.CalcProgress(t_item_bianry.GetResultProgress())); } yield return(null); }while(t_item_bianry.IsBusy() == true); if (t_item_bianry.GetResultAssetType() == Asset.AssetType.Binary) { t_result_binary = t_item_bianry.GetResultAssetBinary(); } if (t_result_binary == null) { //失敗。 this.result.errorstring = "Coroutine_LoadPathItemAssetBundleItem : result_binary == null : " + a_assetbundle_name; yield break; } else { System.Collections.Generic.Dictionary <string, string> t_response_header = t_item_bianry.GetResultResponseHeader(); if (t_response_header != null) { string t_response_code; if (t_item_bianry.GetResultResponseHeader().TryGetValue(Fee.File.Config.RESPONSECODE_KEY, out t_response_code) == true) { if (t_response_code != "200") { //失敗。 this.result.errorstring = "Coroutine_LoadPathItemAssetBundleItem : t_response_code = " + t_response_code; yield break; } } } } } //バイナリーのアセットバンドル化。 { UnityEngine.AssetBundleCreateRequest t_request = null; //LoadFromMemoryAsync try{ t_request = UnityEngine.AssetBundle.LoadFromMemoryAsync(t_result_binary); }catch (System.Exception t_exception) { Tool.DebugReThrow(t_exception); } if (t_request == null) { this.result.errorstring = "Coroutine_LoadPathItemAssetBundleItem : request == null : " + a_assetbundle_name; yield break; } do { //■ステップ1。 if (a_callback_interface != null) { t_progress.SetStep((int)Progress_MainStep.Progress_MainStep_1_LoadFromMemoryAsync, 0, 1); a_callback_interface.OnAssetBundleListCoroutine(t_progress.CalcProgress(t_request.progress)); } yield return(null); }while(t_request.isDone == false); if (t_request.assetBundle == null) { //失敗。 this.result.errorstring = "Coroutine_LoadPathItemAssetBundleItem : assetbundle == null : " + a_assetbundle_name; yield break; } { AssetBundleItem t_assetbundle_item = new AssetBundleItem(t_request.assetBundle, t_pathitem); #if (UNITY_EDITOR) { UnityEngine.Object[] t_object = t_request.assetBundle.LoadAllAssets(); for (int ii = 0; ii < t_object.Length; ii++) { Tool.Log(a_assetbundle_name, t_object[ii].name); } } #endif //登録。 Fee.AssetBundleList.AssetBundleList.GetInstance().RegistAssetBundleItem(a_assetbundle_name, t_assetbundle_item); //成功。 this.result.assetbundle_item = t_assetbundle_item; yield break; } } } }