예제 #1
0
        /// <summary>
        /// 注册倒计时
        /// </summary>
        /// <param name="fCountDownTime"></param>
        /// <param name="handleOnTimeUp"></param>
        /// <param name="objTimeUpParam"></param>
        /// <param name="tTimeType"></param>
        /// <param name="fStartDelay"></param>
        /// <returns></returns>
        public UInt32 RegisterCountDownTimer(float fCountDownTime, HandleObjectAction handleOnTimeUp, System.Object objTimeUpParam = null, TUnityTimeType tTimeType = TUnityTimeType.enGameTime, float fStartDelay = 0)
        {
            CTimer timer = m_TimerPool.RentObject() as CTimer;

            if (timer == null)
            {
                return(0);
            }
            UInt32 uId = m_uNextTimerID;

            m_uNextTimerID += 1;
            timer.Register(uId, fCountDownTime, handleOnTimeUp, objTimeUpParam, tTimeType, fStartDelay);
            m_TimerList.Add(timer);
            return(uId);
        }
예제 #2
0
        /// <summary>
        /// 触发事件
        /// </summary>
        /// <param name="uEventId"></param>
        /// <param name="objParam"></param>
        /// <returns></returns>
        public bool TriggerAction(UInt32 uEventId, System.Object objParam)
        {
            CEventInfo eventInfo = m_EventInfoPool.RentObject() as CEventInfo;

            if (eventInfo == null)
            {
                BTDebug.Warning(string.Format("Action {0} Trigger Failed, Event Info NULL", uEventId), "ACTION");
                return(false);
            }
            eventInfo.Set(uEventId, objParam);
            if (m_ListenedEvent.Push(eventInfo) == false)
            {
                BTDebug.Warning(string.Format("Action {0} Trigger Failed, Event Info Push Failed", uEventId), "ACTION");
                return(false);
            }
            return(true);
        }