Beispiel #1
0
 private void OnTriggerExit(Collider other)
 {
     if (OnTriggerExitMethod.IsAvalible)
     {
         OnTriggerExitMethod.Run(other.GetComponent <HotEntity>());
     }
 }
Beispiel #2
0
 /// <summary>
 /// 实体轮询
 /// </summary>
 /// <param name="elapseSeconds">逻辑流逝时间,以秒为单位</param>
 /// <param name="realElapseSeconds">真实流逝时间,以秒为单位</param>
 protected override void OnUpdate(float elapseSeconds, float realElapseSeconds)
 {
     base.OnUpdate(elapseSeconds, realElapseSeconds);
     if (OnUpdateMethod.IsAvalible)
     {
         OnUpdateMethod.Run();
     }
 }
Beispiel #3
0
 /// <summary>
 /// 设置实体的可见性
 /// </summary>
 /// <param name="visible">实体的可见性</param>
 protected override void InternalSetVisible(bool visible)
 {
     base.InternalSetVisible(visible);
     if (InternalSetVisibleMethod.IsAvalible)
     {
         InternalSetVisibleMethod.Run(visible);
     }
 }
Beispiel #4
0
 /// <summary>
 /// 实体解除子实体
 /// </summary>
 /// <param name="childEntity">被解除的父实体</param>
 /// <param name="userData">用户自定义数据</param>
 protected override void OnDetachFrom(EntityLogic parentEntity, object userData)
 {
     base.OnDetachFrom(parentEntity, userData);
     if (OnDetachFromMethod.IsAvalible)
     {
         OnDetachFromMethod.Run((parentEntity as HotEntity).HotLogicInstance, userData);
     }
 }
Beispiel #5
0
 /// <summary>
 /// 实体附加子实体
 /// </summary>
 /// <param name="parentEntity">被附加的父实体</param>
 /// <param name="parentTransform">被附加父实体的位置</param>
 /// <param name="userData">用户自定义数据</param>
 protected override void OnAttachTo(EntityLogic parentEntity, Transform parentTransform, object userData)
 {
     base.OnAttachTo(parentEntity, parentTransform, userData);
     if (OnAttachToMethod.IsAvalible)
     {
         OnAttachToMethod.Run((parentEntity as HotEntity).HotLogicInstance, parentTransform, userData);
     }
 }
Beispiel #6
0
 /// <summary>
 /// 实体解除子实体
 /// </summary>
 /// <param name="childEntity">解除的子实体</param>
 /// <param name="userData">用户自定义数据</param>
 protected override void OnDetached(EntityLogic childEntity, object userData)
 {
     base.OnDetached(childEntity, userData);
     if (OnDetachedMethod.IsAvalible)
     {
         OnDetachedMethod.Run((childEntity as HotEntity).HotLogicInstance, userData);
     }
 }
        //界面重新激活
        protected override void OnRefocus(object userData)
        {
            base.OnRefocus(userData);

            if (OnRefocusMethod.IsAvalible)
            {
                OnRefocusMethod.Run(userData);
            }
        }
        //界面被遮挡覆盖
        protected override void OnCover()
        {
            base.OnCover();

            if (OnCoverMethod.IsAvalible)
            {
                OnCoverMethod.Run();
            }
        }
        //界面遮挡恢复
        protected override void OnReveal()
        {
            base.OnReveal();

            if (OnRevealMethod.IsAvalible)
            {
                OnRevealMethod.Run();
            }
        }
        //界面深度改变
        protected override void OnDepthChanged(int uiGroupDepth, int depthInUIGroup)
        {
            base.OnDepthChanged(uiGroupDepth, depthInUIGroup);

            if (OnDepthChangedMethod.IsAvalible)
            {
                OnDepthChangedMethod.Run(uiGroupDepth, depthInUIGroup);
            }
        }
        //界面暂停
        protected override void OnPause()
        {
            base.OnPause();

            if (OnPauseMethod.IsAvalible)
            {
                OnPauseMethod.Run();
            }
        }
Beispiel #12
0
        /// <summary>
        /// 流程轮询更新
        /// </summary>
        /// <param name="procedureOwner">流程持有者</param>
        /// <param name="elapseSeconds">逻辑帧时间</param>
        /// <param name="realElapseSeconds">真实流逝时间</param>
        protected override void OnUpdate(IFsm <IProcedureManager> procedureOwner, float elapseSeconds, float realElapseSeconds)
        {
            base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds);

            if (OnUpdateMethod.IsAvalible)
            {
                OnUpdateMethod.Run(procedureOwner);
            }
        }
Beispiel #13
0
        /// <summary>
        /// 隐藏时回调
        /// </summary>
        /// <param name="userData">用户自定义数据</param>
        protected override void OnHide(object userData)
        {
            base.OnHide(userData);

            if (OnHideMethod.IsAvalible)
            {
                OnHideMethod.Run(userData);
            }

            if (UserEntityData != null)
            {
                //ReferencePool.Release(UserEntityData);  //回收
                UserEntityData = null;
            }
        }
        //界面关闭的回调
        protected override void OnClose(object userData)
        {
            base.OnClose(userData);
            //Log.Info(Utility.Text.Format("UI界面OnClose ->{0}", UserUIData.HotLogicTypeFullName));

            if (OnCloseMethod.IsAvalible)
            {
                OnCloseMethod.Run(userData);
            }

            if (UserUIData != null)
            {
                //ReferencePool.Release(UserUIData);  //回收
                UserUIData = null;
            }
        }
Beispiel #15
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);
            }
        }
        //界面打开
        protected override void OnOpen(object userData)
        {
            base.OnOpen(userData);

            UserUIData data = userData as UserUIData;   //临时缓存,避免下面ReleaseLogicData时Release

            if (UserUIData != data)
            {
                data.RuntimeUIForm = this;
                if (data.HotLogicTypeFullName != HotLogicScript) //检查逻辑类名是否一样
                {
                    ReleaseLogicData();                          //释放保存的Hot逻辑
                    InitLogicData(data);                         //重新初始化Hot逻辑,并调用Init方法
                }

                UserUIData = data;
            }

            if (OnOpenMethod.IsAvalible)
            {
                OnOpenMethod.Run(UserUIData.UserData);
            }
        }
        //初始化逻辑数据
        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);
            }
        }
Beispiel #18
0
        /// <summary>
        /// 实体显示
        /// </summary>
        /// <param name="userData">用户自定义数据</param>
        protected override void OnShow(object userData)
        {
            base.OnShow(userData);

            UserEntityData data = userData as UserEntityData;   //临时缓存,避免下面ReleaseLogicData时Release

            //Log.Info($"显示实体OnShow -> {data.HotLogicTypeFullName} ={HotLogicScript}");
            if (UserEntityData != data)
            {
                data.RuntimeEntity = this;
                if (data.HotLogicTypeFullName != HotLogicScript) //检查逻辑类名是否一样
                {
                    ReleaseLogicData();                          //释放保存的Hot逻辑
                    InitLogicData(data);                         //重新初始化Hot逻辑,并调用Init方法
                }

                UserEntityData = data;
            }

            if (OnShowMethod.IsAvalible)
            {
                OnShowMethod.Run(UserEntityData.UserData);
            }
        }