/// <summary> /// 异步加载 /// </summary> /// <param name="callback"></param> public void AsyncLoad(Action callback) { // JDeBug.Inst.Log("开始任务:" + resourcePath); BResources.AsyncLoadSource <GameObject>(resourcePath, (bool result, GameObject o) => { var go = GameObject.Instantiate(o); Transform = go.transform; Transform.gameObject.SetActive(false); // ClientMain.AddToUIRoot(Transform); IsLoad = true; Init(); if (callback != null) { callback(); } }); }
/// <summary> /// 异步加载 /// </summary> /// <param name="callback"></param> public void AsyncLoad(Action callback) { // JDeBug.Inst.Log("开始任务:" + resourcePath); BResources.AsyncLoadSource <GameObject>(resourcePath, (bool result, GameObject o) => { var go = GameObject.Instantiate(o); Transform = go.transform; Transform.gameObject.SetActive(false); IsLoad = true; //自动查找节点 UITools.AutoSetTransformPath(this); Init(); if (callback != null) { callback(); } }); }
static StackObject *AsyncLoadSource_1(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, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Action <System.Boolean, UnityEngine.GameObject> @action = (System.Action <System.Boolean, UnityEngine.GameObject>) typeof(System.Action <System.Boolean, UnityEngine.GameObject>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.String @objName = (System.String) typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = BResources.AsyncLoadSource <UnityEngine.GameObject>(@objName, @action); __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method; return(__ret + 1); }