protected virtual void OnGUI() { UIHelpers.SetupStyles(); currentEvent = Event.current; currentEventType = currentEvent.type; EditorGUI.BeginChangeCheck(); currentTabIndex = GUILayout.Toolbar(currentTabIndex, tabsNames, GUILayout.ExpandWidth(false)); currentTab = tabs[currentTabIndex]; if (EditorGUI.EndChangeCheck()) { currentTab.Show(this); if (TabChangedCallback != null) { TabChangedCallback.Invoke(currentTabIndex); } } currentTab.currentEvent = currentEvent; currentTab.currentEventType = currentEventType; currentTab.ProcessDrags(); currentTab.Draw(); }
protected void Init(string caption, TabBase[] windowTabs, int initialTab, TabChangeCallback tabChangeCallback) { #if UNITY_5_1_PLUS titleContent = new GUIContent(caption + " Ignores"); #else title = caption + " Ignores"; #endif minSize = new Vector2(600f, 300f); TabChangedCallback = tabChangeCallback; if (windowTabs != null && windowTabs.Length > 0) { tabs = windowTabs; currentTabIndex = windowTabs.Length > initialTab ? initialTab : 0; currentTab = windowTabs[currentTabIndex]; currentTab.Show(this); string[] names = new string[windowTabs.Length]; for (int i = 0; i < windowTabs.Length; i++) { names[i] = windowTabs[i].name; } tabsNames = names; } else { Debug.LogError(Maintainer.LOG_PREFIX + "no tabs were passed to the Ignores Window!"); } }