mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-22 09:22:18 -05:00
Adds lock/unlock all buttons to Cosmetics Editor. (#2225)
* Adds lock/unlock all buttons to Cosmetics Editor. Adds Lock All and Unlock All, which locks all visible cosmetics options (i.e. does not lock the advanced options if Advanced isn't checked, just like the existing randomize all buttons), and a Lock All Advanced and Unlock All Advanced button that is only visible while the Advanced Options are enabled. * Updates latest develop and CVar API Changes.
This commit is contained in:
parent
7c8be2153c
commit
edceb2d460
@ -1669,6 +1669,25 @@ void DrawCosmeticsEditor(bool& open) {
|
||||
ImGui::SameLine();
|
||||
UIWidgets::EnhancementCombobox("gCosmetics.DefaultColorScheme", colorSchemes, 2, 0);
|
||||
UIWidgets::EnhancementCheckbox("Advanced Mode", "gCosmetics.AdvancedMode");
|
||||
if (CVarGetInteger("gCosmetics.AdvancedMode", 0)) {
|
||||
if (ImGui::Button("Lock All Advanced", ImVec2(ImGui::GetContentRegionAvail().x / 2, 30.0f))) {
|
||||
for (auto& [id, cosmeticOption] : cosmeticOptions) {
|
||||
if (cosmeticOption.advancedOption) {
|
||||
CVarSetInteger(cosmeticOption.lockedCvar, 1);
|
||||
}
|
||||
}
|
||||
SohImGui::RequestCvarSaveOnNextTick();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Unlock All Advanced", ImVec2(ImGui::GetContentRegionAvail().x, 30.0f))) {
|
||||
for (auto& [id, cosmeticOption] : cosmeticOptions) {
|
||||
if (cosmeticOption.advancedOption) {
|
||||
CVarSetInteger(cosmeticOption.lockedCvar, 0);
|
||||
}
|
||||
}
|
||||
SohImGui::RequestCvarSaveOnNextTick();
|
||||
}
|
||||
}
|
||||
UIWidgets::EnhancementCheckbox("Sync Rainbow colors", "gCosmetics.RainbowSync");
|
||||
UIWidgets::EnhancementSliderFloat("Rainbow Speed: %f", "##rainbowSpeed", "gCosmetics.RainbowSpeed", 0.03f, 1.0f, "", 0.6f, false);
|
||||
if (ImGui::Button("Randomize All", ImVec2(ImGui::GetContentRegionAvail().x / 2, 30.0f))) {
|
||||
@ -1691,6 +1710,24 @@ void DrawCosmeticsEditor(bool& open) {
|
||||
SohImGui::RequestCvarSaveOnNextTick();
|
||||
}
|
||||
|
||||
if (ImGui::Button("Lock All", ImVec2(ImGui::GetContentRegionAvail().x / 2, 30.0f))) {
|
||||
for (auto& [id, cosmeticOption] : cosmeticOptions) {
|
||||
if (!cosmeticOption.advancedOption || CVarGetInteger("gCosmetics.AdvancedMode", 0)) {
|
||||
CVarSetInteger(cosmeticOption.lockedCvar, 1);
|
||||
}
|
||||
}
|
||||
SohImGui::RequestCvarSaveOnNextTick();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Unlock All", ImVec2(ImGui::GetContentRegionAvail().x, 30.0f))) {
|
||||
for (auto& [id, cosmeticOption] : cosmeticOptions) {
|
||||
if (!cosmeticOption.advancedOption || CVarGetInteger("gCosmetics.AdvancedMode", 0)) {
|
||||
CVarSetInteger(cosmeticOption.lockedCvar, 0);
|
||||
}
|
||||
}
|
||||
SohImGui::RequestCvarSaveOnNextTick();
|
||||
}
|
||||
|
||||
if (ImGui::BeginTabBar("CosmeticsContextTabBar", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) {
|
||||
if (ImGui::BeginTabItem("Link & Items")) {
|
||||
DrawCosmeticGroup(GROUP_LINK);
|
||||
|
Loading…
Reference in New Issue
Block a user