IEnumerator OnPressBackCo() { if (m_currentPage == m_firstChapterEnd) { m_emotion = Emotion.Fun; PlayFun(); } --m_currentPage; StoryPage page = FindStoryPage(); StartCoroutine(ChangeText(page)); int imagePage = m_currentPage; while (!page.HasImages() && imagePage > 0) { --imagePage; page = FindStoryPage(imagePage); } yield return(StartCoroutine(ChangeImage(page))); StartCoroutine(GoStoryPage()); }
public void Display(StoryPage storyImage) { _imageUI.sprite = storyImage.Graphic; _imageTextUI.text = storyImage.Text; _delayModifier = storyImage.TextSpeedModifier; }
public StoryScene(string filename) { int screenWidth = game.GDM().GraphicsDevice.Viewport.Width; int screenHeight = game.GDM().GraphicsDevice.Viewport.Height; visibleWidth = screenWidth - 80; this.spriteBatch = new SpriteBatch(game.GDM().GraphicsDevice); this.titleFont = game.CM().Load <SpriteFont>("Fonts/8BitLimit"); this.bodyFont = game.CM().Load <SpriteFont>("Fonts/PressStart2P"); textRectangle = new Rectangle( 40, (int)(screenHeight * 0.4f), screenWidth - 80, (int)(screenHeight * 0.4f)); page = JsonConvert.DeserializeObject <StoryPage>(File.ReadAllText(filename)); mVoiceover = game.GetSoundManager().GetSoundEffectInstance(page.Voiceover); mVoiceover.Play(); var mouseState = Mouse.GetState(); if (mouseState.LeftButton == ButtonState.Pressed) { mButtonReleased = false; } else { mButtonReleased = true; } }
IEnumerator ChangeText(StoryPage page) { Debug.Log("page: " + page); if (page != null) { m_audioSource.clip = page.GetAudio(); if (m_textScaleTweens) { TweenScale.Begin(m_textLabel.gameObject, StoryInfo.scaleDuration, Vector3.zero); yield return(new WaitForSeconds(StoryInfo.scaleDuration + m_fadeInDelay)); } else { TweenAlpha.Begin(m_textPanel.gameObject, StoryInfo.fadeDuration, 0); yield return(new WaitForSeconds(StoryInfo.fadeDuration + m_fadeInDelay)); } m_textLabel.text = page.GetText(); if (m_textScaleTweens) { TweenScale.Begin(m_textLabel.gameObject, StoryInfo.fadeDuration, Vector3.one); } else { TweenAlpha.Begin(m_textPanel.gameObject, StoryInfo.fadeDuration, 1); } } yield break; }
public virtual void SyncByInspector() { StoryPage nextPage = displayPages.GetCurrentPage(); if (nextPage != null) { //Debug.Log("Update with page"); UpdateBodyText(nextPage.text); } }
public void SetUp() { driver = new ChromeDriver(); loginPage = new LoginPage(driver); homePage = new HomePage(driver); storyPage = new StoryPage(driver); driver.Manage().Window.Maximize(); driver.Navigate().GoToUrl("https://www.wattpad.com/"); loginPage.NavigateToLoginPage(); loginPage.LoginApplication(loginCredentials.Username, loginCredentials.Password); }
IEnumerator ReadPage(float readTime) { yield return(new WaitForSeconds(readTime)); StoryPage nextPage = displayPages.AdvancePages(); if (nextPage != null) { UpdateBodyText(nextPage.text); StartCoroutine(ReadPage(nextPage.readTime)); } }
IEnumerator TurnPage() { StoryPage page = FindStoryPage(); if (page == null) { if (!m_hasEndedChapter) { m_hasEndedChapter = true; m_firstChapterEnd = m_currentPage; } StartCoroutine(GoEmotionSelect()); } else { float lastPageSpriteAlpha = page.IsLastPage() ? 1 : 0; TweenAlpha.Begin(m_lastPagePanel.gameObject, StoryInfo.fadeDuration, lastPageSpriteAlpha); if (!page.IsLastPage()) { PlayAudio(); if (m_currentChapterStart > 1) { m_goToEmotionButton.On(); } m_audioButton.On(); foreach (UISprite counter in m_pageCounters) { TweenAlpha.Begin(counter.gameObject, StoryInfo.fadeDuration, 1); } } else { m_goToEmotionButton.Off(false); m_audioButton.Off(false); foreach (UISprite counter in m_pageCounters) { TweenAlpha.Begin(counter.gameObject, StoryInfo.fadeDuration, 0); } } //Debug.Log("isLastPage: " + page.IsLastPage()); StartCoroutine(ChangeBoth(page)); } yield break; }
// View + GUI Logic #region public void ResetAndFlushAllPropertiesAndViews() { Debug.Log("StoryEventController.ResetAndFlushAllPropertiesAndViews()"); DestroyAllChoiceButtons(); SetContinueButtonVisibility(false); SetContinueButtonInteractableState(false); SetEventDescriptionText(""); SetStoryNameText(""); eventFiredOnContinueButtonClicked = ContinueButtonEvent.None; combatEventAwaitingStart = null; currentStoryPage = null; }
void OnSwipeRight(TurnSwipeDetect swipeDetect) { StopVocalAudio(); m_wordWidget.mainTexture = m_chooseEmotionTexture; --m_currentPage; if (m_currentPage < 1) { m_currentPage = 1; } else { int index = m_currentPage + 1; StoryPage page = FindStoryPage(index); //Debug.LogWarning("name: " + page.gameObject.name); //Debug.LogWarning("hasImages: " + page.HasImages()); //Debug.LogWarning("isLastPage: " + page.IsLastPage()); if (page.IsLastPage()) { --index; page = FindStoryPage(index); //Debug.LogWarning("name: " + page.gameObject.name); //Debug.LogWarning("hasImages: " + page.HasImages()); //Debug.LogWarning("isLastPage: " + page.IsLastPage()); while (!page.HasImages()) { //Debug.LogWarning("CHECK"); --index; page = FindStoryPage(index); } //Debug.LogWarning("FOUND"); //Debug.LogWarning("name: " + page.gameObject.name); //Debug.LogWarning("hasImages: " + page.HasImages()); //Debug.LogWarning("isLastPage: " + page.IsLastPage()); StartCoroutine(ChangeImage(page)); } StartCoroutine(TurnPage()); } }
void StartReading() { //Debug.Log("StartReading"); if (displayPages != null) { //Debug.Log("SetCurrentPage"); displayPages.currentPage = 0; //Debug.Log("pages: " + displayPages.pages.Count.ToString()); StoryPage nextPage = displayPages.GetCurrentPage(); if (nextPage != null) { //Debug.Log("Update with page"); UpdateBodyText(nextPage.text); StartCoroutine(ReadPage(nextPage.readTime)); } } }
IEnumerator ChangeImage(StoryPage page) { if (page != null) { if (page.HasImages()) { bool hasFaded = false; Texture2D newForegroundTex = page.GetForeground(); if (m_foreground.mainTexture != newForegroundTex && m_foreground.mainTexture != null) { hasFaded = true; if (m_imageScaleTweens) { ScaleImages(Vector3.zero); yield return(new WaitForSeconds(StoryInfo.scaleDuration + m_fadeInDelay)); } else { TweenAlpha.Begin(m_imagePanel.gameObject, StoryInfo.fadeDuration, 0); yield return(new WaitForSeconds(StoryInfo.fadeDuration + m_fadeInDelay)); } } m_foreground.mainTexture = newForegroundTex; m_midground.mainTexture = page.GetMidground(); m_background.mainTexture = page.GetBackground(); if (hasFaded) { if (m_imageScaleTweens) { ScaleImages(Vector3.one); } else { TweenAlpha.Begin(m_imagePanel.gameObject, StoryInfo.fadeDuration, 1); } } string pageNum = Regex.Match(page.gameObject.name, @"\d+").Value; if (!page.IsLastPage()) { try { m_currentChapterStart = Convert.ToInt32(pageNum); } catch { m_currentChapterStart = 1; } } else { PlayCute(); } } if (!page.IsLastPage()) { RefreshPageCounters(); } } yield break; }
public void SetCurrentStoryPage(StoryPage storyPage) { currentStoryPage = storyPage; }
void CompleteRevealStoryImage(StoryPage page) { _storyImageView.Display(page); _storyImageView.CompleteReveal(); }
void RevealStoryImage(StoryPage storyImage) { _storyImageView.Display(storyImage); _storyImageView.Reveal(); }
void CompleteRevealStoryText(StoryPage page) { //_storyTextView.Display(page); _storyTextView.CompleteReveal(); }
void RevealStoryText(StoryPage page) { _storyTextView.Display(page); _storyTextView.Reveal(); }
IEnumerator ChangeBoth(StoryPage page) { StartCoroutine(ChangeText(page)); yield return(StartCoroutine(ChangeImage(page))); }
public void Display(StoryPage storyPage) { _textUI.text = storyPage.Text; _delayModifier = storyPage.TextSpeedModifier; }