Merge branch 'main' of https://github.com/Penumbra-Sync/client
This commit is contained in:
@@ -12,6 +12,7 @@ public class MareConfig : IMareConfiguration
|
|||||||
public bool EnableDtrEntry { get; set; } = false;
|
public bool EnableDtrEntry { get; set; } = false;
|
||||||
public bool ShowUidInDtrTooltip { get; set; } = true;
|
public bool ShowUidInDtrTooltip { get; set; } = true;
|
||||||
public bool PreferNoteInDtrTooltip { get; set; } = false;
|
public bool PreferNoteInDtrTooltip { get; set; } = false;
|
||||||
|
public bool UseColorsInDtr { get; set; } = true;
|
||||||
public bool EnableRightClickMenus { get; set; } = true;
|
public bool EnableRightClickMenus { get; set; } = true;
|
||||||
public NotificationLocation ErrorNotification { get; set; } = NotificationLocation.Both;
|
public NotificationLocation ErrorNotification { get; set; } = NotificationLocation.Both;
|
||||||
public string ExportFolder { get; set; } = string.Empty;
|
public string ExportFolder { get; set; } = string.Empty;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Dalamud.Game.Gui.Dtr;
|
using Dalamud.Game.Gui.Dtr;
|
||||||
|
using Dalamud.Game.Text.SeStringHandling;
|
||||||
using Dalamud.Plugin.Services;
|
using Dalamud.Plugin.Services;
|
||||||
using MareSynchronos.MareConfiguration;
|
using MareSynchronos.MareConfiguration;
|
||||||
using MareSynchronos.MareConfiguration.Configurations;
|
using MareSynchronos.MareConfiguration.Configurations;
|
||||||
@@ -22,6 +23,8 @@ public sealed class DtrEntry : IDisposable, IHostedService
|
|||||||
private readonly PairManager _pairManager;
|
private readonly PairManager _pairManager;
|
||||||
private Task? _runTask;
|
private Task? _runTask;
|
||||||
private string? _text;
|
private string? _text;
|
||||||
|
private string? _tooltip;
|
||||||
|
private StatusColorId _color;
|
||||||
|
|
||||||
public DtrEntry(ILogger<DtrEntry> logger, IDtrBar dtrBar, ConfigurationServiceBase<MareConfig> configService, MareMediator mareMediator, PairManager pairManager, ApiController apiController)
|
public DtrEntry(ILogger<DtrEntry> logger, IDtrBar dtrBar, ConfigurationServiceBase<MareConfig> configService, MareMediator mareMediator, PairManager pairManager, ApiController apiController)
|
||||||
{
|
{
|
||||||
@@ -74,6 +77,8 @@ public sealed class DtrEntry : IDisposable, IHostedService
|
|||||||
if (!_entry.IsValueCreated) return;
|
if (!_entry.IsValueCreated) return;
|
||||||
_logger.LogInformation("Clearing entry");
|
_logger.LogInformation("Clearing entry");
|
||||||
_text = null;
|
_text = null;
|
||||||
|
_tooltip = null;
|
||||||
|
_color = default;
|
||||||
|
|
||||||
_entry.Value.Shown = false;
|
_entry.Value.Shown = false;
|
||||||
}
|
}
|
||||||
@@ -118,6 +123,7 @@ public sealed class DtrEntry : IDisposable, IHostedService
|
|||||||
|
|
||||||
string text;
|
string text;
|
||||||
string tooltip;
|
string tooltip;
|
||||||
|
StatusColorId color;
|
||||||
if (_apiController.IsConnected)
|
if (_apiController.IsConnected)
|
||||||
{
|
{
|
||||||
var pairCount = _pairManager.GetVisibleUserCount();
|
var pairCount = _pairManager.GetVisibleUserCount();
|
||||||
@@ -139,23 +145,41 @@ public sealed class DtrEntry : IDisposable, IHostedService
|
|||||||
}
|
}
|
||||||
|
|
||||||
tooltip = $"Mare Synchronos: Connected{Environment.NewLine}----------{Environment.NewLine}{string.Join(Environment.NewLine, visiblePairs)}";
|
tooltip = $"Mare Synchronos: Connected{Environment.NewLine}----------{Environment.NewLine}{string.Join(Environment.NewLine, visiblePairs)}";
|
||||||
|
color = StatusColorId.PairsInRange;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tooltip = "Mare Synchronos: Connected";
|
tooltip = "Mare Synchronos: Connected";
|
||||||
|
color = default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
text = "\uE044 \uE04C";
|
text = "\uE044 \uE04C";
|
||||||
tooltip = "Mare Synchronos: Not Connected";
|
tooltip = "Mare Synchronos: Not Connected";
|
||||||
|
color = StatusColorId.NotConnected;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.Equals(text, _text, StringComparison.Ordinal))
|
if (!_configService.Current.UseColorsInDtr)
|
||||||
|
color = default;
|
||||||
|
|
||||||
|
if (!string.Equals(text, _text, StringComparison.Ordinal) || !string.Equals(tooltip, _tooltip, StringComparison.Ordinal) || color != _color)
|
||||||
{
|
{
|
||||||
_text = text;
|
_text = text;
|
||||||
_entry.Value.Text = text;
|
_tooltip = tooltip;
|
||||||
|
_color = color;
|
||||||
|
_entry.Value.Text = color != default ? BuildColoredSeString(text, color) : text;
|
||||||
_entry.Value.Tooltip = tooltip;
|
_entry.Value.Tooltip = tooltip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static SeString BuildColoredSeString(string text, StatusColorId color)
|
||||||
|
=> new SeStringBuilder().AddUiGlow(text, (ushort)color).Build();
|
||||||
|
|
||||||
|
private enum StatusColorId : ushort
|
||||||
|
{
|
||||||
|
None = default,
|
||||||
|
NotConnected = 518,
|
||||||
|
PairsInRange = 526,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -731,6 +731,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
|||||||
var enableDtrEntry = _configService.Current.EnableDtrEntry;
|
var enableDtrEntry = _configService.Current.EnableDtrEntry;
|
||||||
var showUidInDtrTooltip = _configService.Current.ShowUidInDtrTooltip;
|
var showUidInDtrTooltip = _configService.Current.ShowUidInDtrTooltip;
|
||||||
var preferNoteInDtrTooltip = _configService.Current.PreferNoteInDtrTooltip;
|
var preferNoteInDtrTooltip = _configService.Current.PreferNoteInDtrTooltip;
|
||||||
|
var useColorsInDtr = _configService.Current.UseColorsInDtr;
|
||||||
var preferNotesInsteadOfName = _configService.Current.PreferNotesOverNamesForVisible;
|
var preferNotesInsteadOfName = _configService.Current.PreferNotesOverNamesForVisible;
|
||||||
var groupUpSyncshells = _configService.Current.GroupUpSyncshells;
|
var groupUpSyncshells = _configService.Current.GroupUpSyncshells;
|
||||||
var groupInVisible = _configService.Current.ShowSyncshellUsersInVisible;
|
var groupInVisible = _configService.Current.ShowSyncshellUsersInVisible;
|
||||||
@@ -764,6 +765,12 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
|||||||
_configService.Current.PreferNoteInDtrTooltip = preferNoteInDtrTooltip;
|
_configService.Current.PreferNoteInDtrTooltip = preferNoteInDtrTooltip;
|
||||||
_configService.Save();
|
_configService.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ImGui.Checkbox("Color-code the Server Info Bar entry according to status", ref useColorsInDtr))
|
||||||
|
{
|
||||||
|
_configService.Current.UseColorsInDtr = useColorsInDtr;
|
||||||
|
_configService.Save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui.Checkbox("Show separate Visible group", ref showVisibleSeparate))
|
if (ImGui.Checkbox("Show separate Visible group", ref showVisibleSeparate))
|
||||||
|
|||||||
Reference in New Issue
Block a user