private void PlayAudioClip() { if (m_Source == null || m_AudioClip == null) { Release(); return; } m_Source.clip = m_AudioClip; m_Source.loop = m_IsLoop; int loopCount = 1; if (m_IsLoop) { loopCount = -1; } m_TimeItem = Timer.S.Post2Scale(OnSoundPlayFinish, m_AudioClip.length, loopCount); m_Source.Play(); }
public void Dump(int min = 0) { if (!SHOW_LOG) { return; } StringBuilder builder = new StringBuilder(); builder.AppendLine("Begin Dump Time Debugger :" + m_Name); builder.AppendLine(); for (int i = 0; i < m_EndTimeLists.Count; ++i) { TimeItem item = m_EndTimeLists[i]; if (item.passTime > min) { builder.AppendLine(string.Format("# {2}: [PassTime:{0}, PassTicks:{1}]", item.passTime, item.passTicks, item.name)); } } builder.AppendLine(); builder.AppendLine("End Dump Time Debugger :" + m_Name); Log.w(builder.ToString()); }
private static void RegisterActiveTimeItem(TimeItem unit) { unit.id = ++s_NextID; s_TimeItemMap.Add(unit.id, unit); }
public void Post2Scale(TimeItem item) { item.sortScore = m_CurrentScaleTime + item.DelayTime(); m_ScaleTimeHeap.Insert(item); }
public void UpdateMgr() { 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 }
public void Post2Really(TimeItem item) { item.sortScore = m_CurrentUnScaleTime + item.DelayTime(); m_UnScaleTimeHeap.Insert(item); }