Ejemplo n.º 1
0
        void OnTutorialPagesModified(Tutorial sender)
        {
            if (sender == null || currentTutorial == null || currentTutorial != sender)
            {
                return;
            }

            CreateTutorialViews();

            ApplyMaskingSettings(true);
        }
Ejemplo n.º 2
0
        private void OnTutorialPagesChanged(Tutorial sender)
        {
            if (sender == null || m_CurrentTutorial == null || m_CurrentTutorial != sender)
            {
                return;
            }

            FormatTitle();
            CreateTutorialViews();

            ApplyMaskingSettings(true);
        }
 internal static void TutorialStarted(Tutorial tutorial)
 {
     if (Instance.currentTutorial != null)
     {
         DebugWarning("TutorialStarted Ignored because tutorial is already set: {0}", tutorial);
         return;
     }
     DebugLog("Tutorial Started: {0}", tutorial);
     Instance.currentTutorial          = tutorial;
     Instance.currentTutorialStartTime = DateTime.UtcNow;
     Instance.currentPageIndex         = Instance.lastPageIndex = Instance.currentParagraphIndex = -1;
     Instance.currentPage = Instance.lastPage = null;
 }
Ejemplo n.º 4
0
        public void StartTutorial(Tutorial tutorial)
        {
            m_Tutorial = tutorial;

            // Ensure we are in edit mode
            if (EditorApplication.isPlaying)
            {
                EditorApplication.isPlaying             = false;
                EditorApplication.playModeStateChanged += PostponeStartTutorialToEditMode;
            }
            else
            {
                StartTutorialInEditMode();
            }
        }
Ejemplo n.º 5
0
        internal void SetTutorial(Tutorial tutorial, bool reload = true)
        {
            ClearTutorialListener();

            m_CurrentTutorial = tutorial;
            if (m_CurrentTutorial != null)
            {
                if (reload)
                {
                    m_CurrentTutorial.ReloadTutorial();
                }
                m_AllParagraphs.Clear();
                m_Paragraphs.Clear();
            }
            SetUpTutorial();
        }
Ejemplo n.º 6
0
        public void StartTutorial(Tutorial tutorial)
        {
            if (tutorial == null)
            {
                Debug.LogError("Null Tutorial.");
                return;
            }

            // Early-out if user decides to cancel. Otherwise the user can get reset to the
            // main tutorial selection screen in cases where the user was about to swtich to
            // another tutorial while finishing up another (typical use case would be having a
            // "start next tutorial" button at the last page of a tutorial).
            if (!EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
            {
                return;
            }

            // NOTE maximizeOnPlay=true was causing problems at some point
            // (tutorial was closed for some reason) but that problem seems to be gone.
            // Keeping this here in case the problem returns.
            //GameViewProxy.maximizeOnPlay = false;

            // Prevent Game view flashing briefly when starting tutorial.
            EditorWindow.GetWindow <SceneView>().Focus();

            // Is the previous tutorial finished? Make sure to record the progress.
            // by trying to progress to the next page which will take care of it.
            if (m_Tutorial && m_Tutorial.completed)
            {
                m_Tutorial.TryGoToNextPage();
            }

            m_Tutorial = tutorial;

            // Ensure we are in edit mode
            if (EditorApplication.isPlaying)
            {
                EditorApplication.isPlaying             = false;
                EditorApplication.playModeStateChanged += PostponeStartTutorialToEditMode;
            }
            else
            {
                StartTutorialImmediateEditMode();
            }
        }
Ejemplo n.º 7
0
        internal void SetTutorial(Tutorial tutorial, bool reload)
        {
            ClearTutorialListener();

            currentTutorial = tutorial;
            if (currentTutorial != null)
            {
                if (reload)
                {
                    currentTutorial.ResetProgress();
                }
                m_AllParagraphs.Clear();
                m_Paragraphs.Clear();
            }

            ApplyMaskingSettings(currentTutorial != null);

            SetUpTutorial();
        }
Ejemplo n.º 8
0
        public void ResetTutorial()
        {
            var tutorialWindow = GetTutorialWindow();

            if (tutorialWindow == null || tutorialWindow.currentTutorial == null)
            {
                return;
            }

            m_Tutorial = tutorialWindow.currentTutorial;

            // Ensure we are in edit mode
            if (EditorApplication.isPlaying)
            {
                EditorApplication.isPlaying             = false;
                EditorApplication.playModeStateChanged += PostponeResetTutorialToEditMode;
            }
            else
            {
                StartTutorialImmediateEditMode();
            }
        }
Ejemplo n.º 9
0
        public void StartTutorial(Tutorial tutorial)
        {
            if (tutorial == null)
            {
                Debug.LogError("Null Tutorial.");
                return;
            }

            // NOTE maximizeOnPlay=true was causing problems at some point
            // (tutorial was closed for some reason) but that problem seems to be gone.
            // Keeping this here in case the problem returns.
            //GameViewProxy.maximizeOnPlay = false;

            // Prevent Game view flashing briefly when starting tutorial.
            EditorWindow.GetWindow <SceneView>().Focus();

            // Is the previous tutorial finished? Make sure to record the progress.
            // by trying to progress to the next page which will take care of it.
            if (m_Tutorial && m_Tutorial.completed)
            {
                m_Tutorial.TryGoToNextPage();
            }

            m_Tutorial = tutorial;

            // Ensure we are in edit mode
            if (EditorApplication.isPlaying)
            {
                EditorApplication.isPlaying             = false;
                EditorApplication.playModeStateChanged += PostponeStartTutorialToEditMode;
            }
            else
            {
                StartTutorialInEditMode();
            }
        }
Ejemplo n.º 10
0
 public AutoCompletion(Tutorial tutorial)
 {
     m_Tutorial = tutorial;
 }
Ejemplo n.º 11
0
        void ShowCurrentTutorialContent()
        {
            if (!m_AllParagraphs.Any() || !currentTutorial)
            {
                return;
            }
            if (m_AllParagraphs.Count() <= currentTutorial.currentPageIndex)
            {
                return;
            }

            ScrollToTop();

            TutorialParagraph paragraph          = null;
            TutorialParagraph narrativeParagraph = null;
            Tutorial          endLink            = null;
            string            endText            = "";
            string            pageTitle          = "";

            foreach (TutorialParagraph para in currentTutorial.currentPage.paragraphs)
            {
                if (para.type == ParagraphType.SwitchTutorial)
                {
                    endLink = para.m_Tutorial;
                    endText = para.m_TutorialButtonText;
                }
                if (para.type == ParagraphType.Narrative)
                {
                    narrativeParagraph = para;
                    if (!string.IsNullOrEmpty(para.summary))
                    {
                        pageTitle = para.summary;
                    }
                }
                if (para.type == ParagraphType.Instruction)
                {
                    if (!string.IsNullOrEmpty(para.summary))
                    {
                        pageTitle = para.summary;
                    }
                    paragraph = para;
                }
                if (para.type == ParagraphType.Image)
                {
                    rootVisualElement.Q("TutorialMedia").style.backgroundImage = para.image;
                }
                if (para.type == ParagraphType.Video)
                {
                    rootVisualElement.Q("TutorialMedia").style.backgroundImage = videoPlaybackManager.GetTextureForVideoClip(para.video);
                }
            }

            Button linkButton = rootVisualElement.Q <Button>("LinkButton");

            if (endLink != null)
            {
                linkButton.clickable.clicked += () => TutorialManager.instance.StartTutorial(endLink);
                linkButton.text = Localization.Tr(endText);
                ShowElement(linkButton);
            }
            else
            {
                HideElement(linkButton);
            }
            rootVisualElement.Q <Label>("TutorialTitle").text = Localization.Tr(pageTitle);
            if (paragraph != null)
            {
                if (string.IsNullOrEmpty(paragraph.InstructionTitle) && string.IsNullOrEmpty(paragraph.InstructionText))
                {
                    // hide instruction box if empty title
                    HideElement("InstructionContainer");
                }
                else
                {
                    // populate instruction box
                    ShowElement("InstructionContainer");
                    if (string.IsNullOrEmpty(paragraph.InstructionTitle))
                    {
                        HideElement("InstructionTitle");
                    }
                    else
                    {
                        ShowElement("InstructionTitle");
                        rootVisualElement.Q <Label>("InstructionTitle").text = Localization.Tr(paragraph.InstructionTitle);
                    }
                    RichTextToVisualElements(paragraph.InstructionText, rootVisualElement.Q("InstructionDescription"));
                }
            }
            else
            {
                HideElement("InstructionContainer");
            }

            if (narrativeParagraph != null)
            {
                RichTextToVisualElements(narrativeParagraph.Description, rootVisualElement.Q("TutorialStepBox1"));
            }
        }