fix settings ui, heels

This commit is contained in:
rootdarkarchon
2023-06-03 10:45:05 +02:00
parent 04ab5f6af0
commit 9bdb359391
2 changed files with 90 additions and 76 deletions

View File

@@ -34,6 +34,18 @@ public sealed class CacheCreationService : DisposableMediatorSubscriberBase
_cacheCreateLock.Release();
});
Mediator.Subscribe<ZoneSwitchStartMessage>(this, (msg) => _isZoning = true);
Mediator.Subscribe<ZoneSwitchEndMessage>(this, (msg) => _isZoning = false);
_playerRelatedObjects[ObjectKind.Player] = gameObjectHandlerFactory.Create(ObjectKind.Player, dalamudUtil.GetPlayerPointer, true)
.GetAwaiter().GetResult();
_playerRelatedObjects[ObjectKind.MinionOrMount] = gameObjectHandlerFactory.Create(ObjectKind.MinionOrMount, () => dalamudUtil.GetMinionOrMount(), true)
.GetAwaiter().GetResult();
_playerRelatedObjects[ObjectKind.Pet] = gameObjectHandlerFactory.Create(ObjectKind.Pet, () => dalamudUtil.GetPet(), true)
.GetAwaiter().GetResult();
_playerRelatedObjects[ObjectKind.Companion] = gameObjectHandlerFactory.Create(ObjectKind.Companion, () => dalamudUtil.GetCompanion(), true)
.GetAwaiter().GetResult();
Mediator.Subscribe<ClearCacheForObjectMessage>(this, (msg) =>
{
_ = Task.Run(() =>
@@ -45,9 +57,6 @@ public sealed class CacheCreationService : DisposableMediatorSubscriberBase
});
});
Mediator.Subscribe<ZoneSwitchStartMessage>(this, (msg) => _isZoning = true);
Mediator.Subscribe<ZoneSwitchEndMessage>(this, (msg) => _isZoning = false);
Mediator.Subscribe<CustomizePlusMessage>(this, async (_) =>
{
if (_isZoning) return;
@@ -84,15 +93,6 @@ public sealed class CacheCreationService : DisposableMediatorSubscriberBase
await AddPlayerCacheToCreate().ConfigureAwait(false);
});
_playerRelatedObjects[ObjectKind.Player] = gameObjectHandlerFactory.Create(ObjectKind.Player, dalamudUtil.GetPlayerPointer, true)
.GetAwaiter().GetResult();
_playerRelatedObjects[ObjectKind.MinionOrMount] = gameObjectHandlerFactory.Create(ObjectKind.MinionOrMount, () => dalamudUtil.GetMinionOrMount(), true)
.GetAwaiter().GetResult();
_playerRelatedObjects[ObjectKind.Pet] = gameObjectHandlerFactory.Create(ObjectKind.Pet, () => dalamudUtil.GetPet(), true)
.GetAwaiter().GetResult();
_playerRelatedObjects[ObjectKind.Companion] = gameObjectHandlerFactory.Create(ObjectKind.Companion, () => dalamudUtil.GetCompanion(), true)
.GetAwaiter().GetResult();
Mediator.Subscribe<DelayedFrameworkUpdateMessage>(this, (msg) => ProcessCacheCreation());
}

View File

@@ -759,6 +759,8 @@ public class SettingsUi : WindowMediatorSubscriberBase
if (ImGui.BeginTabBar("serverTabBar"))
{
if (ImGui.BeginTabItem("Character Management"))
{
if (selectedServer.SecretKeys.Any())
{
UiSharedService.ColorTextWrapped("Characters listed here will automatically connect to the selected Mare service with the settings as provided below." +
" Make sure to enter the character names correctly or use the 'Add current character' button at the bottom.", ImGuiColors.DalamudYellow);
@@ -837,6 +839,11 @@ public class SettingsUi : WindowMediatorSubscriberBase
{
_serverConfigurationManager.AddEmptyCharacterToServer(idx);
}
}
else
{
UiSharedService.ColorTextWrapped("You need to add a Secret Key first before adding Characters.", ImGuiColors.DalamudYellow);
}
ImGui.EndTabItem();
}
@@ -859,12 +866,19 @@ public class SettingsUi : WindowMediatorSubscriberBase
item.Value.Key = key;
_serverConfigurationManager.Save();
}
if (!selectedServer.Authentications.Any(p => p.SecretKeyIdx == item.Key))
{
if (UiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Delete Secret Key") && UiSharedService.CtrlPressed())
{
selectedServer.SecretKeys.Remove(item.Key);
_serverConfigurationManager.Save();
}
UiSharedService.AttachToolTip("Hold CTRL to delete this secret key entry");
}
else
{
UiSharedService.ColorTextWrapped("This key is in use and cannot be deleted", ImGuiColors.DalamudYellow);
}
});
if (item.Key != selectedServer.SecretKeys.Keys.LastOrDefault())