diff --git a/client/Configuration.cs b/client/Configuration.cs index 47e1976..d0a8d84 100644 --- a/client/Configuration.cs +++ b/client/Configuration.cs @@ -14,4 +14,5 @@ public class Configuration : IPluginConfiguration { public bool AutoViewer; public bool AutoViewerClose = true; public float ViewerOpacity = 100.0f; + public int DefaultGlyph = 3; } diff --git a/client/Ui/MainWindowTabs/Settings.cs b/client/Ui/MainWindowTabs/Settings.cs index 200e9b9..b6585c7 100644 --- a/client/Ui/MainWindowTabs/Settings.cs +++ b/client/Ui/MainWindowTabs/Settings.cs @@ -29,6 +29,12 @@ internal class Settings : ITab { anyChanged |= ImGui.Checkbox("Close the viewer automatically when no signs are nearby", ref this.Plugin.Config.AutoViewerClose); anyChanged |= ImGui.SliderFloat("Viewer opacity", ref this.Plugin.Config.ViewerOpacity, 0f, 100.0f, $"{this.Plugin.Config.ViewerOpacity:N3}%%"); + var glyph = this.Plugin.Config.DefaultGlyph + 1; + if (ImGui.InputInt("Default glyph", ref glyph)) { + this.Plugin.Config.DefaultGlyph = Math.Min(4, Math.Max(0, glyph - 1)); + anyChanged = true; + } + if (anyChanged) { this.Plugin.SaveConfig(); } diff --git a/client/Ui/MainWindowTabs/Write.cs b/client/Ui/MainWindowTabs/Write.cs index c24c71d..1b257b7 100644 --- a/client/Ui/MainWindowTabs/Write.cs +++ b/client/Ui/MainWindowTabs/Write.cs @@ -36,6 +36,8 @@ internal class Write : ITab { internal Write(Plugin plugin) { this.Plugin = plugin; this.LoadSignImages(); + + this._glyph = this.Plugin.Config.DefaultGlyph; } public void Dispose() { @@ -175,12 +177,14 @@ internal class Write : ITab { } if (ImGui.BeginCombo("Glyph", this._glyph.ToString())) { + var tooltipShown = false; + for (var i = 0; i < 5; i++) { if (ImGui.Selectable($"{i + 1}", this._glyph == i)) { this._glyph = i; } - if (!ImGui.IsItemHovered()) { + if (tooltipShown || !ImGui.IsItemHovered()) { continue; } @@ -188,6 +192,7 @@ internal class Write : ITab { var image = this.GlyphImages[i]; ImGui.Image(image.ImGuiHandle, new Vector2(imageHeight)); ImGui.EndTooltip(); + tooltipShown = true; } ImGui.EndCombo(); @@ -263,7 +268,7 @@ internal class Write : ITab { this._part1 = this._part2 = this._conj = -1; this._word1 = (-1, -1); this._word2 = (-1, -1); - this._glyph = 0; + this._glyph = this.Plugin.Config.DefaultGlyph; } private void ClearIfNecessary() {