Exemplo n.º 1
0
 void OnPreviousButtonClicked()
 {
     if (IsFirstPage())
     {
         SkipTutorial();
     }
     else
     {
         currentTutorial.GoToPreviousPage();
         UpdateNextButton();
     }
 }
Exemplo n.º 2
0
        //Might be desirable if a completed page is something we want

        /*private void DrawCompletedPage()
         * {
         *  if (m_CurrentTutorial.completedPage != null)
         *  {
         *      TutorialModalWindow.TryToShow(m_CurrentTutorial.completedPage, true, () =>
         *          {
         *              m_CurrentTutorial.IsCompletedPageShowing = false;
         *              if (Event.current.shift)
         *              {
         *                  OpenLoadTutorialDialog();
         *              }
         *              else
         *              {
         *                  HomeWindow.Show(HomeWindow.HomeMode.Tutorial);
         *              }
         *          }
         *          );
         *  }
         *  else if (m_CurrentTutorial.welcomePage != null)
         *  {
         *      TutorialModalWindow.TryToShow(m_CurrentTutorial.welcomePage, true, () =>
         *          {
         *              Debug.Log("Open next tutorial");
         *              m_CurrentTutorial.IsCompletedPageShowing = false;
         *          }
         *          );
         *  }
         *  else
         *  {
         *      m_CurrentTutorial.IsCompletedPageShowing = false;
         *  }
         * }*/

        private void TopBar()
        {
            using (var backgroundRect = new EditorGUILayout.HorizontalScope(AllTutorialStyles.topBarBackground ?? GUIStyle.none, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true)))
            {
                if (m_CurrentTutorial.currentPageIndex > 0)
                {
                    using (new EditorGUI.DisabledScope(m_CurrentTutorial.skipped))
                    {
                        if (GUILayout.Button(GUIContent.none, AllTutorialStyles.iconButtonBack))
                        {
                            m_CurrentTutorial.GoToPreviousPage();

                            // Masking could potentially change when pressing this button which causes an immediate repaint
                            // Exit GUI here to avoid re-entrant GUI errors
                            GUIUtility.ExitGUI();
                        }
                    }
                }
                else
                {
                    if (m_BackButton == null)
                    {
                        m_BackButton = AllTutorialStyles.iconButtonBack;
                    }
                    GUILayout.Space(m_BackButton.fixedWidth + m_BackButton.margin.right + m_BackButton.margin.left);
                }

                GUILayout.FlexibleSpace();
                GUILayout.Label(m_Title, AllTutorialStyles.headerLabel ?? GUIStyle.none);
                GUILayout.FlexibleSpace();

                //Restart
                if (GUILayout.Button(GUIContent.none, AllTutorialStyles.iconButtonReset))
                {
                    if (EditorUtility.DisplayDialog(s_RestartPromptTitle.text, s_RestartPromptText.text, s_RestartPromptYes.text, s_RestartPromptNo.text))
                    {
                        ResetTutorial();
                        GUIUtility.ExitGUI();
                    }
                }
                //Exit tutorial
                var icon = m_CurrentTutorial.exitBehavior == Tutorial.ExitBehavior.ShowHomeWindow ? AllTutorialStyles.iconButtonHome : AllTutorialStyles.iconButtonClose;
                using (new EditorGUI.DisabledScope(m_CurrentTutorial.skipped))
                {
                    if (GUILayout.Button(GUIContent.none, icon))
                    {
                        SkipTutorial();
                        GUIUtility.ExitGUI();
                    }
                }
            }
        }