♻️ ConfigWindow: move tab logic into separate methods
This commit is contained in:
parent
aa4f28b4fd
commit
976bfcbe2c
@ -65,123 +65,9 @@ namespace Pal.Client.Windows
|
||||
bool saveAndClose = false;
|
||||
if (ImGui.BeginTabBar("PalTabs"))
|
||||
{
|
||||
if (ImGui.BeginTabItem("PotD/HoH"))
|
||||
{
|
||||
ImGui.Checkbox("Show traps", ref _showTraps);
|
||||
ImGui.Indent();
|
||||
ImGui.BeginDisabled(!_showTraps);
|
||||
ImGui.Spacing();
|
||||
ImGui.ColorEdit4("Trap color", ref _trapColor, ImGuiColorEditFlags.NoInputs);
|
||||
ImGui.Checkbox("Hide traps not on current floor", ref _onlyVisibleTrapsAfterPomander);
|
||||
ImGui.SameLine();
|
||||
ImGuiComponents.HelpMarker("When using a Pomander of sight, only the actual trap locations are visible, all other traps are hidden.");
|
||||
ImGui.EndDisabled();
|
||||
ImGui.Unindent();
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
ImGui.Checkbox("Show hoard coffers", ref _showHoard);
|
||||
ImGui.Indent();
|
||||
ImGui.BeginDisabled(!_showHoard);
|
||||
ImGui.Spacing();
|
||||
ImGui.ColorEdit4("Hoard Coffer color", ref _hoardColor, ImGuiColorEditFlags.NoInputs);
|
||||
ImGui.Checkbox("Hide hoard coffers not on current floor", ref _onlyVisibleHoardAfterPomander);
|
||||
ImGui.SameLine();
|
||||
ImGuiComponents.HelpMarker("When using a Pomander of intuition, only the actual hoard coffer location is visible, all other (potential) hoard coffers are hidden.");
|
||||
ImGui.EndDisabled();
|
||||
ImGui.Unindent();
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
ImGui.Checkbox("Show silver coffers on current floor", ref _showSilverCoffers);
|
||||
ImGuiComponents.HelpMarker("Shows all the silver coffers visible to you on the current floor.\nThis is not synchronized with other players and not saved between floors/runs.\n\nExperimental feature.");
|
||||
ImGui.Indent();
|
||||
ImGui.BeginDisabled(!_showSilverCoffers);
|
||||
ImGui.Spacing();
|
||||
ImGui.ColorEdit4("Silver Coffer color", ref _silverCofferColor, ImGuiColorEditFlags.NoInputs);
|
||||
ImGui.Checkbox("Draw filled", ref _fillSilverCoffers);
|
||||
ImGui.EndDisabled();
|
||||
ImGui.Unindent();
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
save = ImGui.Button("Save");
|
||||
ImGui.SameLine();
|
||||
saveAndClose = ImGui.Button("Save & Close");
|
||||
|
||||
ImGui.EndTabItem();
|
||||
}
|
||||
|
||||
if (BeginTabItemEx("Community", _switchToCommunityTab ? ImGuiTabItemFlags.SetSelected : ImGuiTabItemFlags.None))
|
||||
{
|
||||
_switchToCommunityTab = false;
|
||||
|
||||
ImGui.TextWrapped("Ideally, we want to discover every potential trap and chest location in the game, but doing this alone is very tedious. Floor 51-60 has over 230 trap locations and over 200 coffer locations - and we don't know if that map is complete. Higher floors naturally see fewer runs, making solo attempts to map the place much harder.");
|
||||
ImGui.TextWrapped("You can decide whether you want to share traps and chests you find with the community, which likewise also will let you see chests and coffers found by other players. This can be changed at any time. No data regarding your FFXIV character or account is ever sent to our server.");
|
||||
|
||||
ImGui.RadioButton("Upload my discoveries, show traps & coffers other players have discovered", ref _mode, (int)Configuration.EMode.Online);
|
||||
ImGui.RadioButton("Never upload discoveries, show only traps and coffers I found myself", ref _mode, (int)Configuration.EMode.Offline);
|
||||
saveAndClose = ImGui.Button("Save & Close");
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
ImGui.BeginDisabled(Service.Configuration.Mode != Configuration.EMode.Online);
|
||||
if (ImGui.Button("Test Connection"))
|
||||
TestConnection();
|
||||
|
||||
if (_connectionText != null)
|
||||
ImGui.Text(_connectionText);
|
||||
|
||||
ImGui.EndDisabled();
|
||||
ImGui.EndTabItem();
|
||||
}
|
||||
|
||||
if (ImGui.BeginTabItem("Debug"))
|
||||
{
|
||||
var plugin = Service.Plugin;
|
||||
if (plugin.IsInDeepDungeon())
|
||||
{
|
||||
ImGui.Text($"You are in a deep dungeon, territory type {plugin.LastTerritory}.");
|
||||
ImGui.Text($"Sync State = {plugin.TerritorySyncState}");
|
||||
ImGui.Text($"{plugin.DebugMessage}");
|
||||
|
||||
ImGui.Indent();
|
||||
if (plugin.FloorMarkers.TryGetValue(plugin.LastTerritory, out var currentFloor))
|
||||
{
|
||||
if (_showTraps)
|
||||
{
|
||||
int traps = currentFloor.Markers.Count(x => x.Type == Marker.EType.Trap);
|
||||
ImGui.Text($"{traps} known trap{(traps == 1 ? "" : "s")}");
|
||||
}
|
||||
if (_showHoard)
|
||||
{
|
||||
int hoardCoffers = currentFloor.Markers.Count(x => x.Type == Marker.EType.Hoard);
|
||||
ImGui.Text($"{hoardCoffers} known hoard coffer{(hoardCoffers == 1 ? "" : "s")}");
|
||||
}
|
||||
if (_showSilverCoffers)
|
||||
{
|
||||
int silverCoffers = plugin.EphemeralMarkers.Count(x => x.Type == Marker.EType.SilverCoffer);
|
||||
ImGui.Text($"{silverCoffers} silver coffer{(silverCoffers == 1 ? "" : "s")} visible on current floor");
|
||||
}
|
||||
|
||||
ImGui.Text($"Pomander of Sight: {plugin.PomanderOfSight}");
|
||||
ImGui.Text($"Pomander of Intuition: {plugin.PomanderOfIntuition}");
|
||||
}
|
||||
else
|
||||
ImGui.Text("Could not query current trap/coffer count.");
|
||||
ImGui.Unindent();
|
||||
ImGui.TextWrapped("Traps and coffers may not be discovered even after using a pomander if they're far away (around 1,5-2 rooms).");
|
||||
}
|
||||
else
|
||||
ImGui.Text("You are NOT in a deep dungeon.");
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
if (ImGui.Button("Draw trap & coffer circles around self"))
|
||||
DrawDebugItems();
|
||||
|
||||
ImGui.EndTabItem();
|
||||
}
|
||||
DrawTrapCofferTab(ref save, ref saveAndClose);
|
||||
DrawCommunityTab(ref saveAndClose);
|
||||
DrawDebugTab();
|
||||
|
||||
ImGui.EndTabBar();
|
||||
}
|
||||
@ -206,6 +92,133 @@ namespace Pal.Client.Windows
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawTrapCofferTab(ref bool save, ref bool saveAndClose)
|
||||
{
|
||||
if (ImGui.BeginTabItem("PotD/HoH"))
|
||||
{
|
||||
ImGui.Checkbox("Show traps", ref _showTraps);
|
||||
ImGui.Indent();
|
||||
ImGui.BeginDisabled(!_showTraps);
|
||||
ImGui.Spacing();
|
||||
ImGui.ColorEdit4("Trap color", ref _trapColor, ImGuiColorEditFlags.NoInputs);
|
||||
ImGui.Checkbox("Hide traps not on current floor", ref _onlyVisibleTrapsAfterPomander);
|
||||
ImGui.SameLine();
|
||||
ImGuiComponents.HelpMarker("When using a Pomander of sight, only the actual trap locations are visible, all other traps are hidden.");
|
||||
ImGui.EndDisabled();
|
||||
ImGui.Unindent();
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
ImGui.Checkbox("Show hoard coffers", ref _showHoard);
|
||||
ImGui.Indent();
|
||||
ImGui.BeginDisabled(!_showHoard);
|
||||
ImGui.Spacing();
|
||||
ImGui.ColorEdit4("Hoard Coffer color", ref _hoardColor, ImGuiColorEditFlags.NoInputs);
|
||||
ImGui.Checkbox("Hide hoard coffers not on current floor", ref _onlyVisibleHoardAfterPomander);
|
||||
ImGui.SameLine();
|
||||
ImGuiComponents.HelpMarker("When using a Pomander of intuition, only the actual hoard coffer location is visible, all other (potential) hoard coffers are hidden.");
|
||||
ImGui.EndDisabled();
|
||||
ImGui.Unindent();
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
ImGui.Checkbox("Show silver coffers on current floor", ref _showSilverCoffers);
|
||||
ImGuiComponents.HelpMarker("Shows all the silver coffers visible to you on the current floor.\nThis is not synchronized with other players and not saved between floors/runs.\n\nExperimental feature.");
|
||||
ImGui.Indent();
|
||||
ImGui.BeginDisabled(!_showSilverCoffers);
|
||||
ImGui.Spacing();
|
||||
ImGui.ColorEdit4("Silver Coffer color", ref _silverCofferColor, ImGuiColorEditFlags.NoInputs);
|
||||
ImGui.Checkbox("Draw filled", ref _fillSilverCoffers);
|
||||
ImGui.EndDisabled();
|
||||
ImGui.Unindent();
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
save = ImGui.Button("Save");
|
||||
ImGui.SameLine();
|
||||
saveAndClose = ImGui.Button("Save & Close");
|
||||
|
||||
ImGui.EndTabItem();
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawCommunityTab(ref bool saveAndClose)
|
||||
{
|
||||
if (BeginTabItemEx("Community", _switchToCommunityTab ? ImGuiTabItemFlags.SetSelected : ImGuiTabItemFlags.None))
|
||||
{
|
||||
_switchToCommunityTab = false;
|
||||
|
||||
ImGui.TextWrapped("Ideally, we want to discover every potential trap and chest location in the game, but doing this alone is very tedious. Floor 51-60 has over 230 trap locations and over 200 coffer locations - and we don't know if that map is complete. Higher floors naturally see fewer runs, making solo attempts to map the place much harder.");
|
||||
ImGui.TextWrapped("You can decide whether you want to share traps and chests you find with the community, which likewise also will let you see chests and coffers found by other players. This can be changed at any time. No data regarding your FFXIV character or account is ever sent to our server.");
|
||||
|
||||
ImGui.RadioButton("Upload my discoveries, show traps & coffers other players have discovered", ref _mode, (int)Configuration.EMode.Online);
|
||||
ImGui.RadioButton("Never upload discoveries, show only traps and coffers I found myself", ref _mode, (int)Configuration.EMode.Offline);
|
||||
saveAndClose = ImGui.Button("Save & Close");
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
ImGui.BeginDisabled(Service.Configuration.Mode != Configuration.EMode.Online);
|
||||
if (ImGui.Button("Test Connection"))
|
||||
TestConnection();
|
||||
|
||||
if (_connectionText != null)
|
||||
ImGui.Text(_connectionText);
|
||||
|
||||
ImGui.EndDisabled();
|
||||
ImGui.EndTabItem();
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawDebugTab()
|
||||
{
|
||||
if (ImGui.BeginTabItem("Debug"))
|
||||
{
|
||||
var plugin = Service.Plugin;
|
||||
if (plugin.IsInDeepDungeon())
|
||||
{
|
||||
ImGui.Text($"You are in a deep dungeon, territory type {plugin.LastTerritory}.");
|
||||
ImGui.Text($"Sync State = {plugin.TerritorySyncState}");
|
||||
ImGui.Text($"{plugin.DebugMessage}");
|
||||
|
||||
ImGui.Indent();
|
||||
if (plugin.FloorMarkers.TryGetValue(plugin.LastTerritory, out var currentFloor))
|
||||
{
|
||||
if (_showTraps)
|
||||
{
|
||||
int traps = currentFloor.Markers.Count(x => x.Type == Marker.EType.Trap);
|
||||
ImGui.Text($"{traps} known trap{(traps == 1 ? "" : "s")}");
|
||||
}
|
||||
if (_showHoard)
|
||||
{
|
||||
int hoardCoffers = currentFloor.Markers.Count(x => x.Type == Marker.EType.Hoard);
|
||||
ImGui.Text($"{hoardCoffers} known hoard coffer{(hoardCoffers == 1 ? "" : "s")}");
|
||||
}
|
||||
if (_showSilverCoffers)
|
||||
{
|
||||
int silverCoffers = plugin.EphemeralMarkers.Count(x => x.Type == Marker.EType.SilverCoffer);
|
||||
ImGui.Text($"{silverCoffers} silver coffer{(silverCoffers == 1 ? "" : "s")} visible on current floor");
|
||||
}
|
||||
|
||||
ImGui.Text($"Pomander of Sight: {plugin.PomanderOfSight}");
|
||||
ImGui.Text($"Pomander of Intuition: {plugin.PomanderOfIntuition}");
|
||||
}
|
||||
else
|
||||
ImGui.Text("Could not query current trap/coffer count.");
|
||||
ImGui.Unindent();
|
||||
ImGui.TextWrapped("Traps and coffers may not be discovered even after using a pomander if they're far away (around 1,5-2 rooms).");
|
||||
}
|
||||
else
|
||||
ImGui.Text("You are NOT in a deep dungeon.");
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
if (ImGui.Button("Draw trap & coffer circles around self"))
|
||||
DrawDebugItems();
|
||||
|
||||
ImGui.EndTabItem();
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawDebugItems()
|
||||
{
|
||||
try
|
||||
|
Loading…
Reference in New Issue
Block a user