Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2025-02-23 09:03:38 +1100
committerKae <80987908+Novaenia@users.noreply.github.com>2025-02-23 09:03:38 +1100
commit5dda9f47306a6eea5eb4e676c68f81b8285d9dfe (patch)
treefb41dea87decaf51643430c1ef64dae69e187d71
parentafcbe910a5e285b25f6961e28943cdf101aa810e (diff)
add dismiss on swap checkbox
-rw-r--r--assets/opensb/interface/windowconfig/charselection.config.patch21
-rw-r--r--source/frontend/StarCharSelection.cpp4
-rw-r--r--source/frontend/StarMainInterface.cpp24
3 files changed, 38 insertions, 11 deletions
diff --git a/assets/opensb/interface/windowconfig/charselection.config.patch b/assets/opensb/interface/windowconfig/charselection.config.patch
index d38f03a..63a01db 100644
--- a/assets/opensb/interface/windowconfig/charselection.config.patch
+++ b/assets/opensb/interface/windowconfig/charselection.config.patch
@@ -1,4 +1,23 @@
{
+ "toggleDismissCheckbox": {
+ "type": "button",
+ "base" : "/interface/optionsmenu/checkboxnocheck.png",
+ "hover" : "/interface/optionsmenu/checkboxnocheckhover.png",
+ "baseImageChecked" : "/interface/optionsmenu/checkboxcheck.png",
+ "hoverImageChecked" : "/interface/optionsmenu/checkboxcheckhover.png",
+ "checkable" : true,
+ "checked" : false,
+ "position": [ 23, 244 ],
+ "pressedOffset": [ 0, 0 ],
+ "visible" : false
+ },
+ "toggleDismissLabel": {
+ "type" : "label",
+ "position" : [ 35, 244 ],
+ "hAnchor" : "left",
+ "value" : "DISMISS ON SWAP",
+ "visible" : false
+ },
"createCharButton": {
"type": "button",
"base": "/interface/title/createcharacter.png",
@@ -10,7 +29,7 @@
"type": "textbox",
"hint": "Search...",
"position": [ 130, 244 ],
- "maxWidth": 68
+ "maxWidth": 69
},
"clearSearch": {
"type": "button",
diff --git a/source/frontend/StarCharSelection.cpp b/source/frontend/StarCharSelection.cpp
index 6a61dcf..2c00b42 100644
--- a/source/frontend/StarCharSelection.cpp
+++ b/source/frontend/StarCharSelection.cpp
@@ -39,6 +39,10 @@ CharSelectionPane::CharSelectionPane(PlayerStoragePtr playerStorage,
guiReader.registerCallback("clearSearch", [=](Widget*) {
fetchChild<TextBoxWidget>("searchCharacter")->setText("");
});
+ guiReader.registerCallback("toggleDismissCheckbox", [=](Widget* widget) {
+ auto configuration = Root::singleton().configuration();
+ configuration->set("characterSwapDismisses", as<ButtonWidget>(widget)->isChecked());
+ });
guiReader.construct(root.assets()->json("/interface/windowconfig/charselection.config"), this);
}
diff --git a/source/frontend/StarMainInterface.cpp b/source/frontend/StarMainInterface.cpp
index 033e1c9..e3b1860 100644
--- a/source/frontend/StarMainInterface.cpp
+++ b/source/frontend/StarMainInterface.cpp
@@ -27,6 +27,7 @@
#include "StarCanvasWidget.hpp"
#include "StarLabelWidget.hpp"
#include "StarItemSlotWidget.hpp"
+#include "StarButtonWidget.hpp"
#include "StarPlayer.hpp"
#include "StarPlayerLog.hpp"
#include "StarMonster.hpp"
@@ -178,16 +179,19 @@ MainInterface::MainInterface(UniverseClientPtr client, WorldPainterPtr painter,
if (configuration->get("characterSwapDismisses", false).toBool())
m_paneManager.dismissRegisteredPane(MainInterfacePanes::CharacterSwap);
}, [=](Uuid) {});
- {
- charSelectionMenu->setReadOnly(true);
- charSelectionMenu->setAnchor(PaneAnchor::Center);
- charSelectionMenu->unlockPosition();
- auto backgrounds = charSelectionMenu->getBG();
- backgrounds.header = std::move(backgrounds.body);
- charSelectionMenu->setBG(backgrounds);
- }
-
- m_paneManager.registerPane(MainInterfacePanes::CharacterSwap, PaneLayer::ModalWindow, charSelectionMenu);
+ charSelectionMenu->setReadOnly(true);
+ charSelectionMenu->setAnchor(PaneAnchor::Center);
+ charSelectionMenu->unlockPosition();
+ auto backgrounds = charSelectionMenu->getBG();
+ backgrounds.header = std::move(backgrounds.body);
+ charSelectionMenu->setBG(backgrounds);
+ charSelectionMenu->findChild("toggleDismissLabel")->setVisibility(true);
+ auto toggleDismiss = charSelectionMenu->findChild<ButtonWidget>("toggleDismissCheckbox");
+ auto configuration = Root::singleton().configuration();
+ toggleDismiss->setChecked(configuration->get("characterSwapDismisses", false).toBool());
+ toggleDismiss->setVisibility(true);
+
+ m_paneManager.registerPane(MainInterfacePanes::CharacterSwap, PaneLayer::Window, charSelectionMenu);
m_nameplatePainter = make_shared<NameplatePainter>();
m_questIndicatorPainter = make_shared<QuestIndicatorPainter>(m_client);