Description:
Refactor out checks.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -141,15 +141,24 | |||
|
141 | 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 | 150 | public static void RenderDialog(Entity entity, |
|
145 | 151 | ImGuiWindowBridgeEngine bridgeEngine, ref bool show, ImFontPtr font, DialogComponent dialogComponent, int imageIndex) |
|
146 | 152 | { |
|
147 | 153 | var paused = true; |
|
148 | if (show | |
|
149 | && !String.IsNullOrWhiteSpace(dialogComponent.CurrentDialog)) | |
|
150 |
|
|
|
151 | ImGui.PushFont(font); | |
|
152 | ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.None; | |
|
154 | ||
|
155 | //If we're supposed to show the dialog and there's something to | |
|
156 | //show. | |
|
157 | //I don't know if it's the best design, but it's possible to | |
|
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 | 163 | StyleSets.defaultSet.push(); |
|
155 | 164 | |
@@ -188,7 +197,6 | |||
|
188 | 197 | { |
|
189 | 198 | string messageText = dialogComponent.CurrentDialog; |
|
190 | 199 | ImGui.TextWrapped(messageText); |
|
191 | Logging.Info("Dialog: \"" + messageText + "\""); | |
|
192 | 200 | } |
|
193 | 201 | |
|
194 | 202 | ImGui.Columns(1); |
@@ -202,11 +210,9 | |||
|
202 | 210 | { |
|
203 | 211 | bridgeEngine.dialogChoiceMessages.Add(new DialogChoiceMessage |
|
204 | 212 | { |
|
205 | ||
|
206 | 213 | Entity = entity, |
|
207 | 214 | Choice = i |
|
208 | 215 | }); |
|
209 | ||
|
210 | 216 | } |
|
211 | 217 | } |
|
212 | 218 | } |
@@ -230,7 +236,8 | |||
|
230 | 236 | StyleSets.defaultSet.pop(); |
|
231 | 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 | 242 | show = false; |
|
236 | 243 | paused = false; |
You need to be logged in to leave comments.
Login now