//void OpenUIAsync(string UIName, XBehaviour behaviour, OpenUIParam openUIParam, Action<IUIEntity, XException> callback, params object[] args); static StackObject *OpenUIAsync_Callback_Name_Behavior_Param_Args(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, 6); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Object[] @args = (System.Object[]) typeof(System.Object[]).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.Action <TinaX.UIKit.IUIEntity, TinaX.XException> callback = (System.Action <TinaX.UIKit.IUIEntity, TinaX.XException>) typeof(System.Action <TinaX.UIKit.IUIEntity, TinaX.XException>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); TinaX.UIKit.OpenUIParam openUIParam = (TinaX.UIKit.OpenUIParam) typeof(TinaX.UIKit.OpenUIParam).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 4); TinaX.XComponent.XBehaviour behaviour = (TinaX.XComponent.XBehaviour) typeof(TinaX.XComponent.XBehaviour).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 5); System.String UIName = (System.String) typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 6); TinaX.UIKit.IUIKit instance_of_this_method = (TinaX.UIKit.IUIKit) typeof(TinaX.UIKit.IUIKit).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); //依赖注入 m_XIL.InjectObject(behaviour); openUIParam.xBehaviour = null; openUIParam.DependencyInjection = false; instance_of_this_method.OpenUIAsync(UIName, openUIParam, (entity, err) => { if (err != null) { callback?.Invoke(entity, err); } else { if (entity.UIPage.UIMainHandler != null && entity.UIPage.UIMainHandler is XComponent.XComponent) { var xcomponent = entity.UIPage.UIMainHandler as XComponent.XComponent; XILXComponentUtil.InjectBindings(xcomponent, behaviour); if (behaviour is XUIBehaviour) { ((XUIBehaviour)behaviour).UIEntity = entity; } xcomponent.AddBehaviour(behaviour); } RedirectUIKitSafe.SetEntityIfXUIBehaviour(ref behaviour, ref entity); callback?.Invoke(entity, err); } }, @args); return(__ret); }
//Task<IUIEntity> OpenUIAsync(string UIName, XBehaviour behaviour, OpenUIParam openUIParam, params object[] args); private static StackObject *OpenUIAsync_Task_Name_Behaviour_Param_Args(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, 5); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Object[] args = (System.Object[]) typeof(System.Object[]).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); TinaX.UIKit.OpenUIParam openUIParam = (TinaX.UIKit.OpenUIParam) typeof(TinaX.UIKit.OpenUIParam).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); TinaX.XComponent.XBehaviour behaviour = (TinaX.XComponent.XBehaviour) typeof(TinaX.XComponent.XBehaviour).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 4); System.String @UIName = (System.String) typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 5); TinaX.UIKit.IUIKit instance_of_this_method = (TinaX.UIKit.IUIKit) typeof(TinaX.UIKit.IUIKit).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); //依赖注入 m_XIL.InjectObject(behaviour); openUIParam.xBehaviour = null; openUIParam.DependencyInjection = false; var task_entity = instance_of_this_method.OpenUIAsync(@UIName, openUIParam, args); task_entity.ToObservable() .ObserveOnMainThread() .SubscribeOnMainThread() .Subscribe(entity => { if (entity.UIPage.UIMainHandler != null && entity.UIPage.UIMainHandler is TinaX.XComponent.XComponent) { var xcomponent = entity.UIPage.UIMainHandler as TinaX.XComponent.XComponent; XILXComponentUtil.InjectBindings(xcomponent, behaviour); if (behaviour is XUIBehaviour) { ((XUIBehaviour)behaviour).UIEntity = entity; } xcomponent.AddBehaviour(behaviour); } RedirectUIKitSafe.SetEntityIfXUIBehaviour(ref behaviour, ref entity); }, e => { }); object obj_result_of_this_method = task_entity; if (obj_result_of_this_method is CrossBindingAdaptorType) { return(ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance)); } return(ILIntepreter.PushObject(__ret, __mStack, task_entity)); }
protected virtual void OnDestroy() { if (Behaviour != null) { Behaviour.BeforeDestroy(); Behaviour.OnDestroy(); Behaviour = null; } }
public static XComponent AddBehaviour(this XComponent xscript, XBehaviour behaviuor, bool inject_bindings = true) { if (xscript.Behaviour == null) { if (inject_bindings) { XComponents.InjectBindings(xscript, behaviuor); } xscript.SetBehaviour(behaviuor); } return(xscript); }
//IUIEntity OpenUI(string UIName, XBehaviour behaviour, params object[] args); private static StackObject *OpenUI_Name_Behavior_Args(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, 4); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Object[] @args = (System.Object[]) typeof(System.Object[]).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); TinaX.XComponent.XBehaviour behaviour = (TinaX.XComponent.XBehaviour) typeof(TinaX.XComponent.XBehaviour).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); System.String @UIName = (System.String) typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 4); TinaX.UIKit.IUIKit instance_of_this_method = (TinaX.UIKit.IUIKit) typeof(TinaX.UIKit.IUIKit).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); //依赖注入 m_XIL.InjectObject(behaviour); var entity = instance_of_this_method.OpenUI(@UIName, @args); if (entity.UIPage.UIMainHandler != null && entity.UIPage.UIMainHandler is XComponent.XComponent) { var xcomponent = entity.UIPage.UIMainHandler as XComponent.XComponent; XILXComponentUtil.InjectBindings(xcomponent, behaviour); if (behaviour is XUIBehaviour) { ((XUIBehaviour)behaviour).UIEntity = entity; } xcomponent.AddBehaviour(behaviour); } RedirectUIKitSafe.SetEntityIfXUIBehaviour(ref behaviour, ref entity); object obj_result_of_this_method = entity; if (obj_result_of_this_method is CrossBindingAdaptorType) { return(ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance)); } return(ILIntepreter.PushObject(__ret, __mStack, entity)); }
internal protected XComponent SetBehaviour(XBehaviour behaviour) { if (Behaviour != null) { throw new Exception("Behaviour has exist, cannot add repeatedly"); } this.Behaviour = behaviour; this.Name = behaviour.GetType().Name; this.FullName = behaviour.GetType().FullName; behaviour.gameObject = this.gameObject; behaviour.transform = this.transform; behaviour.xComponent = this; if (mAwaked) { this.Behaviour.Awake(); } if (mEnable && this.enabled) { this.Behaviour.OnEnable(); } if (m_MsgQueue.Count > 0) { foreach (var item in m_MsgQueue) { this.Behaviour.OnMessage(item.MessageName, item.Args); } m_MsgQueue.Clear(); } if (mStarted) { this.Behaviour.Start(); } if (mDisable && !this.enabled) { this.Behaviour.OnDisable(); } return(this); }
public static XComponent AddXComponent(this GameObject go, XBehaviour behaviour) { return(go.AddComponent <XComponent>().SetBehaviour(behaviour)); }