internal Enumerator(BetterQueue <T> queue) { m_Queue = queue; m_StartVersion = m_Queue.m_Version; m_Index = -1; m_CurrentElement = default; }
public void _GetForGUI(out BetterQueue <LogItem> logItems, out int logCount, out int warningLogCount, out int errorLogCount) { logItems = m_LogItems; logCount = m_LogCount; warningLogCount = m_WarningLogCount; errorLogCount = m_ErrorLogCount; }
private void FilterLog(BetterQueue <LogItem> logItems) { if (m_FilterModified) { CaculateLogTags(); if (m_Collapse) { m_LogItemHashs.Clear(); } m_FilteredLogIds.Clear(); } int startLogIndex = m_FilterModified ? 0 : Mathf.Max(0, LogItems.GetInstance().LogIdToIndex(m_LastFilterLogId + 1)); m_TopScrollPosition = EditorGUILayout.BeginScrollView(m_TopScrollPosition); for (int iLog = startLogIndex; iLog < logItems.Count; iLog++) { LogItem iterLog = logItems[iLog]; if (!HasFlag(iterLog._LogType)) { continue; } if (m_Collapse && !m_LogItemHashs.Add(iterLog._Hash)) { continue; } if (!string.IsNullOrEmpty(m_LogTagFilter) && (m_IsLogTagExcludeFilter ? m_LogTagFilters.Contains(iterLog.Tag) : !m_LogTagFilters.Contains(iterLog.Tag))) { continue; } if (!string.IsNullOrEmpty(m_LogTextFilter) && !iterLog.Text.Contains(m_LogTextFilter) && !iterLog.ST.Contains(m_LogTextFilter)) { continue; } m_FilteredLogIds.Add(iterLog._Id); } m_LastFilterLogId = logItems.Count > 0 ? logItems[logItems.Count - 1]._Id : -1; m_FilterModified = false; }
private LogItems() { m_LogItems = new BetterQueue <LogItem>(MAX_LOG_COUNT + 1); _Clear(); m_ShowTimestamp = new PrefsValue <bool>("LogItems_m_ShowTimestamp", false); m_ShowFrameCount = new PrefsValue <bool>("LogItems_m_ShowFrameCount", false); m_ShowLogId = new PrefsValue <bool>("LogItems_m_ShowLogId", false); }
/// <summary> /// 立即发送队列中的Event /// </summary> private void SendImmediatelyFromQueue(BetterQueue <EventItem> events) { while (events.Count > 0) { EventItem eventItem = events.Dequeue(); SafeInvoke(eventItem.EventID, false, eventItem.UserData); m_EventItemPool.Release(eventItem); } }
public EventCenter(List <Type> eventTypes , string name , int priority , string groupName) : base(name, priority, groupName) { List <Array> eventEnumValues = new List <Array>(); int maxEventID = int.MinValue; for (int iEventType = 0; iEventType < eventTypes.Count; iEventType++) { Array enumValues = eventTypes[iEventType].GetEnumValues(); maxEventID = Math.Max(maxEventID, (int)enumValues.GetValue(enumValues.Length - 1)); eventEnumValues.Add(enumValues); } m_Listeners = new EventFunction[maxEventID + 1]; m_EventIdToName = new string[maxEventID + 1]; for (int iEventType = 0; iEventType < eventEnumValues.Count; iEventType++) { Array enumValues = eventEnumValues[iEventType]; for (int iEnum = 0; iEnum < enumValues.Length; iEnum++) { object iterEnum = enumValues.GetValue(iEnum); m_EventIdToName[(int)iterEnum] = iterEnum.ToString(); } } System.Text.StringBuilder stringBuilder = StringUtility.AllocStringBuilder() .Append("Events id to name:\n"); for (int iEvent = 0; iEvent < m_EventIdToName.Length; iEvent++) { stringBuilder.Append(iEvent).Append(", ").Append(m_EventIdToName[iEvent]).Append('\n'); } MDebug.Log("EventCenter", StringUtility.ReleaseStringBuilder(stringBuilder)); m_EventItemPool = new ObjectPool <EventItem>(32); m_MajorEventCache = new BetterQueue <EventItem>(); m_MajorEvents = new BetterQueue <EventItem> [(int)UpdateMethod.Count]; for (int iMajor = 0; iMajor < m_MajorEvents.Length; iMajor++) { m_MajorEvents[iMajor] = new BetterQueue <EventItem>(); } }