private void OnTutorialCompleted() { AnalyticsHelper.TutorialEnded(TutorialConclusion.Completed); GenesisHelper.LogTutorialEnded(m_CurrentTutorial.LessonId); // Open Hub and show tutorials HomeWindowProxy.ShowTutorials(); }
//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) { 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 if (GUILayout.Button(GUIContent.none, AllTutorialStyles.iconButtonHome)) { if (EditorUtility.DisplayDialog(s_HomePromptTitle.text, s_HomePromptText.text, s_HomePromptYes.text, s_HomePromptNo.text)) { HomeWindowProxy.ShowTutorials(); GUIUtility.ExitGUI(); } } } }
void ExitTutorial(bool completed) { switch (currentTutorial.exitBehavior) { case Tutorial.ExitBehavior.ShowHomeWindow: if (completed) { HomeWindowProxy.ShowTutorials(); } else if ( !IsInProgress() || EditorUtility.DisplayDialog(k_HomePromptTitle.text, k_HomePromptText.text, k_PromptYes.text, k_PromptNo.text)) { HomeWindowProxy.ShowTutorials(); GUIUtility.ExitGUI(); } return; // Return to avoid selecting asset on exit case Tutorial.ExitBehavior.CloseWindow: // New behaviour: exiting resets and nullifies the current tutorial and shows the project's tutorials. if (completed) { SetTutorial(null, false); ResetTutorial(); TutorialManager.instance.RestoreOriginalState(); } else // TODO experimenting with UX that never shows the exit dialog, can be removed for good if deemed good. // if (!IsInProgress() // || EditorUtility.DisplayDialog(k_ExitPromptTitle.text, k_ExitPromptText.text, k_PromptYes.text, k_PromptNo.text)) { SetTutorial(null, false); ResetTutorial(); TutorialManager.instance.RestoreOriginalState(); } break; default: throw new ArgumentOutOfRangeException(); } // TODO new behaviour testing: assetSelectedOnExit was originally used for selecting // Readme but this is not required anymore as the TutorialWindow contains Readme's functionality. //if (currentTutorial?.assetSelectedOnExit != null) // Selection.activeObject = currentTutorial.assetSelectedOnExit; //SaveTutorialStates(); }
void ExitTutorial(bool completed) { switch (m_CurrentTutorial.exitBehavior) { case Tutorial.ExitBehavior.ShowHomeWindow: if (completed) { HomeWindowProxy.ShowTutorials(); } else if (EditorUtility.DisplayDialog(s_HomePromptTitle.text, s_HomePromptText.text, s_HomePromptYes.text, s_HomePromptNo.text)) { HomeWindowProxy.ShowTutorials(); GUIUtility.ExitGUI(); } // Return to avoid selecting asset on exit return; case Tutorial.ExitBehavior.CloseWindow: if (completed) { Close(); } else if (EditorUtility.DisplayDialog(s_ExitPromptTitle.text, s_ExitPromptText.text, s_ExitPromptYes.text, s_ExitPromptNo.text)) { Close(); } break; default: throw new ArgumentOutOfRangeException(); } if (m_CurrentTutorial.assetSelectedOnExit != null) { Selection.activeObject = m_CurrentTutorial.assetSelectedOnExit; } }