private void FillTreeItems(AudioProfilerView.AudioProfilerTreeViewItem parentNode, int depth, int parentId, List<AudioProfilerInfoWrapper> items)
			{
				int num = 0;
				foreach (AudioProfilerInfoWrapper current in items)
				{
					if (parentId == ((!current.addToRoot) ? current.info.parentId : 0))
					{
						num++;
					}
				}
				if (num > 0)
				{
					parentNode.children = new List<TreeViewItem>(num);
					foreach (AudioProfilerInfoWrapper current2 in items)
					{
						if (parentId == ((!current2.addToRoot) ? current2.info.parentId : 0))
						{
							AudioProfilerView.AudioProfilerTreeViewItem audioProfilerTreeViewItem = new AudioProfilerView.AudioProfilerTreeViewItem(current2.info.uniqueId, (!current2.addToRoot) ? depth : 1, parentNode, current2.objectName, current2);
							parentNode.children.Add(audioProfilerTreeViewItem);
							this.FillTreeItems(audioProfilerTreeViewItem, depth + 1, current2.info.uniqueId, items);
						}
					}
				}
			}
Exemplo n.º 2
0
 private void DrawAudioPane()
 {
     EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
     ProfilerAudioView showDetailedAudioPane = this.m_ShowDetailedAudioPane;
     if (GUILayout.Toggle(showDetailedAudioPane == ProfilerAudioView.Stats, "Stats", EditorStyles.toolbarButton, new GUILayoutOption[0]))
     {
         showDetailedAudioPane = ProfilerAudioView.Stats;
     }
     if (GUILayout.Toggle(showDetailedAudioPane == ProfilerAudioView.Channels, "Channels", EditorStyles.toolbarButton, new GUILayoutOption[0]))
     {
         showDetailedAudioPane = ProfilerAudioView.Channels;
     }
     if (GUILayout.Toggle(showDetailedAudioPane == ProfilerAudioView.Groups, "Groups", EditorStyles.toolbarButton, new GUILayoutOption[0]))
     {
         showDetailedAudioPane = ProfilerAudioView.Groups;
     }
     if (GUILayout.Toggle(showDetailedAudioPane == ProfilerAudioView.ChannelsAndGroups, "Channels and groups", EditorStyles.toolbarButton, new GUILayoutOption[0]))
     {
         showDetailedAudioPane = ProfilerAudioView.ChannelsAndGroups;
     }
     if (showDetailedAudioPane != this.m_ShowDetailedAudioPane)
     {
         this.m_ShowDetailedAudioPane = showDetailedAudioPane;
         this.m_LastAudioProfilerFrame = -1;
     }
     if (this.m_ShowDetailedAudioPane == ProfilerAudioView.Stats)
     {
         GUILayout.FlexibleSpace();
         EditorGUILayout.EndHorizontal();
         this.DrawOverviewText(this.m_CurrentArea);
     }
     else
     {
         GUILayout.Space(5f);
         bool flag = GUILayout.Toggle(AudioUtil.resetAllAudioClipPlayCountsOnPlay, "Reset play count on play", EditorStyles.toolbarButton, new GUILayoutOption[0]);
         if (flag != AudioUtil.resetAllAudioClipPlayCountsOnPlay)
         {
             AudioUtil.resetAllAudioClipPlayCountsOnPlay = flag;
         }
         if (Unsupported.IsDeveloperBuild())
         {
             GUILayout.Space(5f);
             bool @bool = EditorPrefs.GetBool("AudioProfilerShowAllGroups");
             bool flag3 = GUILayout.Toggle(@bool, "Show all groups (dev-builds only)", EditorStyles.toolbarButton, new GUILayoutOption[0]);
             if (@bool != flag3)
             {
                 EditorPrefs.SetBool("AudioProfilerShowAllGroups", flag3);
             }
         }
         GUILayout.FlexibleSpace();
         EditorGUILayout.EndHorizontal();
         Rect rect = GUILayoutUtility.GetRect(20f, 20000f, (float) 10f, (float) 10000f);
         Rect position = new Rect(rect.x, rect.y, 230f, rect.height);
         Rect rect3 = new Rect(position.xMax, rect.y, rect.width - position.width, rect.height);
         string overviewText = ProfilerDriver.GetOverviewText(this.m_CurrentArea, this.GetActiveVisibleFrameIndex());
         Vector2 vector = EditorStyles.wordWrappedLabel.CalcSize(GUIContent.Temp(overviewText));
         this.m_PaneScroll[(int) this.m_CurrentArea] = GUI.BeginScrollView(position, this.m_PaneScroll[(int) this.m_CurrentArea], new Rect(0f, 0f, vector.x, vector.y));
         GUI.Box(position, string.Empty, ms_Styles.background);
         GUI.Label(new Rect(3f, 3f, vector.x, vector.y), overviewText, EditorStyles.wordWrappedLabel);
         GUI.EndScrollView();
         EditorGUI.DrawRect(new Rect(position.xMax - 1f, position.y, 1f, position.height), Color.black);
         if (this.m_AudioProfilerTreeViewState == null)
         {
             this.m_AudioProfilerTreeViewState = new AudioProfilerTreeViewState();
         }
         if (this.m_AudioProfilerBackend == null)
         {
             this.m_AudioProfilerBackend = new AudioProfilerBackend(this.m_AudioProfilerTreeViewState);
         }
         ProfilerProperty property = this.CreateProperty(false);
         if (CheckFrameData(property))
         {
             if ((this.m_CurrentFrame == -1) || (this.m_LastAudioProfilerFrame != this.m_CurrentFrame))
             {
                 this.m_LastAudioProfilerFrame = this.m_CurrentFrame;
                 AudioProfilerInfo[] audioProfilerInfo = property.GetAudioProfilerInfo();
                 if ((audioProfilerInfo != null) && (audioProfilerInfo.Length > 0))
                 {
                     List<AudioProfilerInfoWrapper> data = new List<AudioProfilerInfoWrapper>();
                     foreach (AudioProfilerInfo info in audioProfilerInfo)
                     {
                         bool flag4 = (info.flags & 0x40) != 0;
                         if (((this.m_ShowDetailedAudioPane != ProfilerAudioView.Channels) || !flag4) && ((this.m_ShowDetailedAudioPane != ProfilerAudioView.Groups) || flag4))
                         {
                             data.Add(new AudioProfilerInfoWrapper(info, property.GetAudioProfilerNameByOffset(info.assetNameOffset), property.GetAudioProfilerNameByOffset(info.objectNameOffset), this.m_ShowDetailedAudioPane == ProfilerAudioView.Channels));
                         }
                     }
                     this.m_AudioProfilerBackend.SetData(data);
                     if (this.m_AudioProfilerView == null)
                     {
                         this.m_AudioProfilerView = new AudioProfilerView(this, this.m_AudioProfilerTreeViewState);
                         this.m_AudioProfilerView.Init(rect3, this.m_AudioProfilerBackend);
                     }
                 }
             }
             if (this.m_AudioProfilerView != null)
             {
                 this.m_AudioProfilerView.OnGUI(rect3, this.m_ShowDetailedAudioPane == ProfilerAudioView.Channels);
             }
         }
         property.Cleanup();
     }
 }
 private void FillTreeItems(AudioProfilerView.AudioProfilerTreeViewItem parentNode, int depth, int parentId, List<AudioProfilerInfoWrapper> items)
 {
   int capacity = 0;
   using (List<AudioProfilerInfoWrapper>.Enumerator enumerator = items.GetEnumerator())
   {
     while (enumerator.MoveNext())
     {
       AudioProfilerInfoWrapper current = enumerator.Current;
       if (parentId == (!current.addToRoot ? current.info.parentId : 0))
         ++capacity;
     }
   }
   if (capacity <= 0)
     return;
   parentNode.children = new List<TreeViewItem>(capacity);
   using (List<AudioProfilerInfoWrapper>.Enumerator enumerator = items.GetEnumerator())
   {
     while (enumerator.MoveNext())
     {
       AudioProfilerInfoWrapper current = enumerator.Current;
       if (parentId == (!current.addToRoot ? current.info.parentId : 0))
       {
         AudioProfilerView.AudioProfilerTreeViewItem parentNode1 = new AudioProfilerView.AudioProfilerTreeViewItem(current.info.uniqueId, !current.addToRoot ? depth : 1, (TreeViewItem) parentNode, current.objectName, current);
         parentNode.children.Add((TreeViewItem) parentNode1);
         this.FillTreeItems(parentNode1, depth + 1, current.info.uniqueId, items);
       }
     }
   }
 }
Exemplo n.º 4
0
 private void FillTreeItems(AudioProfilerView.AudioProfilerTreeViewItem parentNode, int depth, int parentId, List<AudioProfilerInfoWrapper> items)
 {
     int capacity = 0;
     foreach (AudioProfilerInfoWrapper wrapper in items)
     {
         if (parentId == (!wrapper.addToRoot ? wrapper.info.parentId : 0))
         {
             capacity++;
         }
     }
     if (capacity > 0)
     {
         parentNode.children = new List<TreeViewItem>(capacity);
         foreach (AudioProfilerInfoWrapper wrapper2 in items)
         {
             if (parentId == (!wrapper2.addToRoot ? wrapper2.info.parentId : 0))
             {
                 AudioProfilerView.AudioProfilerTreeViewItem item = new AudioProfilerView.AudioProfilerTreeViewItem(wrapper2.info.uniqueId, !wrapper2.addToRoot ? depth : 1, parentNode, wrapper2.objectName, wrapper2);
                 parentNode.children.Add(item);
                 this.FillTreeItems(item, depth + 1, wrapper2.info.uniqueId, items);
             }
         }
     }
 }