Example #1
0
        void OnDisable()
        {
            OnBaseDisable();

            m_PagesAnimBool.valueChanged.RemoveListener(Repaint);
            Selection.selectionChanged -= () => m_TabView.TrackPages();
        }
Example #2
0
        void OnEnable()
        {
            OnBaseEnable();

            m_TabView = (TabView)target;

            m_AutoTrackPages             = serializedObject.FindProperty("m_AutoTrackPages");
            m_Pages                      = serializedObject.FindProperty("m_Pages");
            m_OnlyShowSelectedPage       = serializedObject.FindProperty("m_OnlyShowSelectedPage");
            m_TabItemTemplate            = serializedObject.FindProperty("m_TabItemTemplate");
            m_TabsContainer              = serializedObject.FindProperty("m_TabsContainer");
            m_PagesContainer             = serializedObject.FindProperty("m_PagesContainer");
            m_PagesRect                  = serializedObject.FindProperty("m_PagesRect");
            m_Indicator                  = serializedObject.FindProperty("m_Indicator");
            m_ShrinkTabsToFitThreshold   = serializedObject.FindProperty("m_ShrinkTabsToFitThreshold");
            m_ForceStretchTabsOnLanscape = serializedObject.FindProperty("m_ForceStretchTabsOnLanscape");
            m_LowerUnselectedTabAlpha    = serializedObject.FindProperty("m_LowerUnselectedTabAlpha");
            m_CanScrollBetweenTabs       = serializedObject.FindProperty("m_CanScrollBetweenTabs");
            m_OnPageChanged              = serializedObject.FindProperty("m_OnPageChanged"); // Added by Pavan Jakhu

            m_PagesAnimBool = new AnimBool {
                value = !m_AutoTrackPages.boolValue
            };
            m_PagesAnimBool.valueChanged.AddListener(Repaint);

            Selection.selectionChanged += () => m_TabView.TrackPages();
        }
Example #3
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUILayout.PropertyField(m_AutoTrackPages);

            m_PagesAnimBool.target = !m_AutoTrackPages.boolValue;
            if (EditorGUILayout.BeginFadeGroup(m_PagesAnimBool.faded))
            {
                EditorGUILayout.PropertyField(m_Pages, true);
            }
            EditorGUILayout.EndFadeGroup();

            EditorGUILayout.PropertyField(m_OnlyShowSelectedPage);

            List <TabPage> pages = m_TabView.pages;

            if (pages != null && pages.Count > 0)
            {
                string[] names = new string[pages.Count];

                for (int i = 0; i < pages.Count; i++)
                {
                    var v_tabName = (i + 1) + " - " + (pages[i] != null ? pages[i].name : "");
                    names[i] = v_tabName;
                }

                var oldPage = m_TabView.currentPage;
                m_TabView.currentPage = EditorGUILayout.Popup("Current page", m_TabView.currentPage, names);

                if (m_TabView.currentPage != oldPage)
                {
                    serializedObject.ApplyModifiedProperties();
                    serializedObject.Update();
                    EditorUtility.SetDirty(m_TabView);
                }

                m_TabView.SetPagesDirty();

                EditorGUILayout.Space();
            }

            m_TabView.TrackPages();

            EditorGUILayout.PropertyField(m_UseLegacyControlMode);
            if (m_UseLegacyControlMode.boolValue)
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(m_ForceSameTabSize);
                EditorGUI.indentLevel--;
                EditorGUILayout.Space();
            }
            EditorGUILayout.PropertyField(m_AnimateTabs);
            //EditorGUILayout.PropertyField(m_ShrinkTabsToFitThreshold);
            //EditorGUILayout.PropertyField(m_ForceStretchTabsOnLanscape);
            //EditorGUILayout.PropertyField(m_LowerUnselectedTabAlpha);

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(m_CanScrollBetweenTabs);
            if (EditorGUI.EndChangeCheck())
            {
                ((TabView)serializedObject.targetObject).canScrollBetweenTabs = m_CanScrollBetweenTabs.boolValue;
            }

            DrawFoldoutComponents(ComponentsSection);

            serializedObject.ApplyModifiedProperties();
        }