48 lines
1.5 KiB
C#
48 lines
1.5 KiB
C#
using System;
|
|
using System.Linq;
|
|
using Dalamud.Bindings.ImGui;
|
|
using Dalamud.Game.Text;
|
|
using Dalamud.Interface.Utility.Raii;
|
|
using Dalamud.Plugin;
|
|
using Dalamud.Utility;
|
|
|
|
namespace Questionable.Windows.ConfigComponents;
|
|
|
|
internal sealed class NotificationConfigComponent : ConfigComponent
|
|
{
|
|
public NotificationConfigComponent(IDalamudPluginInterface pluginInterface, Configuration configuration)
|
|
: base(pluginInterface, configuration)
|
|
{
|
|
}
|
|
|
|
public override void DrawTab()
|
|
{
|
|
using ImRaii.IEndObject endObject = ImRaii.TabItem("Notifications###Notifications");
|
|
if (!endObject)
|
|
{
|
|
return;
|
|
}
|
|
bool v = base.Configuration.Notifications.Enabled;
|
|
if (ImGui.Checkbox("Enable notifications when manual interaction is required", ref v))
|
|
{
|
|
base.Configuration.Notifications.Enabled = v;
|
|
Save();
|
|
}
|
|
using (ImRaii.Disabled(!base.Configuration.Notifications.Enabled))
|
|
{
|
|
using (ImRaii.PushIndent())
|
|
{
|
|
XivChatType[] array = (from x in Enum.GetValues<XivChatType>()
|
|
where x != XivChatType.StandardEmote
|
|
select x).ToArray();
|
|
int currentItem = Array.IndexOf(array, base.Configuration.Notifications.ChatType);
|
|
string[] array2 = array.Select((XivChatType t) => t.GetAttribute<XivChatTypeInfoAttribute>()?.FancyName ?? t.ToString()).ToArray();
|
|
if (ImGui.Combo((ImU8String)"Chat channel", ref currentItem, (ReadOnlySpan<string>)array2, array2.Length))
|
|
{
|
|
base.Configuration.Notifications.ChatType = array[currentItem];
|
|
Save();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|