Description:
Randomize images (for now) and make some other tweaks.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r426:640b1303417c -

@@ -1,1 +1,1
1 {"inkVersion":20,"root":[[["done",{"#f":5,"#n":"g-0"}],null],"done",{"placeholder":["end",{"#f":1}],"Once":[["^Once upon a time...","\n",["ev",{"^->":"Once.0.2.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":2},{"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":2},{"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!","\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","str","^...","/str","/ev",{"*":".^.c-0","flg":20},{"c-0":["\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#: Hello. I'm #assistantName#.","\n","ev","str","^Nice to meet you.","/str","/ev",{"*":".^.c-0","flg":20},{"c-0":["\n","^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","^Got it, thanks.","/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":5}]}],{"#f":1}],"BadNewsReact":[["ev","str","^Damn.","/str","/ev",{"*":".^.c-0","flg":4},"ev","str","^Fuck.","/str","/ev",{"*":".^.c-1","flg":4},"ev","str","^Shoot.","/str","/ev",{"*":".^.c-2","flg":4},"ev","str","^*Sigh.* Fine.","/str","/ev",{"*":".^.c-3","flg":4},{"c-0":["\n","ev","void","/ev","->->",{"#f":5}],"c-1":["\n","ev","void","/ev","->->",{"#f":5}],"c-2":["\n","ev","void","/ev","->->",{"#f":5}],"c-3":["\n","ev","void","/ev","->->",{"#f":5}]}],{"#f":1}],"AssistantAcknowlege":[["ev","str","^Thanks.","/str","/ev",{"*":".^.c-0","flg":4},"ev","str","^Mmmm hmm.","/str","/ev",{"*":".^.c-1","flg":4},"ev","str","^Get to it.","/str","/ev",{"*":".^.c-2","flg":4},"ev","str","^I really appreciate it, #assistantName#","/str","/ev",{"*":".^.c-3","flg":4},{"c-0":["\n","ev","void","/ev","->->",{"#f":5}],"c-1":["\n","ev","void","/ev","->->",{"#f":5}],"c-2":["\n","ev","void","/ev","->->",{"#f":5}],"c-3":["\n","ev","void","/ev","->->",{"#f":5}]}],{"#f":1}],"MassVandalism":[["^#assistantName#: Bad news, director.","\n","ev","str","^Oh?","/str","/ev",{"*":".^.c-0","flg":4},{"c-0":["\n","^#assistantName#: A number of trees have been seriously damaged overnight.","\n",["ev","str","^How bad are they?","/str","/ev",{"*":".^.c-0","flg":4},{"c-0":["\n","^#assistantName#: I'm no botanist, but they're not great. The gouges are pretty deep.","\n",{"->t->":"BadNewsReact"},"^#assistantName#: Yeah, it's awful.","\n","^I'll see who's around and get to cleaning.","\n",{"->t->":"AssistantAcknowlege"},"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":[[["done",{"#f":5,"#n":"g-0"}],null],"done",{"placeholder":["end",{"#f":1}],"alter":[{"temp=":"k"},{"temp=":"x"},"ev",{"VAR?":"x"},{"VAR?":"k"},"+","/ev",{"temp=":"x","re":true},{"#f":1}],"inc":[{"temp=":"x"},"ev",{"VAR?":"x"},1,"+","/ev",{"temp=":"x","re":true},{"#f":1}],"dec":[{"temp=":"x"},"ev",{"VAR?":"x"},1,"-","/ev",{"temp=":"x","re":true},{"#f":1}],"Once":[["^Once upon a time...","\n",["ev",{"^->":"Once.0.2.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":2},{"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":2},{"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!","\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","str","^...","/str","/ev",{"*":".^.c-0","flg":20},{"c-0":["\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#: Hello. I'm #assistantName#.","\n","ev","str","^Nice to meet you.","/str","/ev",{"*":".^.c-0","flg":20},{"c-0":["\n","^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","^Got it, thanks.","/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":5}]}],{"#f":1}],"BadNewsReact":[["ev","str","^Damn.","/str","/ev",{"*":".^.c-0","flg":4},"ev","str","^Fuck.","/str","/ev",{"*":".^.c-1","flg":4},"ev","str","^Shoot.","/str","/ev",{"*":".^.c-2","flg":4},"ev","str","^*Sigh.* Fine.","/str","/ev",{"*":".^.c-3","flg":4},"ev","str","^Who cares?","/str","/ev",{"*":".^.c-4","flg":4},{"c-0":["^ ","ev",{"^var":"playerSwears","ci":-1},{"f()":"inc"},"out","/ev","\n","ev","void","/ev","->->",{"#f":5}],"c-1":["^ ","ev",{"^var":"playerSwears","ci":-1},{"f()":"inc"},"out","/ev","\n","ev","void","/ev","->->",{"#f":5}],"c-2":["^ ","ev",{"^var":"playerSwears","ci":-1},{"f()":"inc"},"out","/ev","\n","ev","void","/ev","->->",{"#f":5}],"c-3":["\n","ev","void","/ev","->->",{"#f":5}],"c-4":["\n","ev","void","/ev","->->",{"#f":5}]}],{"#f":1}],"AssistantAcknowlege":[["ev","str","^Thanks.","/str","/ev",{"*":".^.c-0","flg":4},"ev","str","^Mmmm hmm.","/str","/ev",{"*":".^.c-1","flg":4},"ev","str","^Get to it.","/str","/ev",{"*":".^.c-2","flg":4},"ev","str","^I really appreciate it, #assistantName#","/str","/ev",{"*":".^.c-3","flg":4},{"c-0":["\n","ev","void","/ev","->->",{"#f":5}],"c-1":["\n","ev","void","/ev","->->",{"#f":5}],"c-2":["^ ","ev",{"^var":"playerRude","ci":-1},{"f()":"inc"},"out","/ev","\n","ev","void","/ev","->->",{"#f":5}],"c-3":["\n",{"->":".^.^.^.Appreciate"},{"#f":5}]}],{"Appreciate":["^#assistantName#: ","ev",{"VAR?":"assistantTraits"},{"VAR?":"shy"},"?","/ev",[{"->":".^.b","c":true},{"b":["^...",{"->":".^.^.^.8"},null]}],[{"->":".^.b"},{"b":[["ev","visit",3,"seq","/ev","ev","du",0,"==","/ev",{"->":".^.s0","c":true},"ev","du",1,"==","/ev",{"->":".^.s1","c":true},"ev","du",2,"==","/ev",{"->":".^.s2","c":true},"nop",{"s0":["pop","^No problem.",{"->":".^.^.23"},null],"s1":["pop","^Oh, you're welcome.",{"->":".^.^.23"},null],"s2":["pop","^My pleasure.",{"->":".^.^.23"},null],"#f":5}],{"->":".^.^.^.8"},null]}],"nop","\n","ev","void","/ev","->->",{"#f":1}],"#f":1}],"MassVandalism":[["^#assistantName#: Bad news, director.","\n","ev","str","^Oh?","/str","/ev",{"*":".^.c-0","flg":4},{"c-0":["\n","^#assistantName#: A number of trees have been seriously damaged overnight.","\n",["ev","str","^How bad are they?","/str","/ev",{"*":".^.c-0","flg":4},{"c-0":["\n","^#assistantName#: I'm no botanist, but they're not great. The gouges are pretty deep.","\n",{"->t->":"BadNewsReact"},"^#assistantName#: Yeah, it's ","ev",{"VAR?":"assistantTraits"},{"VAR?":"sweary"},"?","/ev",[{"->":".^.b","c":true},{"b":["^fucking",{"->":".^.^.^.11"},null]}],"nop","^ awful.","\n","^I'll see who's around and get to cleaning.","\n",{"->t->":"AssistantAcknowlege"},"end",{"#f":5}]}],{"#f":5}]}],{"#f":1}],"global decl":["ev",0,{"VAR=":"playerSwears"},0,{"VAR=":"playerRude"},0,{"VAR=":"GovernorOpinion"},{"list":{},"origins":["assistantTraits"]},{"VAR=":"assistantTraits"},"/ev","end",null],"#f":1}],"listDefs":{"assistantTraits":{"shy":1,"esoteric":2,"sweary":3}}} No newline at end of file
@@ -27,10 +27,15
27 27 Story Story;
28 28 Grammar Grammar;
29 29
30 Random Random;
31
32
30 33 public DialogSpawner(Story story, Grammar grammar)
31 34 {
32 35 this.Story = story;
33 36 this.Grammar = grammar;
37
38 this.Random = new Random();
34 39 }
35 40
36 41 protected override void Spawn(in SpawnDialogMessage message)
@@ -66,6 +71,9
66 71 AddComponent(newDialog,
67 72 new VisibilityComponent{ visible = true});
68 73
74 AddComponent(newDialog, new ImageComponent {
75 ImageIndex = Random.Next(0,4) });
76
69 77 Logging.Success("Spawned new dialog.");
70 78 }
71 79 else
@@ -79,6 +87,8
79 87 type = Window.Dialog});
80 88 AddComponent(newDialog,
81 89 new VisibilityComponent{ visible = true});
90 AddComponent(newDialog, new ImageComponent {
91 ImageIndex = Random.Next(0,4) });
82 92 }
83 93 }
84 94 }
@@ -88,6 +88,7
88 88
89 89 Entity dialogEntity = default;
90 90 DialogComponent dialogNode = default;
91 var image_index = 0; // Needs to be here for scoping reasons.
91 92
92 93 ProfanityLevel profanityLevel = default;
93 94
@@ -140,7 +141,19
140 141 NewGameWindow.Render(this.BridgeEngine.font, this.BridgeEngine.italicFont, this.BridgeEngine);
141 142 break;
142 143 case Window.Dialog:
144
143 145
146 if (HasComponent<ImageComponent>(entity))
147 {
148 image_index = GetComponent<ImageComponent>(entity).ImageIndex;
149 }
150 else
151 {
152 //Could address this with a placeholder image, but
153 //I think I prefer eliminating the possibility of a placeholder.
154 Logging.Warning(String.Format("Conversation (Entity ID {0}) without an image.", entity.ID));
155
156 }
144 157 var dialog = GetComponent<DialogComponent>(entity);
145 158
146 159 if ((dialogEntity == null)
@@ -162,7 +175,7
162 175 {
163 176 var show = true;
164 177 var paused = true;
165 DialogInterface.RenderDialog(dialogEntity, this.BridgeEngine, ref show, ref paused, this.BridgeEngine.font, dialogNode);
178 DialogInterface.RenderDialog(dialogEntity, this.BridgeEngine, ref show, ref paused, this.BridgeEngine.font, dialogNode, image_index);
166 179 }
167 180 }
168 181
@@ -132,7 +132,7
132 132 }
133 133
134 134 public static void RenderDialog(Entity entity,
135 ImGuiWindowBridgeEngine bridgeEngine, ref bool show, ref bool paused, ImFontPtr font, DialogComponent dialogComponent)
135 ImGuiWindowBridgeEngine bridgeEngine, ref bool show, ref bool paused, ImFontPtr font, DialogComponent dialogComponent, int imageIndex)
136 136 {
137 137 if (show)
138 138 {
@@ -157,7 +157,7
157 157 ImGui.Columns(2);
158 158 ImGui.SetColumnWidth(0, 120);
159 159
160 Widgets.MapImage(DialogInterface.map, new Num.Vector2(111, 148), 1);
160 Widgets.MapImage(DialogInterface.map, new Num.Vector2(111, 148), imageIndex);
161 161
162 162 ImGui.NextColumn();
163 163
You need to be logged in to leave comments. Login now