コード例 #1
0
    private bool Internal_AddTimer(string key, TIMER_MODE mode, float duration, TimerManagerHandlerArgs handler, params object[] args)
    {
        if (string.IsNullOrEmpty(key))
        {
            return(false);
        }

        if (duration < 0.0f)
        {
            return(false);
        }

        Timer timer = new Timer(key, mode, Time.time, duration, handler, this, args);

        if (m_AddTimerList.ContainsKey(key))
        {
            m_AddTimerList[key] = timer;
        }
        else
        {
            m_AddTimerList.Add(key, timer);
        }

        return(true);
    }
コード例 #2
0
    /// -----------------------------------------------------------------------------
    /// <summary>
    /// 增加定时器
    /// </summary>
    /// <param name=string.Empty></param>
    /// <returns></returns>
    /// -----------------------------------------------------------------------------
    private static bool Internal_AddTimer(string key, TIMER_MODE mode, float duration, TimerManagerHandler handler)
    {
        if (string.IsNullOrEmpty(key))
        {
            return(false);
        }

        if (duration < 0.0f)
        {
            return(false);
        }

        Timer timer = new Timer(key, mode, Time.realtimeSinceStartup, duration, handler);

        if (m_AddTimerList.ContainsKey(key))
        {
            m_AddTimerList[key] = timer;
        }
        else
        {
            m_AddTimerList.Add(key, timer);
        }

        return(true);
    }
コード例 #3
0
    private bool Internal_AddTimer(string key, TIMER_MODE mode, float duration, TimerManagerHandlerArgs handler, int times = 0, params object[] args)
    {
        if (string.IsNullOrEmpty(key))
        {
            return(false);
        }

        if (duration < 0.0f)
        {
            return(false);
        }

        var olderTimer = m_AddTimerList.Find(p => p.m_Name == key);

        if (olderTimer != null)
        {
            olderTimer.Copy(key, mode, Time.time, duration, handler, times, this, args);
        }
        else
        {
            Timer timer = new Timer(key, mode, Time.time, duration, handler, times, this, args);
            m_AddTimerList.Add(timer);
        }


        return(true);
    }
コード例 #4
0
 /// -----------------------------------------------------------------------------
 /// <summary>
 ///
 /// </summary>
 /// <param name=""></param>
 /// <returns></returns>
 /// -----------------------------------------------------------------------------
 public Timer(string name, TIMER_MODE mode, float startTime, float duration, TimerManagerHandler handler, TimerManager manager)
 {
     m_Name       = name;
     m_Mode       = mode;
     m_StartTime  = startTime;
     m_duration   = duration;
     m_TimerEvent = handler;
     m_Manger     = manager;
 }
コード例 #5
0
 public Timer(string name, TIMER_MODE mode, float startTime, float duration, TimerManagerHandlerArgs handler, TimerManager manager, params object[] args)
 {
     m_Name           = name;
     m_Mode           = mode;
     m_StartTime      = startTime;
     m_duration       = duration;
     m_TimerArgsEvent = handler;
     m_Manger         = manager;
     m_Args           = args;
 }
コード例 #6
0
 public void Copy(string name, TIMER_MODE mode, float startTime, float duration, TimerManagerHandlerArgs handler, int times, TimerMgr manager, params object[] args)
 {
     m_Name           = name;
     m_Mode           = mode;
     m_StartTime      = startTime;
     this.Duration    = duration;
     m_TimerArgsEvent = handler;
     m_Manger         = manager;
     m_Args           = args;
     m_Times          = times;
 }