Exemplo n.º 1
0
        void UF_UpdateOnRealTime()
        {
            if (m_IsOver || m_IsPause)
            {
                return;
            }

            int tick         = System.Environment.TickCount + m_TickOverflow;
            int durationTick = Mathf.Abs(tick - m_TickBuffer);
            int stamp        = durationTick / 1000;

            if (stamp >= 1)
            {
                m_TickOverflow  = durationTick - stamp * 1000;
                m_TickBuffer    = tick;
                clockTimestamp += stamp * m_ISide;
                if (clockTimestamp < 0)
                {
                    clockTimestamp = 0;
                }
                if (target != null)
                {
                    //m_DateTime.AddSeconds (stamp);
                    m_DateTime = GTime.UF_TimestampToDateTime(clockTimestamp, m_IsNormal);
                    UF_UpdateText();
                }
            }
            if (clockTimestamp == 0 && m_ISide < 0)
            {
                m_IsOver = true;
                GHelper.UF_SafeCallDelegate(m_EventClockOver);
            }
        }
Exemplo n.º 2
0
 void UF_UpdateRunTime(float dtime)
 {
     if (m_IsOver || m_IsPause)
     {
         return;
     }
     m_RunBuffer += GTime.DeltaTime;
     if (m_RunBuffer > 1)
     {
         m_RunBuffer     = m_RunBuffer - 1.0f;
         clockTimestamp += m_ISide;
         if (clockTimestamp < 0)
         {
             clockTimestamp = 0;
         }
         if (target != null)
         {
             m_DateTime = GTime.UF_TimestampToDateTime(clockTimestamp, m_IsNormal);
             UF_UpdateText();
         }
     }
     if (clockTimestamp == 0 && m_ISide < 0)
     {
         m_IsOver = true;
         GHelper.UF_SafeCallDelegate(m_EventClockOver);
     }
 }
Exemplo n.º 3
0
 public void UF_SetAsNormalClock(long timestamp, string _format)
 {
     UF_SetAsClock(timestamp, _format);
     m_IsNormal = true;
     m_DateTime = GTime.UF_TimestampToDateTime(clockTimestamp, m_IsNormal);
     UF_UpdateText();
 }
Exemplo n.º 4
0
 //设置一个计时器,时钟倒计时
 public void UF_SetAsTimer(long timestamp, string _format, DelegateVoid _callback)
 {
     m_IsOver         = false;
     m_IsPause        = false;
     m_ISide          = -1;
     clockTimestamp   = timestamp;
     m_IsNormal       = true;
     format           = _format;
     m_TickBuffer     = System.Environment.TickCount;
     m_RunBuffer      = 0;
     m_EventClockOver = _callback;
     m_DateTime       = GTime.UF_TimestampToDateTime(clockTimestamp, m_IsNormal);
     m_TickOverflow   = 0;
     UF_UpdateText();
 }