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

r486:b0244556bb98 -

@@ -141,15 +141,24
141 DialogInterface._imGuiTexture = _imGuiRenderer.BindTexture(_xnaTexture);
141 DialogInterface._imGuiTexture = _imGuiRenderer.BindTexture(_xnaTexture);
142 }
142 }
143
143
144 private static bool ContentRemaining(DialogComponent dialogComponent)
145 {
146 return !String.IsNullOrWhiteSpace(dialogComponent.CurrentDialog)
147 || ((dialogComponent.Options != null) && dialogComponent.Options.Count > 0);
148 }
149
144 public static void RenderDialog(Entity entity,
150 public static void RenderDialog(Entity entity,
145 ImGuiWindowBridgeEngine bridgeEngine, ref bool show, ImFontPtr font, DialogComponent dialogComponent, int imageIndex)
151 ImGuiWindowBridgeEngine bridgeEngine, ref bool show, ImFontPtr font, DialogComponent dialogComponent, int imageIndex)
146 {
152 {
147 var paused = true;
153 var paused = true;
148 if (show
154
149 && !String.IsNullOrWhiteSpace(dialogComponent.CurrentDialog))
155 //If we're supposed to show the dialog and there's something to
150 {
156 //show.
151 ImGui.PushFont(font);
157 //I don't know if it's the best design, but it's possible to
152 ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.None;
158 //get into a state where we're effectively done.but there's still an entity
159 if (show && ContentRemaining(dialogComponent)) {
160 ImGui.PushFont(font);
161 ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.None;
153
162
154 StyleSets.defaultSet.push();
163 StyleSets.defaultSet.push();
155
164
@@ -188,7 +197,6
188 {
197 {
189 string messageText = dialogComponent.CurrentDialog;
198 string messageText = dialogComponent.CurrentDialog;
190 ImGui.TextWrapped(messageText);
199 ImGui.TextWrapped(messageText);
191 Logging.Info("Dialog: \"" + messageText + "\"");
192 }
200 }
193
201
194 ImGui.Columns(1);
202 ImGui.Columns(1);
@@ -202,11 +210,9
202 {
210 {
203 bridgeEngine.dialogChoiceMessages.Add(new DialogChoiceMessage
211 bridgeEngine.dialogChoiceMessages.Add(new DialogChoiceMessage
204 {
212 {
205
206 Entity = entity,
213 Entity = entity,
207 Choice = i
214 Choice = i
208 });
215 });
209
210 }
216 }
211 }
217 }
212 }
218 }
@@ -230,7 +236,8
230 StyleSets.defaultSet.pop();
236 StyleSets.defaultSet.pop();
231 ImGui.PopFont();
237 ImGui.PopFont();
232 }
238 }
233 if (String.IsNullOrWhiteSpace(dialogComponent.CurrentDialog))
239 //If we're at the end, advance it and hide.
240 if (!ContentRemaining(dialogComponent))
234 {
241 {
235 show = false;
242 show = false;
236 paused = false;
243 paused = false;
You need to be logged in to leave comments. Login now