Description:
Fix dialog bug (I hope!) and support multiple dialog entries.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -86,15 +86,23 | |||||
|
86 | foreach (ref readonly var choiceMessage in ReadMessages<DialogChoiceMessage>()) |
|
86 | foreach (ref readonly var choiceMessage in ReadMessages<DialogChoiceMessage>()) |
|
87 | { |
|
87 | { |
|
88 |
|
88 | ||
|
89 |
if (Story.currentChoices.Count > 0 |
|
89 | if (Story.currentChoices.Count > 0 |
|
|
90 | | Story.canContinue) | ||
|
90 | { |
|
91 | { |
|
91 | //Advance the story |
|
92 | //Advance the story |
|
92 | Logging.Debug("Advancing story."); |
|
93 | |
|
93 |
Story. |
|
94 | if (Story.currentChoices.Count > 0) |
|
|
95 | { | ||
|
|
96 | Logging.Debug("Advancing story (choice)."); | ||
|
|
97 | Story.ChooseChoiceIndex(choiceMessage.Choice); | ||
|
|
98 | } | ||
|
|
99 | else { | ||
|
|
100 | Logging.Debug("Advancing story (continuation)."); | ||
|
|
101 | } | ||
|
94 |
|
102 | ||
|
95 | //Update the dialog component with the new speaker, dialog, and options: |
|
103 | //Update the dialog component with the new speaker, dialog, and options: |
|
96 |
|
104 | ||
|
97 |
var continuation = this.Grammar.Flatten(this.Story.Continue |
|
105 | var continuation = this.Grammar.Flatten(this.Story.Continue()); |
|
98 | var parts = Regex.Split(continuation, ":", 0); |
|
106 | var parts = Regex.Split(continuation, ":", 0); |
|
99 | var speaker = (parts.Length == 2) ? this.Grammar.Flatten(parts[0]) : "Dialog"; |
|
107 | var speaker = (parts.Length == 2) ? this.Grammar.Flatten(parts[0]) : "Dialog"; |
|
100 | var dialog = (parts.Length == 2) ? this.Grammar.Flatten(parts[1]) : continuation; |
|
108 | var dialog = (parts.Length == 2) ? this.Grammar.Flatten(parts[1]) : continuation; |
@@ -144,7 +152,7 | |||||
|
144 | var Knot = GetComponent<DialogComponent>(lowestEntity).Knot; |
|
152 | var Knot = GetComponent<DialogComponent>(lowestEntity).Knot; |
|
145 |
|
153 | ||
|
146 | Story.ChoosePathString(Knot); |
|
154 | Story.ChoosePathString(Knot); |
|
147 |
var continuation = this.Story.Continue |
|
155 | var continuation = this.Story.Continue(); |
|
148 | var parts = Regex.Split(continuation, ":", 0); |
|
156 | var parts = Regex.Split(continuation, ":", 0); |
|
149 | var speaker = (parts.Length == 2) ? this.Grammar.Flatten(parts[0]) : "Dialog"; |
|
157 | var speaker = (parts.Length == 2) ? this.Grammar.Flatten(parts[0]) : "Dialog"; |
|
150 | var dialog = (parts.Length == 2) ? this.Grammar.Flatten(parts[1]) : continuation; |
|
158 | var dialog = (parts.Length == 2) ? this.Grammar.Flatten(parts[1]) : continuation; |
@@ -89,6 +89,9 | |||||
|
89 | DialogComponent dialogNode = default; |
|
89 | DialogComponent dialogNode = default; |
|
90 | var image_index = 0; // Needs to be here for scoping reasons. |
|
90 | var image_index = 0; // Needs to be here for scoping reasons. |
|
91 |
|
91 | ||
|
|
92 | var dialog_count = 0; | ||
|
|
93 | var dialog_open = false; | ||
|
|
94 | |||
|
92 | ProfanityLevel profanityLevel = default; |
|
95 | ProfanityLevel profanityLevel = default; |
|
93 |
|
96 | ||
|
94 | foreach (ref readonly var entity in ReadEntities<OptionsComponent>()) |
|
97 | foreach (ref readonly var entity in ReadEntities<OptionsComponent>()) |
@@ -147,6 +150,8 | |||||
|
147 | break; |
|
150 | break; |
|
148 | case Window.Dialog: |
|
151 | case Window.Dialog: |
|
149 |
|
152 | ||
|
|
153 | dialog_count++; | ||
|
|
154 | |||
|
150 |
|
155 | ||
|
151 | if (HasComponent<ImageComponent>(entity)) |
|
156 | if (HasComponent<ImageComponent>(entity)) |
|
152 | { |
|
157 | { |
@@ -163,7 +168,8 | |||||
|
163 |
|
168 | ||
|
164 | if ((dialogEntity == null) |
|
169 | if ((dialogEntity == null) |
|
165 | || (dialogEntity.ID == 0) |
|
170 | || (dialogEntity.ID == 0) |
|
166 |
|| entity.ID < dialogEntity.ID |
|
171 | || entity.ID < dialogEntity.ID |
|
|
172 | && dialog.Hydrated) | ||
|
167 | { |
|
173 | { |
|
168 | dialogEntity = entity; |
|
174 | dialogEntity = entity; |
|
169 | dialogNode = dialog; |
|
175 | dialogNode = dialog; |
@@ -181,9 +187,12 | |||||
|
181 | var show = true; |
|
187 | var show = true; |
|
182 | var paused = true; |
|
188 | var paused = true; |
|
183 | DialogInterface.RenderDialog(dialogEntity, this.BridgeEngine, ref show, ref paused, this.BridgeEngine.font, dialogNode, image_index); |
|
189 | DialogInterface.RenderDialog(dialogEntity, this.BridgeEngine, ref show, ref paused, this.BridgeEngine.font, dialogNode, image_index); |
|
|
190 | dialog_open = true; | ||
|
184 | } |
|
191 | } |
|
|
192 | Logging.Debug(String.Format("{0} dialogs (open? {1}).", dialog_count, dialog_open)); | ||
|
185 | } |
|
193 | } |
|
186 |
|
194 | ||
|
|
195 | |||
|
187 | public void setFont(ImFontPtr font) |
|
196 | public void setFont(ImFontPtr font) |
|
188 | { |
|
197 | { |
|
189 | this.BridgeEngine.font = font; |
|
198 | this.BridgeEngine.font = font; |
You need to be logged in to leave comments.
Login now