Description:
Add Tracery support.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r403:f678f0973392 -

@@ -2,7 +2,8
2 2 VAR GovernorOpinion = 0
3 3
4 4 //-> IntroGovernor
5 This is a test.
5 //-> IntroAssistant
6 //This is a test.
6 7 -> END
7 8
8 9 === Once ===
@@ -41,3 +42,14
41 42 -> END
42 43
43 44
45 === IntroAssistant ===
46
47 \#assistantName\#: \#whatever\#
48 * Hi
49
50 \#assistantName\#: Bye
51 -> END
52 * How are you?
53
54 \#assistantName\#: \#howdoing\#
55 -> END No newline at end of file
@@ -1,1 +1,1
1 {"inkVersion":20,"root":[["^This is a test.","\n","end",["done",{"#f":5,"#n":"g-0"}],null],"done",{"Once":[["^Once upon a time...","\n",["ev",{"^->":"Once.0.2.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":18},{"s":["^There were two choices.",{"->":"$r","var":true},null]}],["ev",{"^->":"Once.0.3.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-1","flg":18},{"s":["^There were four lines of content.",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"Once.0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.2.s"},[{"#n":"$r2"}],"\n",{"->":".^.^.g-0"},{"#f":5}],"c-1":["ev",{"^->":"Once.0.c-1.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.3.s"},[{"#n":"$r2"}],"\n",{"->":".^.^.g-0"},{"#f":5}],"g-0":["^They lived happily ever after.","\n","end",{"#f":5}]}],{"#f":1}],"IntroGovernor":[["^Governor: Welcome to your new park, director! You can use the mouse or arrow keys to move around, and the plus and minus keys to zoom in and out. B opens the budget and F lets you adjust Forest Policy.","\n","ev","str","^Okay","/str","/ev",{"*":".^.c-0","flg":20},{"c-0":["\n","^Governor: Make sure that you keep visitors happy and the budget in the black! You're currently getting an annual grant out of my budget—it'd sure be nice if you park were self-sufficient so we could drop that expense!","\n",["ev","str","^And I need to keep the forest healthy, too, right?","/str","/ev",{"*":".^.c-0","flg":20},"ev","str","^Sounds good!","/str","/ev",{"*":".^.c-1","flg":20},{"c-0":["^ ","\n","ev",{"VAR?":"GovernorOpinion"},1,"-","/ev",{"VAR=":"GovernorOpinion","re":true},"^Governor: Ummm, yeah","\n",[["ev",{"^->":"IntroGovernor.0.c-0.3.c-0.10.0.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":18},{"s":["^...",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"IntroGovernor.0.c-0.3.c-0.10.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.0.s"},[{"#n":"$r2"}],"\n","end",{"#f":5}]}],{"#f":5}],"c-1":["\n","ev",{"VAR?":"GovernorOpinion"},1,"+","/ev",{"VAR=":"GovernorOpinion","re":true},"^Governor: I'll check in soon.","\n","end",{"#f":5}]}],{"#f":5}]}],{"#f":1}],"global decl":["ev",0,{"VAR=":"GovernorOpinion"},"/ev","end",null],"#f":1}],"listDefs":{}} No newline at end of file
1 {"inkVersion":20,"root":[["end",["done",{"#f":5,"#n":"g-0"}],null],"done",{"Once":[["^Once upon a time...","\n",["ev",{"^->":"Once.0.2.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":18},{"s":["^There were two choices.",{"->":"$r","var":true},null]}],["ev",{"^->":"Once.0.3.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-1","flg":18},{"s":["^There were four lines of content.",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"Once.0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.2.s"},[{"#n":"$r2"}],"\n",{"->":".^.^.g-0"},{"#f":5}],"c-1":["ev",{"^->":"Once.0.c-1.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.3.s"},[{"#n":"$r2"}],"\n",{"->":".^.^.g-0"},{"#f":5}],"g-0":["^They lived happily ever after.","\n","end",{"#f":5}]}],{"#f":1}],"IntroGovernor":[["^Governor: Welcome to your new park, director! You can use the mouse or arrow keys to move around, and the plus and minus keys to zoom in and out. B opens the budget and F lets you adjust Forest Policy.","\n","ev","str","^Okay","/str","/ev",{"*":".^.c-0","flg":20},{"c-0":["\n","^Governor: Make sure that you keep visitors happy and the budget in the black! You're currently getting an annual grant out of my budget—it'd sure be nice if you park were self-sufficient so we could drop that expense!","\n",["ev","str","^And I need to keep the forest healthy, too, right?","/str","/ev",{"*":".^.c-0","flg":20},"ev","str","^Sounds good!","/str","/ev",{"*":".^.c-1","flg":20},{"c-0":["^ ","\n","ev",{"VAR?":"GovernorOpinion"},1,"-","/ev",{"VAR=":"GovernorOpinion","re":true},"^Governor: Ummm, yeah","\n",[["ev",{"^->":"IntroGovernor.0.c-0.3.c-0.10.0.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":18},{"s":["^...",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"IntroGovernor.0.c-0.3.c-0.10.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.0.s"},[{"#n":"$r2"}],"\n","end",{"#f":5}]}],{"#f":5}],"c-1":["\n","ev",{"VAR?":"GovernorOpinion"},1,"+","/ev",{"VAR=":"GovernorOpinion","re":true},"^Governor: I'll check in soon.","\n","end",{"#f":5}]}],{"#f":5}]}],{"#f":1}],"IntroAssistant":[["^#assistantName#: #whatever#","\n","ev","str","^Hi","/str","/ev",{"*":".^.c-0","flg":20},"ev","str","^How are you?","/str","/ev",{"*":".^.c-1","flg":20},{"c-0":["\n","^#assistantName#: Bye","\n","end",{"#f":5}],"c-1":["\n","^#assistantName#: #howdoing#","\n","end",{"#f":5}]}],{"#f":1}],"global decl":["ev",0,{"VAR=":"GovernorOpinion"},"/ev","end",null],"#f":1}],"listDefs":{}} No newline at end of file
@@ -55,8 +55,8
55 55
56 56 AddComponent(newDialog, new DialogComponent {
57 57 Knot = message.Path,
58 CurrentDialog = dialog,
59 CurrentSpeaker = speaker,
58 CurrentDialog = this.Grammar.Flatten(dialog),
59 CurrentSpeaker = this.Grammar.Flatten(speaker),
60 60 Options = this.Story.currentChoices
61 61 .Select(option => option.text)
62 62 .ToList()});
@@ -111,7 +111,8
111 111 #region dialog
112 112
113 113 SendMessage(new SpawnDialogMessage { Path = "IntroGovernor"});
114 SendMessage(new SpawnDialogMessage { Path = "Once"});
114 // SendMessage(new SpawnDialogMessage { Path = "Once"});
115 SendMessage(new SpawnDialogMessage { Path = "IntroAssistant"});
115 116 #endregion
116 117 this.simulation.Subsidy = message.Difficulty switch {
117 118 DifficultyLevel.Hard => 0M,
@@ -6,6 +6,7
6 6
7 7 using Encompass;
8 8 using Ink.Runtime;
9 using TraceryNet;
9 10
10 11 using isometricparkfna.Messages;
11 12 using isometricparkfna.Components;
@@ -30,10 +31,12
30 31 class UIEngine : Engine
31 32 {
32 33 public Story Story;
34 public Grammar grammar;
33 35
34 public UIEngine(Story story)
36 public UIEngine(Story story, Grammar grammar)
35 37 {
36 38 this.Story = story;
39 this.grammar = grammar;
37 40 }
38 41
39 42 public override void Update(double dt)
@@ -125,16 +128,15
125 128 //Update the dialog component with the new speaker, dialog, and options:
126 129 var continuation = this.Story.ContinueMaximally();
127 130 var parts = Regex.Split(continuation, ":", 0);
128 var speaker = (parts.Length == 2) ? parts[0] : "";
129 var dialog = (parts.Length == 2) ? parts[1] : continuation;
131 var speaker = (parts.Length == 2) ? this.grammar.Flatten(parts[0]) : "Dialog";
132 var dialog = (parts.Length == 2) ? this.grammar.Flatten(parts[1]) : continuation;
130 133
131 134 SetComponent(choiceMessage.Entity, new DialogComponent {
132 CurrentDialog = dialog,
133 CurrentSpeaker = speaker,
134 Options = this.Story.currentChoices
135 .Select(option => option.text)
136 .ToList()});
137 }
135 CurrentDialog = dialog,
136 CurrentSpeaker = speaker,
137 Options = this.Story.currentChoices
138 .Select(option => option.text)
139 .ToList()});}
138 140 else
139 141 {
140 142 Logging.Debug(String.Format("Destroying Dialog (Entity ID {0}).", choiceMessage.Entity.ID));
@@ -169,8 +171,8
169 171 Story.ChoosePathString(Knot);
170 172 var continuation = this.Story.ContinueMaximally();
171 173 var parts = Regex.Split(continuation, ":", 0);
172 var speaker = (parts.Length == 2) ? parts[0] : "";
173 var dialog = (parts.Length == 2) ? parts[1] : continuation;
174 var speaker = (parts.Length == 2) ? this.grammar.Flatten(parts[0]) : "Dialog";
175 var dialog = (parts.Length == 2) ? this.grammar.Flatten(parts[1]) : continuation;
174 176 SetComponent(lowestEntity, new DialogComponent {
175 177 Knot = Knot,
176 178 CurrentDialog = dialog,
@@ -249,7 +249,7
249 249 Logging.Debug(this.Story.ContinueMaximally());
250 250
251 251 WorldBuilder.AddEngine(new InputEngine(Menu.MENU_BAR_HEIGHT, this.camera, gdm));
252 WorldBuilder.AddEngine(new UIEngine(this.Story));
252 WorldBuilder.AddEngine(new UIEngine(this.Story, this.grammar));
253 253
254 254 var gameBridgeEngine = new GameBridgeEngine(this);
255 255
You need to be logged in to leave comments. Login now