CustomizePlus+ -> Customize+, make characters collapsible in Character Management
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
namespace MareSynchronos.MareConfiguration;
|
namespace MareSynchronos.MareConfiguration;
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class Authentication
|
public record Authentication
|
||||||
{
|
{
|
||||||
public string CharacterName { get; set; } = string.Empty;
|
public string CharacterName { get; set; } = string.Empty;
|
||||||
public uint WorldId { get; set; } = 0;
|
public uint WorldId { get; set; } = 0;
|
||||||
|
|||||||
@@ -252,31 +252,13 @@ public class SettingsUi : Window, IDisposable
|
|||||||
{
|
{
|
||||||
UiShared.DrawWithID("selectedChara" + i, () =>
|
UiShared.DrawWithID("selectedChara" + i, () =>
|
||||||
{
|
{
|
||||||
var charaName = item.CharacterName;
|
|
||||||
if (ImGui.InputText("Character Name", ref charaName, 64))
|
|
||||||
{
|
|
||||||
item.CharacterName = charaName;
|
|
||||||
_serverConfigurationManager.Save();
|
|
||||||
}
|
|
||||||
var worldIdx = (ushort)item.WorldId;
|
var worldIdx = (ushort)item.WorldId;
|
||||||
var data = _uiShared.WorldData.OrderBy(u => u.Value, StringComparer.Ordinal).ToDictionary(k => k.Key, k => k.Value);
|
var data = _uiShared.WorldData.OrderBy(u => u.Value, StringComparer.Ordinal).ToDictionary(k => k.Key, k => k.Value);
|
||||||
if (!data.TryGetValue(worldIdx, out string? worldPreview))
|
if (!data.TryGetValue(worldIdx, out string? worldPreview))
|
||||||
{
|
{
|
||||||
worldPreview = data.First().Value;
|
worldPreview = data.First().Value;
|
||||||
}
|
}
|
||||||
if (ImGui.BeginCombo("World", worldPreview))
|
|
||||||
{
|
|
||||||
foreach (var world in data)
|
|
||||||
{
|
|
||||||
bool isSelected = worldIdx == world.Key;
|
|
||||||
if (ImGui.Selectable(world.Value, isSelected))
|
|
||||||
{
|
|
||||||
item.WorldId = world.Key;
|
|
||||||
_serverConfigurationManager.Save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ImGui.EndCombo();
|
|
||||||
}
|
|
||||||
var secretKeyIdx = item.SecretKeyIdx;
|
var secretKeyIdx = item.SecretKeyIdx;
|
||||||
var keys = selectedServer.SecretKeys;
|
var keys = selectedServer.SecretKeys;
|
||||||
if (!keys.TryGetValue(secretKeyIdx, out var secretKey))
|
if (!keys.TryGetValue(secretKeyIdx, out var secretKey))
|
||||||
@@ -284,29 +266,53 @@ public class SettingsUi : Window, IDisposable
|
|||||||
secretKey = new();
|
secretKey = new();
|
||||||
}
|
}
|
||||||
var friendlyName = secretKey.FriendlyName;
|
var friendlyName = secretKey.FriendlyName;
|
||||||
if (ImGui.BeginCombo("Secret Key", friendlyName))
|
|
||||||
|
if (ImGui.TreeNode($"chara", $"Character: {item.CharacterName}, World: {worldPreview}, Secret Key: {friendlyName}"))
|
||||||
{
|
{
|
||||||
foreach (var kvp in keys)
|
var charaName = item.CharacterName;
|
||||||
|
if (ImGui.InputText("Character Name", ref charaName, 64))
|
||||||
{
|
{
|
||||||
bool isSelected = kvp.Key == secretKeyIdx;
|
item.CharacterName = charaName;
|
||||||
if (ImGui.Selectable(kvp.Value.FriendlyName, isSelected))
|
_serverConfigurationManager.Save();
|
||||||
{
|
|
||||||
item.SecretKeyIdx = kvp.Key;
|
|
||||||
_serverConfigurationManager.Save();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ImGui.EndCombo();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (UiShared.IconTextButton(FontAwesomeIcon.Trash, "Delete Character"))
|
if (ImGui.BeginCombo("World", worldPreview))
|
||||||
{
|
{
|
||||||
if (UiShared.CtrlPressed())
|
foreach (var world in data)
|
||||||
_serverConfigurationManager.RemoveCharacterFromServer(idx, item);
|
{
|
||||||
}
|
bool isSelected = worldIdx == world.Key;
|
||||||
UiShared.AttachToolTip("Hold CTRL to delete this entry.");
|
if (ImGui.Selectable(world.Value, isSelected))
|
||||||
|
{
|
||||||
|
item.WorldId = world.Key;
|
||||||
|
_serverConfigurationManager.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui.EndCombo();
|
||||||
|
}
|
||||||
|
|
||||||
if (item != selectedServer.Authentications.LastOrDefault())
|
if (ImGui.BeginCombo("Secret Key", friendlyName))
|
||||||
ImGui.Separator();
|
{
|
||||||
|
foreach (var kvp in keys)
|
||||||
|
{
|
||||||
|
bool isSelected = kvp.Key == secretKeyIdx;
|
||||||
|
if (ImGui.Selectable(kvp.Value.FriendlyName, isSelected))
|
||||||
|
{
|
||||||
|
item.SecretKeyIdx = kvp.Key;
|
||||||
|
_serverConfigurationManager.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui.EndCombo();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (UiShared.IconTextButton(FontAwesomeIcon.Trash, "Delete Character"))
|
||||||
|
{
|
||||||
|
if (UiShared.CtrlPressed())
|
||||||
|
_serverConfigurationManager.RemoveCharacterFromServer(idx, item);
|
||||||
|
}
|
||||||
|
UiShared.AttachToolTip("Hold CTRL to delete this entry.");
|
||||||
|
|
||||||
|
ImGui.TreePop();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ public partial class UiShared : IDisposable
|
|||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGui.TextColored(customizeColor, customizeExists ? "Available" : "Unavailable");
|
ImGui.TextColored(customizeColor, customizeExists ? "Available" : "Unavailable");
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGui.Text("PalettePlus+:");
|
ImGui.Text("Palette+:");
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGui.TextColored(paletteColor, paletteExists ? "Available" : "Unavailable");
|
ImGui.TextColored(paletteColor, paletteExists ? "Available" : "Unavailable");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user