예제 #1
0
 internal static void StopTimer(TimerEvent timer)
 {
     mWorldTimerMachine.PushTurnEvent(TimerEvent.TimerTurnType.TT_Delete, timer);
 }
예제 #2
0
            public void PushTurnEvent(TimerEvent.TimerTurnType type, TimerEvent timer)
            {
                var turnType = timer.mTurnType;

                //内置调用
                switch (type)
                {
                case TimerEvent.TimerTurnType.TT_DynamicTurn:
                    if (turnType == TimerEvent.TimerTurnType.TT_None)
                    {
                        if (timer.IsStatic)
                        {
                            mTurnEvents.Add(timer);
                        }
                        else
                        {
                            mTurnEvents.Insert(0, timer);
                        }
                        timer.mTurnType = type;
                    }
                    else
                    {
                        Debug.LogError(string.Format("定时器失败无法:{0}->{1}", turnType, TimerEvent.TimerTurnType.TT_DynamicTurn.ToString()));
                    }
                    break;

                case TimerEvent.TimerTurnType.TT_Pause:
                    if (turnType == TimerEvent.TimerTurnType.TT_None || turnType == TimerEvent.TimerTurnType.TT_UnPause)
                    {
                        _PushTurn(type, timer);
                    }
                    break;

                case TimerEvent.TimerTurnType.TT_UnPause:
                    if (turnType == TimerEvent.TimerTurnType.TT_Pause)
                    {
                        _PushTurn(type, timer);
                    }
                    break;

                case TimerEvent.TimerTurnType.TT_Reset:
                    if (turnType == TimerEvent.TimerTurnType.TT_DynamicTurn)
                    {
                        if (mTurnEvents.Contains(timer))
                        {
                            mTurnEvents.Remove(timer);
                        }
                    }
                    _PushTurn(type, timer);
                    break;

                case TimerEvent.TimerTurnType.TT_Delete:
                    if (turnType == TimerEvent.TimerTurnType.TT_DynamicTurn)
                    {
                        if (mTurnEvents.Contains(timer))
                        {
                            mTurnEvents.Remove(timer);
                        }
                    }
                    _PushTurn(type, timer);
                    break;

                default:
                    break;
                }
            }