Skip to content

Commit

Permalink
Add Dalamud synchronized server info bar configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Limiana committed Nov 8, 2023
1 parent 4e6e7cf commit 0cef58a
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions YesAlready/UI/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
using PunishLib.ImGuiMethods;
using Dalamud.Interface.Colors;
using ECommons;
using ECommons.Reflection;
using System.Collections.Generic;

namespace YesAlready.UI;

Expand Down Expand Up @@ -86,6 +88,7 @@ public override void Draw()
DisplayListOptions();
DisplayTalkOptions();
DisplayBotherOptions();
DisplayDTROptions();

//if (ImGui.BeginTabItem("About"))
//{
Expand Down Expand Up @@ -130,6 +133,41 @@ private void UiBuilder_TestButton()

// ====================================================================================================

private void DisplayDTROptions()
{
if (!ImGui.BeginTabItem("Server info bar"))
return;

ImGui.PushID("Server info bar");

try
{
var config = DalamudReflector.GetService("Dalamud.Configuration.Internal.DalamudConfiguration");
var dtrList = config.GetFoP<List<string>>("DtrIgnore");
var enabled = !dtrList.Contains(Svc.PluginInterface.InternalName);
if(ImGui.Checkbox("Enable", ref enabled))
{
if(enabled)
{
dtrList.Remove(Svc.PluginInterface.InternalName);
}
else
{
dtrList.Add(Svc.PluginInterface.InternalName);
}
config.Call("QueueSave");
}
}
catch(Exception e)
{
ImGuiEx.TextWrapped(ImGuiColors.DalamudRed, $"{e}");
}

ImGui.PopID();

ImGui.EndTabItem();
}

private void DisplayTextOptions()
{
if (!ImGui.BeginTabItem("YesNo"))
Expand Down

0 comments on commit 0cef58a

Please sign in to comment.