# HG changeset patch # User alys # Date 2021-06-05 04:25:51 # Node ID b7e3321396b37f3307d4e3eca6336b0067d93bfe # Parent 483d5fca02e631a037d8278e43f5a504af58b3b7 Refactor Dialog to use StyleSet. 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 @@ -111,26 +111,13 @@ if (show) { ImGui.PushFont(font); - ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.None; - ImGui.PushStyleVar(ImGuiStyleVar.FrameRounding, 0.0f); - ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 0.0f); - ImGui.PushStyleVar(ImGuiStyleVar.FrameBorderSize, 1.0f); - ImGui.PushStyleColor(ImGuiCol.WindowBg, new Num.Vector4(0.75f, 0.75f, 0.75f, 1f)); - ImGui.PushStyleColor(ImGuiCol.TitleBg, StyleSet.title_bar); - ImGui.PushStyleColor(ImGuiCol.TitleBgActive, StyleSet.title_bar); - ImGui.PushStyleColor(ImGuiCol.TitleBgCollapsed, StyleSet.title_bar); - - ImGui.PushStyleColor(ImGuiCol.Border, new Num.Vector4(0f, 0f, 0f, 1f)); - ImGui.PushStyleColor(ImGuiCol.BorderShadow, new Num.Vector4(0f, 0f, 0f, 0.5f)); + StyleSet.pushStyleVarSet(StyleSet.defaultWindowVars); + StyleSet.pushColorSet(StyleSet.defaultWindowColors); - - - ImGui.PushStyleColor(ImGuiCol.Button, new Num.Vector4(0.75f, 0.75f, 0.75f, 1f)); - ImGui.PushStyleColor(ImGuiCol.Text, new Num.Vector4(0f, 0f, 0f, 1f)); ImGui.SetNextWindowSize(new Num.Vector2(400, 200)); - ImGui.Begin(currentNode.data.speaker, ref show); + ImGui.Begin(currentNode.data.speaker, ref show, ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoSavedSettings); if (currentNode.data.response != null) @@ -167,9 +154,9 @@ } ImGui.End(); - ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.Left; - ImGui.PopStyleVar(3); - ImGui.PopStyleColor(8); + ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.Left; + StyleSet.popStyleVarSet(StyleSet.defaultWindowVars); + StyleSet.popColorSet(StyleSet.defaultWindowColors); ImGui.PopFont(); } return new_child;