# HG changeset patch # User Alys Brooks # Date 2021-12-20 00:46:12 # Node ID b0244556bb98c245ea12b6516fbfcfd10417ff53 # Parent d84773f151b6b684cdff28715ac35d8f358dca9c Refactor out checks. diff --git a/isometric-park-fna/UI/Dialog.cs b/isometric-park-fna/UI/Dialog.cs --- a/isometric-park-fna/UI/Dialog.cs +++ b/isometric-park-fna/UI/Dialog.cs @@ -141,15 +141,24 @@ DialogInterface._imGuiTexture = _imGuiRenderer.BindTexture(_xnaTexture); } + private static bool ContentRemaining(DialogComponent dialogComponent) + { + return !String.IsNullOrWhiteSpace(dialogComponent.CurrentDialog) + || ((dialogComponent.Options != null) && dialogComponent.Options.Count > 0); + } + public static void RenderDialog(Entity entity, ImGuiWindowBridgeEngine bridgeEngine, ref bool show, ImFontPtr font, DialogComponent dialogComponent, int imageIndex) { var paused = true; - if (show - && !String.IsNullOrWhiteSpace(dialogComponent.CurrentDialog)) - { - ImGui.PushFont(font); - ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.None; + + //If we're supposed to show the dialog and there's something to + //show. + //I don't know if it's the best design, but it's possible to + //get into a state where we're effectively done.but there's still an entity + if (show && ContentRemaining(dialogComponent)) { + ImGui.PushFont(font); + ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.None; StyleSets.defaultSet.push(); @@ -188,7 +197,6 @@ { string messageText = dialogComponent.CurrentDialog; ImGui.TextWrapped(messageText); - Logging.Info("Dialog: \"" + messageText + "\""); } ImGui.Columns(1); @@ -202,11 +210,9 @@ { bridgeEngine.dialogChoiceMessages.Add(new DialogChoiceMessage { - Entity = entity, Choice = i }); - } } } @@ -230,7 +236,8 @@ StyleSets.defaultSet.pop(); ImGui.PopFont(); } - if (String.IsNullOrWhiteSpace(dialogComponent.CurrentDialog)) + //If we're at the end, advance it and hide. + if (!ContentRemaining(dialogComponent)) { show = false; paused = false;