From 3456bf5eb4d89e105f3eede50b4cc9b521d66ecf Mon Sep 17 00:00:00 2001 From: U-C-S Date: Thu, 29 Oct 2020 17:30:40 +0530 Subject: [PATCH] v0.16 - Changed the scenario's file extension to .html from .story - Changes to adopt html parsing, similar to xml --- Something/Game.xaml.cs | 33 +++++++++++----- Something/Properties/AssemblyInfo.cs | 4 +- _Output/Something.exe | Bin 36352 -> 36352 bytes _Output/Trees/Test.html | 54 ++++++++++++++------------- _Output/Trees/Test2.story | 54 --------------------------- _Output/Trees/_stories.xml | 8 ++-- 6 files changed, 58 insertions(+), 95 deletions(-) delete mode 100644 _Output/Trees/Test2.story diff --git a/Something/Game.xaml.cs b/Something/Game.xaml.cs index 741d00e..6f49ae9 100644 --- a/Something/Game.xaml.cs +++ b/Something/Game.xaml.cs @@ -1,4 +1,5 @@ using System; +using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; @@ -27,17 +28,27 @@ public Game(XDocument XMLfile) { InitializeComponent(); SourceFileXML = XMLfile; - currentElem = SourceFileXML.Root.Element("story").Element("START"); + ajna("START"); Renderer(); } - + void ajna(string source) + { + IEnumerable a = SourceFileXML.Root.Element("body").Elements("div"); + foreach (XElement e in a) + { + if(e.Attribute("id").Value == source) + { + currentElem = e; + } + } + } void Renderer() { try { - BrContext.Text = currentElem.Element("conseq").Value.ToString(); - path1.Content = currentElem.Element("choice1").Element("btn").Value.ToString(); - path2.Content = currentElem.Element("choice2").Element("btn").Value.ToString(); + BrContext.Text = currentElem.Element("p").Value.ToString(); + path1.Content = currentElem.Elements("a").First().Value.ToString(); + path2.Content = currentElem.Elements("a").Last().Value.ToString(); } catch (System.NullReferenceException) { @@ -49,18 +60,20 @@ void Renderer() private void PathClick(object sender, RoutedEventArgs e) { string actionElem; - if((string)(sender as Button).Tag == "btn1") - actionElem = currentElem.Element("choice1").Element("action").Value.ToString(); + + if ((string)(sender as Button).Tag == "btn1") + actionElem = currentElem.Elements("a").First().Attribute("href").Value.ToString(); else - actionElem = currentElem.Element("choice2").Element("action").Value.ToString(); + actionElem = currentElem.Elements("a").Last().Attribute("href").Value.ToString(); - if(actionElem == "END" || actionElem == null) + actionElem = actionElem.Remove(0,1); + if (actionElem == "END") { GameOver(); } else { - currentElem = SourceFileXML.Root.Element("story").Element(actionElem); + ajna(actionElem); Renderer(); } } diff --git a/Something/Properties/AssemblyInfo.cs b/Something/Properties/AssemblyInfo.cs index 20f9d87..91ad6c9 100644 --- a/Something/Properties/AssemblyInfo.cs +++ b/Something/Properties/AssemblyInfo.cs @@ -19,6 +19,6 @@ ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly )] -[assembly: AssemblyVersion("0.15.0.0")] -[assembly: AssemblyFileVersion("0.15.0.0")] +[assembly: AssemblyVersion("0.16.0.0")] +[assembly: AssemblyFileVersion("0.16.0.0")] [assembly: NeutralResourcesLanguage("en-US")] diff --git a/_Output/Something.exe b/_Output/Something.exe index 4e2614a2fdb1a3da0c58ea06f75cc0baeb99c00a..cb3556c89c3c187e96d1444f9b6b2c92f17c2fb5 100644 GIT binary patch delta 8519 zcma)B4SW>UwLkaH?Ck7hce67gpML=mgtqS7**}fms7+L z?=HDn%; zjO2A_a)u5KCa*^)Y^Fx_7~B9s(%k^m5;p>Cg3{a=f#YDZ6?E83uUo+yBbdbMtzTD@ zh;c@0Y5X;0@oM^y)MyWPaLLwO4!e~{rzZ5wz!4>HVyI!*2#~FC(`|XaMs7BEjy8cL z5A9{|Dto(+eQ$I5S@YL(D~l5ODsTOPuM;xIf%A389h5s1G!KCv0uLaQn!7#$Q8I(6 zTCnFLHI1WJ=@^$?52EZnD+ignxJRb4$VpUdw1$rP`=dD4zc*@*Kg=j7Ot!&^WuzAM z1Q3)7UPQGt`j&#Kg#l_!NImPU<{{qOx#x+YUMLoqU(`IeDBqhFTaZ(N@y(k#x|_Yd zvEn}baIAd!9-izL=r^JW_3l!v-~?(L^H?NXS>xB*;ht5iTKh>Ksx~fhEBnF*=&~>o z_omuK?x(5!eb34&WNSa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u8>?_c*{JQv8BXpFaBx95 zxi9@ZmVTbWb{0IT$tH#0@WlzS4ybx)Q3^QS%EtIjEscRo<+Wuk18@}Qp)`g7=<`1nNVdX9z7(M}e^XE&JBMpVw z^6X}-ZfSjEr2ctf1(v0R-!BSJ~)7Tv3Erukgrx`Y0^>NXx4ur8p>V& E54#X|x&QzG diff --git a/_Output/Trees/Test.html b/_Output/Trees/Test.html index 31dcb7e..241dc9d 100644 --- a/_Output/Trees/Test.html +++ b/_Output/Trees/Test.html @@ -11,30 +11,34 @@ choice2 btn context
-

Conseqcuences for the Choices

- choice1 btn context - choice2 btn context +

Which color is yellow?

+ light Yellow + Pure Red +
+
+

You are right. light yellow is a yellow color. Now, Wanna go to next question?

+ ok + OK +
+
+

Oh you are wrong and unintelligent. now accept light yellow is yellow

+ Ok + Fine Ok +
+
+

Which language is this program written in?

+ C# + C++ +
+
+

Correct. Wanna play this game again?

+ Yeh. why not + Get lost +
+
+

Wrong. This program is in C#

+ this is dumb + again
- - - - \ No newline at end of file + \ No newline at end of file diff --git a/_Output/Trees/Test2.story b/_Output/Trees/Test2.story deleted file mode 100644 index 95b59c0..0000000 --- a/_Output/Trees/Test2.story +++ /dev/null @@ -1,54 +0,0 @@ - - - - Test2 Success - To test the ability to parse the XML File - - - - - - - - - \ No newline at end of file diff --git a/_Output/Trees/_stories.xml b/_Output/Trees/_stories.xml index b2fe6ff..a5cabd5 100644 --- a/_Output/Trees/_stories.xml +++ b/_Output/Trees/_stories.xml @@ -6,21 +6,21 @@ Test1 This is still in beta. Why not press the next-button to check whether it's working or not - Test.xml + Test.html Test2: Success So it's a Success. Welcome to Next-gen - Test2.story + Test.html Death by Mass Killing You can't kill everyone but you can influence everyone. - Test.story + Test.html Death by Dying You can do it. - Test.story + Test.html \ No newline at end of file