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 VAR GovernorOpinion = 0
2 VAR GovernorOpinion = 0
3
3
4 //-> IntroGovernor
4 //-> IntroGovernor
5 This is a test.
5 //-> IntroAssistant
6 //This is a test.
6 -> END
7 -> END
7
8
8 === Once ===
9 === Once ===
@@ -41,3 +42,14
41 -> END
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 AddComponent(newDialog, new DialogComponent {
56 AddComponent(newDialog, new DialogComponent {
57 Knot = message.Path,
57 Knot = message.Path,
58 CurrentDialog = dialog,
58 CurrentDialog = this.Grammar.Flatten(dialog),
59 CurrentSpeaker = speaker,
59 CurrentSpeaker = this.Grammar.Flatten(speaker),
60 Options = this.Story.currentChoices
60 Options = this.Story.currentChoices
61 .Select(option => option.text)
61 .Select(option => option.text)
62 .ToList()});
62 .ToList()});
@@ -111,7 +111,8
111 #region dialog
111 #region dialog
112
112
113 SendMessage(new SpawnDialogMessage { Path = "IntroGovernor"});
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 #endregion
116 #endregion
116 this.simulation.Subsidy = message.Difficulty switch {
117 this.simulation.Subsidy = message.Difficulty switch {
117 DifficultyLevel.Hard => 0M,
118 DifficultyLevel.Hard => 0M,
@@ -6,6 +6,7
6
6
7 using Encompass;
7 using Encompass;
8 using Ink.Runtime;
8 using Ink.Runtime;
9 using TraceryNet;
9
10
10 using isometricparkfna.Messages;
11 using isometricparkfna.Messages;
11 using isometricparkfna.Components;
12 using isometricparkfna.Components;
@@ -30,10 +31,12
30 class UIEngine : Engine
31 class UIEngine : Engine
31 {
32 {
32 public Story Story;
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 this.Story = story;
38 this.Story = story;
39 this.grammar = grammar;
37 }
40 }
38
41
39 public override void Update(double dt)
42 public override void Update(double dt)
@@ -125,16 +128,15
125 //Update the dialog component with the new speaker, dialog, and options:
128 //Update the dialog component with the new speaker, dialog, and options:
126 var continuation = this.Story.ContinueMaximally();
129 var continuation = this.Story.ContinueMaximally();
127 var parts = Regex.Split(continuation, ":", 0);
130 var parts = Regex.Split(continuation, ":", 0);
128 var speaker = (parts.Length == 2) ? parts[0] : "";
131 var speaker = (parts.Length == 2) ? this.grammar.Flatten(parts[0]) : "Dialog";
129 var dialog = (parts.Length == 2) ? parts[1] : continuation;
132 var dialog = (parts.Length == 2) ? this.grammar.Flatten(parts[1]) : continuation;
130
133
131 SetComponent(choiceMessage.Entity, new DialogComponent {
134 SetComponent(choiceMessage.Entity, new DialogComponent {
132 CurrentDialog = dialog,
135 CurrentDialog = dialog,
133 CurrentSpeaker = speaker,
136 CurrentSpeaker = speaker,
134 Options = this.Story.currentChoices
137 Options = this.Story.currentChoices
135 .Select(option => option.text)
138 .Select(option => option.text)
136 .ToList()});
139 .ToList()});}
137 }
138 else
140 else
139 {
141 {
140 Logging.Debug(String.Format("Destroying Dialog (Entity ID {0}).", choiceMessage.Entity.ID));
142 Logging.Debug(String.Format("Destroying Dialog (Entity ID {0}).", choiceMessage.Entity.ID));
@@ -169,8 +171,8
169 Story.ChoosePathString(Knot);
171 Story.ChoosePathString(Knot);
170 var continuation = this.Story.ContinueMaximally();
172 var continuation = this.Story.ContinueMaximally();
171 var parts = Regex.Split(continuation, ":", 0);
173 var parts = Regex.Split(continuation, ":", 0);
172 var speaker = (parts.Length == 2) ? parts[0] : "";
174 var speaker = (parts.Length == 2) ? this.grammar.Flatten(parts[0]) : "Dialog";
173 var dialog = (parts.Length == 2) ? parts[1] : continuation;
175 var dialog = (parts.Length == 2) ? this.grammar.Flatten(parts[1]) : continuation;
174 SetComponent(lowestEntity, new DialogComponent {
176 SetComponent(lowestEntity, new DialogComponent {
175 Knot = Knot,
177 Knot = Knot,
176 CurrentDialog = dialog,
178 CurrentDialog = dialog,
@@ -249,7 +249,7
249 Logging.Debug(this.Story.ContinueMaximally());
249 Logging.Debug(this.Story.ContinueMaximally());
250
250
251 WorldBuilder.AddEngine(new InputEngine(Menu.MENU_BAR_HEIGHT, this.camera, gdm));
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 var gameBridgeEngine = new GameBridgeEngine(this);
254 var gameBridgeEngine = new GameBridgeEngine(this);
255
255
You need to be logged in to leave comments. Login now