Esempio n. 1
0
        void OnGUI()
        {
            // create style for centered label
            if (null == m_centeredLabelStyle)
            {
                m_centeredLabelStyle           = new GUIStyle(GUI.skin.label);
                m_centeredLabelStyle.alignment = TextAnchor.MiddleCenter;
            }


            if (m_currentStepIndex < 0)
            {
                return;
            }


            var currentStep = m_steps [m_currentStepIndex];


            // display title
            GUILayout.Space(5);
            GUILayout.Label(currentStep.title, m_centeredLabelStyle);


            GUILayout.Space(40);

            currentStep.scrollViewPos = EditorGUILayout.BeginScrollView(currentStep.scrollViewPos,
                                                                        GUILayout.MaxWidth(this.position.width - 15));

            currentStep.onGUI();

            EditorGUILayout.EndScrollView();


            // draw footer => previous, next buttons

            GUILayout.Space(60);

            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();

            if (currentStep.previousIndex >= 0)
            {
                if (Utilities2.DisabledButton(currentStep.allowsPrevious, "Back"))
                {
                    m_currentStepIndex = currentStep.previousIndex;
                }
            }

            if (currentStep.canSkip)
            {
                if (GUILayout.Button("Skip"))
                {
                    m_currentStepIndex = currentStep.nextIndex;
                }
            }

            if (currentStep.nextIndex < 0)
            {
                // last step
                if (Utilities2.DisabledButton(currentStep.allowsNext, "Finish"))
                {
                    this.Close();
                }
            }
            else
            {
                if (Utilities2.DisabledButton(currentStep.allowsNext, "Next"))
                {
                    m_currentStepIndex = currentStep.nextIndex;
                }
            }

            EditorGUILayout.EndHorizontal();
        }