コード例 #1
0
        void OnTutorialCompleted(bool exitTutorial)
        {
            if (!currentTutorial)
            {
                return;
            }

            AnalyticsHelper.TutorialEnded(TutorialConclusion.Completed);
            GenesisHelper.LogTutorialEnded(currentTutorial.lessonId);
            MarkTutorialCompleted(currentTutorial.lessonId, currentTutorial.completed);

            if (!exitTutorial)
            {
                return;
            }
            ExitTutorial(currentTutorial.completed);
        }
コード例 #2
0
ファイル: TutorialWindow.cs プロジェクト: Draz96/possessione
        void OnDisable()
        {
            if (!m_PlayModeChanging)
            {
                AnalyticsHelper.TutorialEnded(TutorialConclusion.Quit);
            }

            ClearTutorialListener();

            Tutorial.tutorialPagesChanged -= OnTutorialPagesChanged;
            TutorialPage.criteriaCompletionStateTested         -= OnTutorialPageCriteriaCompletionStateTested;
            TutorialPage.tutorialPageMaskingSettingsChanged    -= OnTutorialPageMaskingSettingsChanged;
            TutorialPage.tutorialPageNonMaskingSettingsChanged -= OnTutorialPageNonMaskingSettingsChanged;
            GUIViewProxy.positionChanged    -= OnGUIViewPositionChanged;
            HostViewProxy.actualViewChanged -= OnHostViewActualViewChanged;

            ApplyMaskingSettings(false);
        }
コード例 #3
0
            public void OpenUrl()
            {
                if (string.IsNullOrEmpty(url))
                {
                    return;
                }

                if (authorizedUrl && UnityConnectProxy.loggedIn)
                {
                    UnityConnectProxy.OpenAuthorizedURLInWebBrowser(url);
                }
                else
                {
                    Application.OpenURL(url);
                }

                AnalyticsHelper.SendExternalReferenceEvent(url, heading, linkText, tutorial?.lessonId);
            }
コード例 #4
0
        public void Draw(ref bool previousTaskState, bool pageCompleted)
        {
            switch (paragraph.type)
            {
            case ParagraphType.Icons:
                using (var horizontal = new GUILayout.HorizontalScope())
                {
                    GUILayout.FlexibleSpace();
                    foreach (var icon in paragraph.icons)
                    {
                        GUIStyle style = icon.GetStyle();
                        if (style != null && style != GUIStyle.none)
                        {
                            GUILayout.Box(icon.GetTexture(), style);
                        }
                        else
                        {
                            GUILayout.Box(icon.GetTexture(), GUI.skin.box);
                        }
                        GUILayout.FlexibleSpace();
                    }
                }
                break;

            case ParagraphType.Instruction:
                var completed = pageCompleted;
                if (!pageCompleted)
                {
                    completed = paragraph.completed;
                    if (!previousTaskState)
                    {
                        completed = false;
                    }
                }
                bool isActiveCriterion = !completed && previousTaskState;
                using (var verticalGroup = new EditorGUILayout.VerticalScope())
                {
                    GUIStyle bgStyle;

                    if (isActiveCriterion)
                    {
                        bgStyle = AllTutorialStyles.activeElementBackground;
                    }
                    else if (completed)
                    {
                        bgStyle = AllTutorialStyles.completedElementBackground;
                    }
                    else
                    {
                        bgStyle = AllTutorialStyles.inActiveElementBackground;
                    }

                    //The scope of the colored/faded checkbox and summary
                    using (var backgroundElement = new EditorGUILayout.HorizontalScope(bgStyle))
                    {
                        AllTutorialStyles.instructionLabel.normal.textColor = previousTaskState ? Color.black : Color.gray;
                        GUILayout.Label(GUIContent.none, completed ? AllTutorialStyles.instructionLabelIconCompleted : AllTutorialStyles.instructionLabelIconNotCompleted);
                        GUILayout.Label(paragraph.summary, AllTutorialStyles.instructionLabel);

                        if (isActiveCriterion && !hasChangedOnActive)
                        {
                            hasChangedOnActive = true;
                            m_ShouldShowText   = true;
                            AnalyticsHelper.ParagraphStarted(m_InstructionIndex);
                        }
                        else if (completed && !hasChangedOnCompletion)
                        {
                            //If we reached here the criterion has been completed recently, but has not been hidden as we want it to be after completion
                            hasChangedOnCompletion = true;
                            AnalyticsHelper.ParagraphEnded();
                            m_ShouldShowText = false;
                        }
                        if (Event.current.type == EventType.MouseDown && backgroundElement.rect.Contains(Event.current.mousePosition))
                        {
                            m_ShouldShowText = !m_ShouldShowText;
                            GUIUtility.ExitGUI();
                        }

                        m_FadeGroupAnim.target = m_ShouldShowText;
                        if (pageCompleted && !string.IsNullOrEmpty(paragraph.text))
                        {
                            m_FadeGroupAnim.value = true;
                        }
                    }

                    if (EditorGUILayout.BeginFadeGroup(m_FadeGroupAnim.faded))
                    {
                        var backgroundStyle = isActiveCriterion ? AllTutorialStyles.bgTheInBetweenText : AllTutorialStyles.theInBetweenTextNotActiveOrCompleted;
                        EditorGUILayout.BeginHorizontal(backgroundStyle, GUILayout.ExpandWidth(true));
                        GUILayout.Label(paragraph.text, AllTutorialStyles.theInBetweenText);
                        EditorGUILayout.EndHorizontal();
                    }
                    EditorGUILayout.EndFadeGroup();
                }
                previousTaskState = completed;
                break;

            case ParagraphType.Narrative:
                EditorGUILayout.BeginHorizontal(AllTutorialStyles.headerBGStyle, GUILayout.ExpandWidth(true));
                GUILayout.Label(paragraph.text, AllTutorialStyles.narrativeStyle);
                EditorGUILayout.EndHorizontal();
                break;

            case ParagraphType.SwitchTutorial:
                if (GUILayout.Button(paragraph.m_TutorialButtonText, new GUILayoutOption[] { GUILayout.ExpandWidth(false), GUILayout.MinWidth(250) }))
                {
                    TutorialManager.instance.StartTutorial(paragraph.m_Tutorial);
                }
                break;

            case ParagraphType.OrderedList:
                EditorGUILayout.BeginVertical(AllTutorialStyles.listBGStyle, GUILayout.ExpandWidth(true));
                string[] listItems = paragraph.text.Split('\n');
                for (int i = 0, length = listItems.Length; i < length; ++i)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label(string.Format("{0}{1}", i + 1, orderedListDelimiter), AllTutorialStyles.listPrefix);
                    GUILayout.Label(listItems[i], AllTutorialStyles.list);
                    GUILayout.EndHorizontal();
                }
                EditorGUILayout.EndVertical();
                break;

            case ParagraphType.UnorderedList:
                EditorGUILayout.BeginVertical(AllTutorialStyles.listBGStyle, GUILayout.ExpandWidth(true));
                foreach (var listItem in paragraph.text.Split('\n'))
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label(unorderedListBullet, AllTutorialStyles.listPrefix);
                    GUILayout.Label(listItem, AllTutorialStyles.list);
                    GUILayout.EndHorizontal();
                }
                EditorGUILayout.EndVertical();
                break;

            case ParagraphType.Image:
                using (new EditorGUILayout.HorizontalScope(AllTutorialStyles.imageStyle))
                {
                    GUILayout.FlexibleSpace();
                    GUILayout.Label(paragraph.image, GUIStyle.none);
                    GUILayout.FlexibleSpace();
                }
                break;

            case ParagraphType.Video:
            {
                if (paragraph.video == null)
                {
                    break;
                }

                var texture = m_TutorialWindow.videoPlaybackManager.GetTextureForVideoClip(paragraph.video);

                using (new EditorGUILayout.HorizontalScope(AllTutorialStyles.videoStyle))
                {
                    GUILayout.FlexibleSpace();
                    var position = GUILayoutUtility.GetRect(texture.width, texture.height, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(false));
                    GUI.DrawTexture(position, texture);
                    GUILayout.FlexibleSpace();
                }

                m_TutorialWindow.Repaint();
            }
            break;
            }
        }
コード例 #5
0
 /// <summary>
 /// Opens the URL Of the section, if any
 /// </summary>
 public void OpenUrl()
 {
     TutorialEditorUtils.OpenUrl(Url);
     AnalyticsHelper.SendExternalReferenceEvent(Url, Heading.Untranslated, LinkText, Tutorial?.lessonId);
 }
コード例 #6
0
ファイル: TutorialWindow.cs プロジェクト: Draz96/possessione
 private void OnTutorialInitiated()
 {
     AnalyticsHelper.TutorialStarted(m_CurrentTutorial);
     GenesisHelper.LogTutorialStarted(m_CurrentTutorial.LessonId);
     CreateTutorialViews();
 }