public override void Draw(ref bool visible) { ImGui.Begin("Preset##TTT5", ref visible, ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoResize); { var preset = Configuration.GetCurrentEnabledChatTypesPreset(); var presetName = preset.Name; if (ImGui.InputText("Name##TTT4", ref presetName, 200)) { preset.Name = presetName; Configuration.Save(); } var useKeybind = preset.UseKeybind; if (ImGui.Checkbox("Enable Keybind", ref useKeybind)) { preset.UseKeybind = useKeybind; Configuration.Save(); } if (useKeybind) { ImGui.PushItemWidth(100f); var kItem1 = VirtualKey.EnumToIndex(preset.ModifierKey); if (ImGui.Combo("##PresetKeybind1", ref kItem1, VirtualKey.Names.Take(3).ToArray(), 3)) { preset.ModifierKey = VirtualKey.IndexToEnum(kItem1); Configuration.Save(); } ImGui.SameLine(); var kItem2 = VirtualKey.EnumToIndex(preset.MajorKey) - 3; if (ImGui.Combo("Preset Enable Keybind##PresetKeybind2", ref kItem2, VirtualKey.Names.Skip(3).ToArray(), VirtualKey.Names.Length - 3)) { preset.MajorKey = VirtualKey.IndexToEnum(kItem2 + 3); Configuration.Save(); } ImGui.PopItemWidth(); } ImGui.Spacing(); if (ImGui.Button("Close###TTT6")) { visible = false; } } ImGui.End(); }
public void Draw() { if (!IsVisible) { return; } var pOpen = true; ImGui.Begin("Hey, Dalamud! Config", ref pOpen); ImGui.PushItemWidth(100f); var kItem1 = VirtualKey.EnumToIndex(_plugin.Config.ModifierKey); if (ImGui.Combo("##DVKeybind1", ref kItem1, VirtualKey.Names.Take(3).ToArray(), 3)) { _plugin.Config.ModifierKey = VirtualKey.IndexToEnum(kItem1); } ImGui.SameLine(); var kItem2 = VirtualKey.EnumToIndex(_plugin.Config.MajorKey) - 3; if (ImGui.Combo("Keybind##DVKeybind2", ref kItem2, VirtualKey.Names.Skip(3).ToArray(), VirtualKey.Names.Length - 3)) { _plugin.Config.MajorKey = VirtualKey.IndexToEnum(kItem2) + 3; } ImGui.PopItemWidth(); ImGui.SliderInt("TTS/Sound Volume", ref _plugin.Config.Volume, 0, 100); ImGui.Checkbox("Disable Hotword in instances", ref _plugin.Config.DisableInInstance); ImGui.Text("This can prevent triggering Hey Dalamud accidentally while in a raid."); ImGui.Text("You can always toggle Hey Dalamud with the /hdtoggle command."); ImGui.Dummy(new Vector2(10, 20)); if (ImGui.Button("Save & Close")) { this._plugin.Config.Save(); } ImGui.End(); IsVisible = pOpen; }
private void DrawSynthesizerSettings() { if (ImGui.CollapsingHeader("Keybinds##TextToTalkKeybind1")) { var useKeybind = Configuration.UseKeybind; if (ImGui.Checkbox("Enable Keybind##TextToTalkKeybind2", ref useKeybind)) { Configuration.UseKeybind = useKeybind; Configuration.Save(); } ImGui.PushItemWidth(100f); var kItem1 = VirtualKey.EnumToIndex(Configuration.ModifierKey); if (ImGui.Combo("##TextToTalkKeybind3", ref kItem1, VirtualKey.Names.Take(3).ToArray(), 3)) { Configuration.ModifierKey = VirtualKey.IndexToEnum(kItem1); Configuration.Save(); } ImGui.SameLine(); var kItem2 = VirtualKey.EnumToIndex(Configuration.MajorKey) - 3; if (ImGui.Combo("TTS Toggle Keybind##TextToTalkKeybind4", ref kItem2, VirtualKey.Names.Skip(3).ToArray(), VirtualKey.Names.Length - 3)) { Configuration.MajorKey = VirtualKey.IndexToEnum(kItem2 + 3); Configuration.Save(); } ImGui.PopItemWidth(); } if (ImGui.CollapsingHeader("General")) { var readFromQuestTalkAddon = Configuration.ReadFromQuestTalkAddon; if (ImGui.Checkbox("Read NPC dialogue from the dialogue window", ref readFromQuestTalkAddon)) { Configuration.ReadFromQuestTalkAddon = readFromQuestTalkAddon; Configuration.Save(); } if (readFromQuestTalkAddon) { ImGui.Spacing(); ImGui.Indent(); var cancelSpeechOnTextAdvance = Configuration.CancelSpeechOnTextAdvance; if (ImGui.Checkbox("Cancel the current NPC speech when new text is available or text is advanced", ref cancelSpeechOnTextAdvance)) { Configuration.CancelSpeechOnTextAdvance = cancelSpeechOnTextAdvance; Configuration.Save(); } ImGui.Unindent(); } ImGui.Spacing(); var enableNameWithSay = Configuration.EnableNameWithSay; if (ImGui.Checkbox("Enable \"X says:\" when people speak", ref enableNameWithSay)) { Configuration.EnableNameWithSay = enableNameWithSay; Configuration.Save(); } if (enableNameWithSay) { ImGui.Spacing(); ImGui.Indent(); var nameNpcWithSay = Configuration.NameNpcWithSay; if (ImGui.Checkbox("Also say \"NPC Name says:\" in NPC dialogue", ref nameNpcWithSay)) { Configuration.NameNpcWithSay = nameNpcWithSay; Configuration.Save(); } var disallowMultipleSay = Configuration.DisallowMultipleSay; if (ImGui.Checkbox("Only say \"Character Name says:\" the first time a character speaks", ref disallowMultipleSay)) { Configuration.DisallowMultipleSay = disallowMultipleSay; Configuration.Save(); } ImGui.Unindent(); } } if (ImGui.CollapsingHeader("Voices##TTTVoicePre1", ImGuiTreeNodeFlags.DefaultOpen)) { var backends = Enum.GetNames(typeof(TTSBackend)); var backendsDisplay = backends.Select(SplitWords).ToArray(); var backend = Configuration.Backend; var backendIndex = Array.IndexOf(backends, backend.ToString()); if (ImGui.Combo("Voice backend##TTTVoicePre2", ref backendIndex, backendsDisplay, backends.Length)) { if (Enum.TryParse(backends[backendIndex], out TTSBackend newBackend)) { Configuration.Backend = newBackend; Configuration.Save(); BackendManager.SetBackend(newBackend); } else { PluginLog.Error($"Failed to parse TTS backend \"{backends[backendIndex]}\"."); } } if (!BackendManager.BackendLoading) { // Draw the settings for the specific backend we're using. BackendManager.DrawSettings(this.helpers); } } }