// Ok, this name is bad, but... // It takes our xml d (which stands for dialog) nodes // from scene-content and seperate it into NyaaDialog variables public void loadDialog() { Dialogs = new NyaaDialog[sceneContent.Count]; int dialogNumber = 0; foreach (XmlNode dialog in sceneContent) { //NyaaDebug.addToConsole(xmlnodeAsString(dialog)); if (dialog.SelectSingleNode("selection-screen") == null) { Dialogs[dialogNumber] = new NyaaDialog(dialog["d-content"].InnerText, dialog["name"].InnerText, getResourceLocation(dialog["char-img"].InnerText), dialog["char-pos"].InnerText, dialog["char-view"].InnerText, boolStrConvert(dialog["shadow"].InnerText)); dialogNumber++; } else { NyaaDebug.addToConsole("Notice: Found a selection screen"); XmlNodeList selections = dialog["selection-screen"].ChildNodes; Dialogs[dialogNumber] = new NyaaDialog(dialog["d-content"].InnerText, dialog["name"].InnerText, getResourceLocation(dialog["char-img"].InnerText), dialog["char-pos"].InnerText, dialog["char-view"].InnerText, boolStrConvert(dialog["shadow"].InnerText), selections); dialogNumber++; } } }
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()); } }
/* ------------------------------------------- * Method Group: Story Update Methods * Changing Dialog methods * ------------------------------------------- */ /* Method: startStory() * Descrtiption: First update for the novel occurs here */ private void startStory() { thisDialog = Novel.nextText(); CurrentBGPath = Novel.getCurrentBackground(); BitmapImage bmImage = new BitmapImage(); bmImage.BeginInit(); bmImage.UriSource = new Uri(CurrentBGPath, UriKind.Absolute); bmImage.EndInit(); Background.Source = bmImage; 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(); Update(Novel.getCurrentBackground(), thisDialog); }
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(); } }