feat: add chat database
This commit is contained in:
@@ -29,7 +29,7 @@ internal sealed class About : ISettingsTab {
|
||||
this._translators.Sort((a, b) => string.Compare(a.ToLowerInvariant(), b.ToLowerInvariant(), StringComparison.Ordinal));
|
||||
}
|
||||
|
||||
public void Draw() {
|
||||
public void Draw(bool changed) {
|
||||
ImGui.PushTextWrapPos();
|
||||
|
||||
ImGui.TextUnformatted(string.Format(Language.Options_About_Opening, Plugin.PluginName));
|
||||
|
||||
@@ -32,7 +32,7 @@ internal sealed class ChatColours : ISettingsTab {
|
||||
#endif
|
||||
}
|
||||
|
||||
public void Draw() {
|
||||
public void Draw(bool changed) {
|
||||
foreach (var (_, types) in ChatTypeExt.SortOrder) {
|
||||
foreach (var type in types) {
|
||||
if (ImGuiUtil.IconButton(FontAwesomeIcon.UndoAlt, $"{type}", Language.Options_ChatColours_Reset)) {
|
||||
|
||||
Executable
+60
@@ -0,0 +1,60 @@
|
||||
using ChatTwo.Resources;
|
||||
using ChatTwo.Util;
|
||||
using ImGuiNET;
|
||||
|
||||
namespace ChatTwo.Ui.SettingsTabs;
|
||||
|
||||
internal sealed class Database : ISettingsTab {
|
||||
private Configuration Mutable { get; }
|
||||
private Store Store { get; }
|
||||
|
||||
public string Name => Language.Options_Database_Tab + "###tabs-database";
|
||||
|
||||
internal Database(Configuration mutable, Store store) {
|
||||
this.Store = store;
|
||||
this.Mutable = mutable;
|
||||
}
|
||||
|
||||
private bool _showAdvanced;
|
||||
|
||||
public void Draw(bool changed) {
|
||||
if (changed) {
|
||||
this._showAdvanced = ImGui.GetIO().KeyShift;
|
||||
}
|
||||
|
||||
ImGuiUtil.OptionCheckbox(ref this.Mutable.DatabaseBattleMessages, Language.Options_DatabaseBattleMessages_Name, Language.Options_DatabaseBattleMessages_Description);
|
||||
ImGui.Spacing();
|
||||
|
||||
if (ImGuiUtil.OptionCheckbox(ref this.Mutable.LoadPreviousSession, Language.Options_LoadPreviousSession_Name, Language.Options_LoadPreviousSession_Description)) {
|
||||
if (this.Mutable.LoadPreviousSession) {
|
||||
this.Mutable.FilterIncludePreviousSessions = true;
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.Spacing();
|
||||
|
||||
if (ImGuiUtil.OptionCheckbox(ref this.Mutable.FilterIncludePreviousSessions, Language.Options_FilterIncludePreviousSessions_Name, Language.Options_FilterIncludePreviousSessions_Description)) {
|
||||
if (!this.Mutable.FilterIncludePreviousSessions) {
|
||||
this.Mutable.LoadPreviousSession = false;
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.Spacing();
|
||||
|
||||
if (this._showAdvanced && ImGui.TreeNodeEx("Advanced")) {
|
||||
ImGui.PushTextWrapPos();
|
||||
ImGuiUtil.WarningText("Do not click these buttons unless you know what you're doing.");
|
||||
|
||||
if (ImGui.Button("Checkpoint")) {
|
||||
this.Store.Database.Checkpoint();
|
||||
}
|
||||
|
||||
if (ImGui.Button("Rebuild")) {
|
||||
this.Store.Database.Rebuild();
|
||||
}
|
||||
|
||||
ImGui.PopTextWrapPos();
|
||||
ImGui.TreePop();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ internal sealed class Display : ISettingsTab {
|
||||
this.Mutable = mutable;
|
||||
}
|
||||
|
||||
public void Draw() {
|
||||
public void Draw(bool changed) {
|
||||
ImGui.PushTextWrapPos();
|
||||
|
||||
ImGuiUtil.OptionCheckbox(ref this.Mutable.HideChat, Language.Options_HideChat_Name, Language.Options_HideChat_Description);
|
||||
|
||||
@@ -21,8 +21,8 @@ public class Fonts : ISettingsTab {
|
||||
this.JpFonts = Ui.Fonts.GetJpFonts();
|
||||
}
|
||||
|
||||
public void Draw() {
|
||||
if (ImGui.IsWindowAppearing()) {
|
||||
public void Draw(bool changed) {
|
||||
if (changed) {
|
||||
this.UpdateFonts();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
|
||||
internal interface ISettingsTab {
|
||||
string Name { get; }
|
||||
void Draw();
|
||||
void Draw(bool changed);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ internal sealed class Miscellaneous : ISettingsTab {
|
||||
this.Mutable = mutable;
|
||||
}
|
||||
|
||||
public void Draw() {
|
||||
public void Draw(bool changed) {
|
||||
if (ImGuiUtil.BeginComboVertical(Language.Options_Language_Name, this.Mutable.LanguageOverride.Name())) {
|
||||
foreach (var language in Enum.GetValues<LanguageOverride>()) {
|
||||
if (ImGui.Selectable(language.Name())) {
|
||||
|
||||
@@ -17,7 +17,7 @@ internal sealed class Tabs : ISettingsTab {
|
||||
this.Mutable = mutable;
|
||||
}
|
||||
|
||||
public void Draw() {
|
||||
public void Draw(bool changed) {
|
||||
const string addTabPopup = "add-tab-popup";
|
||||
|
||||
if (ImGuiUtil.IconButton(FontAwesomeIcon.Plus, tooltip: Language.Options_Tabs_Add)) {
|
||||
|
||||
Reference in New Issue
Block a user