private void Update(String imagePath, NyaaDialog CurrentDialog) { if (CurrentBGPath.CompareTo(imagePath) != 0) { if (File.Exists(imagePath)) { DoubleAnimation anim1 = new DoubleAnimation(0, 1, TimeSpan.FromSeconds(2)); Storyboard board = new Storyboard(); board.Children.Add(anim1); Storyboard.SetTarget(anim1, SceneSwitcher); Storyboard.SetTargetProperty(anim1, new PropertyPath("(Opacity)")); board.Completed += delegate { setMainText(CurrentDialog.getDialog()); if (CurrentDialog.getUserInteracting()) { displayChoices(CurrentDialog.getChoices()); } setNameText(CurrentDialog.getTitle()); setCharacterImage(CurrentDialog.getCharacterImage()); setShadow(CurrentDialog.getShadow()); NyaaDebug.addToConsole("Switching Backgrounds"); BitmapImage bmImage = new BitmapImage(); bmImage.BeginInit(); bmImage.UriSource = new Uri(imagePath, UriKind.Absolute); bmImage.EndInit(); Background.Source = bmImage; CurrentBGPath = imagePath; DoubleAnimation anim2 = new DoubleAnimation(1, 0, TimeSpan.FromSeconds(2)); Storyboard board2 = new Storyboard(); board2.Children.Add(anim2); Storyboard.SetTarget(anim2, SceneSwitcher); Storyboard.SetTargetProperty(anim2, new PropertyPath("(Opacity)")); board2.Completed += delegate { Animating = false; }; board2.Begin(); }; Animating = true; board.Begin(); } } else { setMainText(CurrentDialog.getDialog()); if (CurrentDialog.getUserInteracting()) { displayChoices(CurrentDialog.getChoices()); } setNameText(CurrentDialog.getTitle()); setCharacterImage(CurrentDialog.getCharacterImage()); setShadow(CurrentDialog.getShadow()); } }
private void nextPage() { NyaaDebug.addToConsole("Flipping Page!"); thisDialog = Novel.nextText(); if (thisDialog != null) { if (thisDialog.getUserInteracting()) { Update(Novel.getCurrentBackground(), thisDialog); displayChoices(thisDialog.getChoices()); } else { Update(Novel.getCurrentBackground(), thisDialog); } } else { finishNovel(); } }