示例#1
0
 private void RegisterActiveTimeItem(TimeItem timeItem)
 {
     timeItem.id = ++s_NextID;
     s_TimeItemMap.Add(timeItem.id, timeItem);
 }
示例#2
0
 private static void RegisterActiveTimeItem(TimeItem unit)
 {
     unit.id = ++s_NextID;
     s_TimeItemMap.Add(unit.id, unit);
 }
示例#3
0
文件: Timer.cs 项目: tkonexhh/GFrame
 private void Post2Really(TimeItem item)
 {
     item.SortScore = m_CurrentUnScaleTime + item.DelayTime();
     m_UnScaleTimeItems.Add(item);
 }
示例#4
0
文件: Timer.cs 项目: tkonexhh/GFrame
 private void Post2Scale(TimeItem item)
 {
     item.SortScore = m_CurrentScaleTime + item.DelayTime();
     m_ScaleTimeItems.Add(item);
 }
示例#5
0
 private void Post2Scale(TimeItem item)
 {
     item.sortScore = m_CurrentScaleTime + item.DelayTime();
     m_ScaleTimeHeap.Insert(item);
 }
示例#6
0
        public void Update()
        {
            TimeItem item = null;

            m_CurrentUnScaleTime = Time.unscaledTime;
            m_CurrentScaleTime   = Time.time;

            #region  受缩放影响定时器更新
            while ((item = m_UnScaleTimeHeap.Top()) != null)
            {
                if (!item.isEnable)
                {
                    m_UnScaleTimeHeap.Pop();
                    item.Recycle2Cache();
                    continue;
                }

                if (item.sortScore < m_CurrentUnScaleTime)
                {
                    m_UnScaleTimeHeap.Pop();

                    item.OnTimeTick();

                    if (item.isEnable && item.NeedRepeat())
                    {
                        Post2Really(item);
                    }
                    else
                    {
                        item.Recycle2Cache();
                    }
                }
                else
                {
                    break;
                }
            }
            #endregion

            #region 受缩放影响定时器更新
            while ((item = m_ScaleTimeHeap.Top()) != null)
            {
                if (!item.isEnable)
                {
                    m_ScaleTimeHeap.Pop();
                    item.Recycle2Cache();
                    continue;
                }

                if (item.sortScore < m_CurrentScaleTime)
                {
                    m_ScaleTimeHeap.Pop();

                    item.OnTimeTick();

                    if (item.isEnable && item.NeedRepeat())
                    {
                        Post2Scale(item);
                    }
                    else
                    {
                        item.Recycle2Cache();
                    }
                }
                else
                {
                    break;
                }
            }
            #endregion
        }