public TutorialParagraphView(TutorialParagraph paragraph, EditorWindow window, string orderedListDelimiter, string unorderedListBullet, int instructionIndex) { this.paragraph = paragraph; if (paragraph.type == ParagraphType.Instruction) { m_FadeGroupAnim.valueChanged.AddListener(window.Repaint); } this.orderedListDelimiter = orderedListDelimiter; this.unorderedListBullet = unorderedListBullet; this.m_InstructionIndex = instructionIndex; }
/// <summary> /// UnityEngine.ISerializationCallbackReceiver override, do not call. /// </summary> public void OnAfterDeserialize() { // Migrate content from < 1.2. TutorialParagraph.MigrateStringToLocalizableString(ref m_NextButton, ref NextButton); TutorialParagraph.MigrateStringToLocalizableString(ref m_DoneButton, ref DoneButton); }
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")); } }
// TODO Will be (merged into TutorialWindow and) refactored away completely soon public TutorialParagraphView(TutorialParagraph paragraph, EditorWindow window, string orderedListDelimiter, string unorderedListBullet, int instructionIndex) { this.paragraph = paragraph; }