♻️ ConfigWindow: move tab logic into separate methods
This commit is contained in:
parent
aa4f28b4fd
commit
976bfcbe2c
@ -64,6 +64,35 @@ namespace Pal.Client.Windows
|
|||||||
bool save = false;
|
bool save = false;
|
||||||
bool saveAndClose = false;
|
bool saveAndClose = false;
|
||||||
if (ImGui.BeginTabBar("PalTabs"))
|
if (ImGui.BeginTabBar("PalTabs"))
|
||||||
|
{
|
||||||
|
DrawTrapCofferTab(ref save, ref saveAndClose);
|
||||||
|
DrawCommunityTab(ref saveAndClose);
|
||||||
|
DrawDebugTab();
|
||||||
|
|
||||||
|
ImGui.EndTabBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (save || saveAndClose)
|
||||||
|
{
|
||||||
|
var config = Service.Configuration;
|
||||||
|
config.Mode = (Configuration.EMode)_mode;
|
||||||
|
config.ShowTraps = _showTraps;
|
||||||
|
config.TrapColor = _trapColor;
|
||||||
|
config.OnlyVisibleTrapsAfterPomander = _onlyVisibleTrapsAfterPomander;
|
||||||
|
config.ShowHoard = _showHoard;
|
||||||
|
config.HoardColor = _hoardColor;
|
||||||
|
config.OnlyVisibleHoardAfterPomander = _onlyVisibleHoardAfterPomander;
|
||||||
|
config.ShowSilverCoffers = _showSilverCoffers;
|
||||||
|
config.SilverCofferColor = _silverCofferColor;
|
||||||
|
config.FillSilverCoffers = _fillSilverCoffers;
|
||||||
|
config.Save();
|
||||||
|
|
||||||
|
if (saveAndClose)
|
||||||
|
IsOpen = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawTrapCofferTab(ref bool save, ref bool saveAndClose)
|
||||||
{
|
{
|
||||||
if (ImGui.BeginTabItem("PotD/HoH"))
|
if (ImGui.BeginTabItem("PotD/HoH"))
|
||||||
{
|
{
|
||||||
@ -111,7 +140,10 @@ namespace Pal.Client.Windows
|
|||||||
|
|
||||||
ImGui.EndTabItem();
|
ImGui.EndTabItem();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawCommunityTab(ref bool saveAndClose)
|
||||||
|
{
|
||||||
if (BeginTabItemEx("Community", _switchToCommunityTab ? ImGuiTabItemFlags.SetSelected : ImGuiTabItemFlags.None))
|
if (BeginTabItemEx("Community", _switchToCommunityTab ? ImGuiTabItemFlags.SetSelected : ImGuiTabItemFlags.None))
|
||||||
{
|
{
|
||||||
_switchToCommunityTab = false;
|
_switchToCommunityTab = false;
|
||||||
@ -135,7 +167,10 @@ namespace Pal.Client.Windows
|
|||||||
ImGui.EndDisabled();
|
ImGui.EndDisabled();
|
||||||
ImGui.EndTabItem();
|
ImGui.EndTabItem();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawDebugTab()
|
||||||
|
{
|
||||||
if (ImGui.BeginTabItem("Debug"))
|
if (ImGui.BeginTabItem("Debug"))
|
||||||
{
|
{
|
||||||
var plugin = Service.Plugin;
|
var plugin = Service.Plugin;
|
||||||
@ -182,28 +217,6 @@ namespace Pal.Client.Windows
|
|||||||
|
|
||||||
ImGui.EndTabItem();
|
ImGui.EndTabItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndTabBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (save || saveAndClose)
|
|
||||||
{
|
|
||||||
var config = Service.Configuration;
|
|
||||||
config.Mode = (Configuration.EMode)_mode;
|
|
||||||
config.ShowTraps = _showTraps;
|
|
||||||
config.TrapColor = _trapColor;
|
|
||||||
config.OnlyVisibleTrapsAfterPomander = _onlyVisibleTrapsAfterPomander;
|
|
||||||
config.ShowHoard = _showHoard;
|
|
||||||
config.HoardColor = _hoardColor;
|
|
||||||
config.OnlyVisibleHoardAfterPomander = _onlyVisibleHoardAfterPomander;
|
|
||||||
config.ShowSilverCoffers = _showSilverCoffers;
|
|
||||||
config.SilverCofferColor = _silverCofferColor;
|
|
||||||
config.FillSilverCoffers = _fillSilverCoffers;
|
|
||||||
config.Save();
|
|
||||||
|
|
||||||
if (saveAndClose)
|
|
||||||
IsOpen = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawDebugItems()
|
private void DrawDebugItems()
|
||||||
|
Loading…
Reference in New Issue
Block a user