Esempio n. 1
0
 private void Update()
 {
     for (int i = 0; i < mCallbackList.Count; i++)
     {
         if (mCallbackList[i].call == null)
         {
             mCallbackList.RemoveAt(i);
             i--;
         }
         else if (Time.realtimeSinceStartup >= mCallbackList[i].endTime)
         {
             CallbackInfo info = mCallbackList[i];
             if (!mCallbackList[i].once)
             {
                 info.endTime    += info.dely;
                 mCallbackList[i] = info;
             }
             else
             {
                 mCallbackList.RemoveAt(i);
             }
             info.call();
             i--;
         }
     }
 }
Esempio n. 2
0
    private void Update()
    {
        for (int i = 0; i < mCallbackList.Count; i++)
        {
            float runTime = mCallbackList[i].ignoretimescale ? Time.realtimeSinceStartup : Time.time;
            if (mCallbackList[i].call == null)
            {
                mCallbackList.RemoveAt(i);
                i--;
            }
            else if (runTime >= mCallbackList[i].endTime)
            {
                CallbackInfo info = mCallbackList[i];
                if (mCallbackList[i].times > 1)
                {
                    info.endTime += info.dely;
                    info.times--;
                    mCallbackList[i] = info;
                }
                else
                {
                    mCallbackList.RemoveAt(i);
                    i--;
                }
                info.call();
            }
        }

        for (int i = 0; i < m_CallBackUpdateList.Count; ++i)
        {
            m_CallBackUpdateList[i]();
        }
    }
Esempio n. 3
0
        private void Update()
        {
            if (mCallbackList.Count <= 0)
            {
                return;
            }

            for (int i = 0; i < mCallbackList.Count; i++)
            {
                if (mCallbackList[i].call == null)
                {
                    mRemoveList.Add(mCallbackList[i]);
                    continue;
                }

                if (!mCallbackList[i].isUseRealTime)
                {
                    mCallbackList[i].endTime -= Time.deltaTime;
                }

                if ((!mCallbackList[i].isUseRealTime && mCallbackList[i].endTime <= 0) || (mCallbackList[i].isUseRealTime && Time.realtimeSinceStartup >= mCallbackList[i].endTime))
                {
                    CallbackInfo info = mCallbackList[i];
                    if (!mCallbackList[i].once)
                    {
                        info.endTime    += info.dely;
                        mCallbackList[i] = info;
                    }
                    else
                    {
                        mRemoveList.Add(mCallbackList[i]);
                    }

                    try
                    {
                        info.call();
                    }
                    catch (Exception e)
                    {
                        Debug.Log("SetTimerout Error: " + e.ToString());
                    }
                }
            }

            if (mRemoveList.Count > 0)
            {
                for (int j = 0; j < mRemoveList.Count; j++)
                {
                    mCallbackList.Remove(mRemoveList[j]);
                }

                mRemoveList.Clear();
            }
        }