private void DoWindowPopup() { string t = "<Please Select>"; if ((UnityEngine.Object) this.m_Inspected != (UnityEngine.Object)null) { t = GUIViewDebuggerWindow.GetViewName(this.m_Inspected); } GUILayout.Label("Inspected Window: ", new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }); Rect rect = GUILayoutUtility.GetRect(GUIContent.Temp(t), EditorStyles.toolbarDropDown, new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if (!GUI.Button(rect, GUIContent.Temp(t), EditorStyles.toolbarDropDown)) { return; } List <GUIView> views = new List <GUIView>(); GUIViewDebuggerHelper.GetViews(views); List <GUIContent> guiContentList = new List <GUIContent>(views.Count + 1); guiContentList.Add(new GUIContent("None")); int selected = 0; List <GUIView> guiViewList = new List <GUIView>(views.Count + 1); for (int index = 0; index < views.Count; ++index) { GUIView view = views[index]; if (this.CanInspectView(view)) { GUIContent guiContent = new GUIContent(guiContentList.Count.ToString() + ". " + GUIViewDebuggerWindow.GetViewName(view)); guiContentList.Add(guiContent); guiViewList.Add(view); if ((UnityEngine.Object)view == (UnityEngine.Object) this.m_Inspected) { selected = guiViewList.Count; } } } EditorUtility.DisplayCustomMenu(rect, guiContentList.ToArray(), selected, new EditorUtility.SelectMenuItemFunction(this.OnWindowSelected), (object)guiViewList); }
private void DoWindowPopup() { string t = "<Please Select>"; if (this.m_Inspected != null) { t = GUIViewDebuggerWindow.GetViewName(this.m_Inspected); } GUILayout.Label("Inspected Window: ", new GUILayoutOption[] { GUILayout.ExpandWidth(false) }); Rect rect = GUILayoutUtility.GetRect(GUIContent.Temp(t), EditorStyles.toolbarDropDown, new GUILayoutOption[] { GUILayout.ExpandWidth(true) }); if (GUI.Button(rect, GUIContent.Temp(t), EditorStyles.toolbarDropDown)) { List <GUIView> list = new List <GUIView>(); GUIViewDebuggerHelper.GetViews(list); List <GUIContent> list2 = new List <GUIContent>(list.Count + 1); list2.Add(new GUIContent("None")); int selected = 0; List <GUIView> list3 = new List <GUIView>(list.Count + 1); for (int i = 0; i < list.Count; i++) { GUIView gUIView = list[i]; if (this.CanInspectView(gUIView)) { string text = list2.Count + ". " + GUIViewDebuggerWindow.GetViewName(gUIView); GUIContent item = new GUIContent(text); list2.Add(item); list3.Add(gUIView); if (gUIView == this.m_Inspected) { selected = list3.Count; } } } EditorUtility.DisplayCustomMenu(rect, list2.ToArray(), selected, new EditorUtility.SelectMenuItemFunction(this.OnWindowSelected), list3); } }
private void DoWindowPopup() { string t = (!(this.inspected == null)) ? GUIViewDebuggerWindow.GetViewName(this.inspected) : GUIViewDebuggerWindow.Styles.defaultWindowPopupText; GUILayout.Label(GUIViewDebuggerWindow.Styles.inspectedWindowLabel, new GUILayoutOption[] { GUILayout.ExpandWidth(false) }); Rect rect = GUILayoutUtility.GetRect(GUIContent.Temp(t), EditorStyles.toolbarDropDown, new GUILayoutOption[] { GUILayout.ExpandWidth(true) }); if (GUI.Button(rect, GUIContent.Temp(t), EditorStyles.toolbarDropDown)) { List <GUIView> list = new List <GUIView>(); GUIViewDebuggerHelper.GetViews(list); List <GUIContent> list2 = new List <GUIContent>(list.Count + 1); list2.Add(EditorGUIUtility.TrTextContent("None", null, null)); int selected = 0; List <GUIView> list3 = new List <GUIView>(list.Count + 1); for (int i = 0; i < list.Count; i++) { GUIView gUIView = list[i]; if (this.CanInspectView(gUIView)) { GUIContent item = new GUIContent(string.Format("{0}. {1}", list2.Count, GUIViewDebuggerWindow.GetViewName(gUIView))); list2.Add(item); list3.Add(gUIView); if (gUIView == this.inspected) { selected = list3.Count; } } } EditorUtility.DisplayCustomMenu(rect, list2.ToArray(), selected, new EditorUtility.SelectMenuItemFunction(this.OnWindowSelected), list3); } }