Ejemplo n.º 1
0
        //释放逻辑数据
        private void ReleaseLogicData()
        {
            if (HotLogicInstance != null)
            {
                HotLogicInstance = null;
                if (UserUIData != null)
                {
                    //ReferencePool.Release(UserUIData);  //回收
                    UserUIData = null;
                }

                ReferencePool.Release((IReference)OnInitMethod);
                ReferencePool.Release((IReference)OnOpenMethod);
                ReferencePool.Release((IReference)OnUpdateMethod);
                ReferencePool.Release((IReference)OnRefocusMethod);
                ReferencePool.Release((IReference)OnResumeMethod);
                ReferencePool.Release((IReference)OnPauseMethod);
                ReferencePool.Release((IReference)OnCoverMethod);
                ReferencePool.Release((IReference)OnRevealMethod);
                ReferencePool.Release((IReference)OnCloseMethod);
                ReferencePool.Release((IReference)OnDepthChangedMethod);

                OnInitMethod         = null;
                OnOpenMethod         = null;
                OnUpdateMethod       = null;
                OnRefocusMethod      = null;
                OnResumeMethod       = null;
                OnPauseMethod        = null;
                OnCoverMethod        = null;
                OnRevealMethod       = null;
                OnCloseMethod        = null;
                OnDepthChangedMethod = null;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 销毁时调用
        /// </summary>
        /// <param name="procedureOwner">流程持有者</param>
        protected override void OnDestroy(IFsm <IProcedureManager> procedureOwner)
        {
            base.OnDestroy(procedureOwner);
            GameEntry.Hotfix.InvokeOne(HotProcedureLogicTypeFullName, "OnDestroy", HotLogicInstance, procedureOwner); //调用销毁方法

            if (OnUpdateMethod != null)
            {
                ReferencePool.Release(OnUpdateMethod);  //回收
                OnUpdateMethod = null;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 进入流程时调用
        /// </summary>
        /// <param name="procedureOwner">流程持有者</param>
        protected override void OnEnter(IFsm <IProcedureManager> procedureOwner)
        {
            base.OnEnter(procedureOwner);

            if (HotLogicInstance == null)
            {
                HotLogicInstance = GameEntry.Hotfix.CreateInstance(HotProcedureLogicTypeFullName, null);                     //创建热更逻辑实例
                GameEntry.Hotfix.InvokeOne(HotProcedureLogicTypeFullName, "OnInit", HotLogicInstance, procedureOwner, this); //调用初始化方法

                //获取更新方法
#if ILRuntime
                OnUpdateMethod = ReferencePool.Acquire <ILInstanceMethod>().Fill(HotLogicInstance, HotProcedureLogicTypeFullName, "OnUpdate", 1);
#else
                OnUpdateMethod = ReferencePool.Acquire <ReflectInstanceMethod>().Fill(HotLogicInstance, HotProcedureLogicTypeFullName, "OnUpdate");
#endif
            }

            //调用进入流程的方法
            GameEntry.Hotfix.InvokeOne(HotProcedureLogicTypeFullName, "OnEnter", HotLogicInstance, procedureOwner);
        }
Ejemplo n.º 4
0
        //初始化逻辑
        private void InitLogicData(UserEntityData data)
        {
            HotLogicInstance = GameEntry.Hotfix.CreateInstance(data.HotLogicTypeFullName, null);  //创建实例
            HotLogicScript   = data.HotLogicTypeFullName;

#if ILRuntime
            //获取方法
            OnInitMethod             = ReferencePool.Acquire <ILInstanceMethod>().Fill(HotLogicInstance, data.HotLogicTypeFullName, "OnInit", 1);
            OnShowMethod             = ReferencePool.Acquire <ILInstanceMethod>().Fill(HotLogicInstance, data.HotLogicTypeFullName, "OnShow", 1);
            OnHideMethod             = ReferencePool.Acquire <ILInstanceMethod>().Fill(HotLogicInstance, data.HotLogicTypeFullName, "OnHide", 1);
            OnUpdateMethod           = ReferencePool.Acquire <ILInstanceMethod>().Fill(HotLogicInstance, data.HotLogicTypeFullName, "OnUpdate", 0);
            OnAttachedMethod         = ReferencePool.Acquire <ILInstanceMethod>().Fill(HotLogicInstance, data.HotLogicTypeFullName, "OnAttached", 3);
            OnDetachedMethod         = ReferencePool.Acquire <ILInstanceMethod>().Fill(HotLogicInstance, data.HotLogicTypeFullName, "OnDetached", 2);
            OnAttachToMethod         = ReferencePool.Acquire <ILInstanceMethod>().Fill(HotLogicInstance, data.HotLogicTypeFullName, "OnAttachTo", 3);
            OnDetachFromMethod       = ReferencePool.Acquire <ILInstanceMethod>().Fill(HotLogicInstance, data.HotLogicTypeFullName, "OnDetachFrom", 2);
            InternalSetVisibleMethod = ReferencePool.Acquire <ILInstanceMethod>().Fill(HotLogicInstance, data.HotLogicTypeFullName, "InternalSetVisible", 1);
            OnTriggerEnterMethod     = ReferencePool.Acquire <ILInstanceMethod>().Fill(HotLogicInstance, data.HotLogicTypeFullName, "OnTriggerEnter", 1);
            OnTriggerExitMethod      = ReferencePool.Acquire <ILInstanceMethod>().Fill(HotLogicInstance, data.HotLogicTypeFullName, "OnTriggerExit", 1);
#else
            //获取方法
            OnInitMethod             = ReferencePool.Acquire <ReflectInstanceMethod>().Fill(HotLogicInstance, data.HotLogicTypeFullName, "OnInit");
            OnShowMethod             = ReferencePool.Acquire <ReflectInstanceMethod>().Fill(HotLogicInstance, data.HotLogicTypeFullName, "OnShow");
            OnHideMethod             = ReferencePool.Acquire <ReflectInstanceMethod>().Fill(HotLogicInstance, data.HotLogicTypeFullName, "OnHide");
            OnUpdateMethod           = ReferencePool.Acquire <ReflectInstanceMethod>().Fill(HotLogicInstance, data.HotLogicTypeFullName, "OnUpdate");
            OnAttachedMethod         = ReferencePool.Acquire <ReflectInstanceMethod>().Fill(HotLogicInstance, data.HotLogicTypeFullName, "OnAttached");
            OnDetachedMethod         = ReferencePool.Acquire <ReflectInstanceMethod>().Fill(HotLogicInstance, data.HotLogicTypeFullName, "OnDetached");
            OnAttachToMethod         = ReferencePool.Acquire <ReflectInstanceMethod>().Fill(HotLogicInstance, data.HotLogicTypeFullName, "OnAttachTo");
            OnDetachFromMethod       = ReferencePool.Acquire <ReflectInstanceMethod>().Fill(HotLogicInstance, data.HotLogicTypeFullName, "OnDetachFrom");
            InternalSetVisibleMethod = ReferencePool.Acquire <ReflectInstanceMethod>().Fill(HotLogicInstance, data.HotLogicTypeFullName, "InternalSetVisible");
            OnTriggerEnterMethod     = ReferencePool.Acquire <ReflectInstanceMethod>().Fill(HotLogicInstance, data.HotLogicTypeFullName, "OnTriggerEnter");
            OnTriggerExitMethod      = ReferencePool.Acquire <ReflectInstanceMethod>().Fill(HotLogicInstance, data.HotLogicTypeFullName, "OnTriggerExit");
#endif

            if (OnInitMethod.IsAvalible)
            {
                OnInitMethod.Run(this);
            }
        }
Ejemplo n.º 5
0
        //释放资源
        private void ReleaseLogicData()
        {
            if (HotLogicInstance != null)
            {
                //Log.Info(Utility.Text.Format("实体逻辑Release -> {0}", HotLogicScript));
                if (UserEntityData != null)
                {
                    //ReferencePool.Release(UserEntityData);  //回收
                    UserEntityData = null;
                }
                ReferencePool.Release((IReference)OnInitMethod);
                ReferencePool.Release((IReference)OnShowMethod);
                ReferencePool.Release((IReference)OnHideMethod);
                ReferencePool.Release((IReference)OnAttachedMethod);
                ReferencePool.Release((IReference)OnDetachedMethod);
                ReferencePool.Release((IReference)OnAttachToMethod);
                ReferencePool.Release((IReference)OnDetachFromMethod);
                ReferencePool.Release((IReference)OnUpdateMethod);
                ReferencePool.Release((IReference)InternalSetVisibleMethod);
                ReferencePool.Release((IReference)OnTriggerEnterMethod);
                ReferencePool.Release((IReference)OnTriggerExitMethod);

                HotLogicInstance = null;

                OnInitMethod             = null;
                OnShowMethod             = null;
                OnHideMethod             = null;
                OnAttachedMethod         = null;
                OnDetachedMethod         = null;
                OnAttachToMethod         = null;
                OnDetachFromMethod       = null;
                OnUpdateMethod           = null;
                InternalSetVisibleMethod = null;
                OnTriggerEnterMethod     = null;
                OnTriggerExitMethod      = null;
            }
        }
Ejemplo n.º 6
0
        //初始化逻辑数据
        private void InitLogicData(UserUIData data)
        {
            HotLogicInstance = GameEntry.Hotfix.CreateInstance(UserUIData.HotLogicTypeFullName, null);  //创建实例
            HotLogicScript   = UserUIData.HotLogicTypeFullName;

#if ILRuntime
            //获取方法
            OnInitMethod         = ReferencePool.Acquire <ILInstanceMethod>().Fill(HotLogicInstance, UserUIData.HotLogicTypeFullName, "OnInit", 1);
            OnOpenMethod         = ReferencePool.Acquire <ILInstanceMethod>().Fill(HotLogicInstance, UserUIData.HotLogicTypeFullName, "OnOpen", 1);
            OnUpdateMethod       = ReferencePool.Acquire <ILInstanceMethod>().Fill(HotLogicInstance, UserUIData.HotLogicTypeFullName, "OnUpdate", 0);
            OnRefocusMethod      = ReferencePool.Acquire <ILInstanceMethod>().Fill(HotLogicInstance, UserUIData.HotLogicTypeFullName, "OnRefocus", 1);
            OnResumeMethod       = ReferencePool.Acquire <ILInstanceMethod>().Fill(HotLogicInstance, UserUIData.HotLogicTypeFullName, "OnResume", 0);
            OnPauseMethod        = ReferencePool.Acquire <ILInstanceMethod>().Fill(HotLogicInstance, UserUIData.HotLogicTypeFullName, "OnPause", 0);
            OnCoverMethod        = ReferencePool.Acquire <ILInstanceMethod>().Fill(HotLogicInstance, UserUIData.HotLogicTypeFullName, "OnCover", 0);
            OnRevealMethod       = ReferencePool.Acquire <ILInstanceMethod>().Fill(HotLogicInstance, UserUIData.HotLogicTypeFullName, "OnReveal", 0);
            OnCloseMethod        = ReferencePool.Acquire <ILInstanceMethod>().Fill(HotLogicInstance, UserUIData.HotLogicTypeFullName, "OnClose", 1);
            OnDepthChangedMethod = ReferencePool.Acquire <ILInstanceMethod>().Fill(HotLogicInstance, UserUIData.HotLogicTypeFullName, "OnDepthChanged", 2);
#else
            //获取方法
            OnInitMethod         = ReferencePool.Acquire <ReflectInstanceMethod>().Fill(HotLogicInstance, UserUIData.HotLogicTypeFullName, "OnInit");
            OnOpenMethod         = ReferencePool.Acquire <ReflectInstanceMethod>().Fill(HotLogicInstance, UserUIData.HotLogicTypeFullName, "OnOpen");
            OnUpdateMethod       = ReferencePool.Acquire <ReflectInstanceMethod>().Fill(HotLogicInstance, UserUIData.HotLogicTypeFullName, "OnUpdate");
            OnRefocusMethod      = ReferencePool.Acquire <ReflectInstanceMethod>().Fill(HotLogicInstance, UserUIData.HotLogicTypeFullName, "OnRefocus");
            OnResumeMethod       = ReferencePool.Acquire <ReflectInstanceMethod>().Fill(HotLogicInstance, UserUIData.HotLogicTypeFullName, "OnResume");
            OnPauseMethod        = ReferencePool.Acquire <ReflectInstanceMethod>().Fill(HotLogicInstance, UserUIData.HotLogicTypeFullName, "OnPause");
            OnCoverMethod        = ReferencePool.Acquire <ReflectInstanceMethod>().Fill(HotLogicInstance, UserUIData.HotLogicTypeFullName, "OnCover");
            OnRevealMethod       = ReferencePool.Acquire <ReflectInstanceMethod>().Fill(HotLogicInstance, UserUIData.HotLogicTypeFullName, "OnReveal");
            OnCloseMethod        = ReferencePool.Acquire <ReflectInstanceMethod>().Fill(HotLogicInstance, UserUIData.HotLogicTypeFullName, "OnClose");
            OnDepthChangedMethod = ReferencePool.Acquire <ReflectInstanceMethod>().Fill(HotLogicInstance, UserUIData.HotLogicTypeFullName, "OnDepthChanged");
#endif

            if (OnInitMethod.IsAvalible)
            {
                OnInitMethod.Run(UserUIData);
            }
        }