diff options
author | WereTech <17415815+WereTech@users.noreply.github.com> | 2025-02-23 16:31:03 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-23 16:31:03 -0600 |
commit | 0245e639ecc51d948f0256eb4a773d42fbb8ade5 (patch) | |
tree | 7fc9b120efda129c09e522fc08af2d28e52d3eb6 /source/frontend/StarCharSelection.cpp | |
parent | 3108120076bad6b934c43526200f2beed4c96753 (diff) | |
parent | 5dda9f47306a6eea5eb4e676c68f81b8285d9dfe (diff) |
Merge branch 'OpenStarbound:main' into main
Diffstat (limited to 'source/frontend/StarCharSelection.cpp')
-rw-r--r-- | source/frontend/StarCharSelection.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/source/frontend/StarCharSelection.cpp b/source/frontend/StarCharSelection.cpp index 6cbfb9b..2c00b42 100644 --- a/source/frontend/StarCharSelection.cpp +++ b/source/frontend/StarCharSelection.cpp @@ -37,8 +37,11 @@ CharSelectionPane::CharSelectionPane(PlayerStoragePtr playerStorage, updateCharacterPlates(); }); guiReader.registerCallback("clearSearch", [=](Widget*) { - auto searchCharacter = fetchChild<TextBoxWidget>("searchCharacter"); - searchCharacter->setText(""); + 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); @@ -63,6 +66,7 @@ void CharSelectionPane::show() { Pane::show(); m_downScroll = 0; + fetchChild<TextBoxWidget>("searchCharacter")->setText(""); updateCharacterPlates(); } @@ -96,14 +100,18 @@ void CharSelectionPane::updateCharacterPlates() { if (m_filteredList.size() > 0 && scrollPosition < m_filteredList.size()) { auto playerUuid = m_filteredList.get(scrollPosition); if (auto player = m_playerStorage->loadPlayer(playerUuid)) { + charSelector->show(); player->humanoid()->setFacingDirection(Direction::Right); charSelector->setPlayer(player); - charSelector->enableDelete([this, playerUuid](Widget*) { m_deleteCallback(playerUuid); }); + if (!m_readOnly) + charSelector->enableDelete([this, playerUuid](Widget*) { m_deleteCallback(playerUuid); }); return; } } charSelector->setPlayer(PlayerPtr()); charSelector->disableDelete(); + if (m_readOnly) + charSelector->hide(); }; updatePlayerLine("charSelector1", m_downScroll + 0); @@ -122,4 +130,8 @@ void CharSelectionPane::updateCharacterPlates() { fetchChild("playerDownButton")->hide(); } +void CharSelectionPane::setReadOnly(bool readOnly) { + findChild("createCharButton")->setVisibility(!(m_readOnly = readOnly)); +} + } |