diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2025-02-23 06:19:42 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-23 06:19:42 +1100 |
commit | 70e7b383902f0f5c16e47b20095953c7e0e1100b (patch) | |
tree | f999696f90f7b53f80eb0d0d411d076b0db5b197 /source/frontend/StarCharSelection.cpp | |
parent | 2aec6a1592122fdeb7b8ce2bc1402af184ee670f (diff) | |
parent | 61cefb79a1fb5ccf0be73aff23af5a6e79ad79c4 (diff) |
Merge pull request #192 from KrashV/main
Create CharacterSwap pane
Diffstat (limited to 'source/frontend/StarCharSelection.cpp')
-rw-r--r-- | source/frontend/StarCharSelection.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/source/frontend/StarCharSelection.cpp b/source/frontend/StarCharSelection.cpp index 6cbfb9b..6a61dcf 100644 --- a/source/frontend/StarCharSelection.cpp +++ b/source/frontend/StarCharSelection.cpp @@ -37,8 +37,7 @@ CharSelectionPane::CharSelectionPane(PlayerStoragePtr playerStorage, updateCharacterPlates(); }); guiReader.registerCallback("clearSearch", [=](Widget*) { - auto searchCharacter = fetchChild<TextBoxWidget>("searchCharacter"); - searchCharacter->setText(""); + fetchChild<TextBoxWidget>("searchCharacter")->setText(""); }); guiReader.construct(root.assets()->json("/interface/windowconfig/charselection.config"), this); @@ -63,6 +62,7 @@ void CharSelectionPane::show() { Pane::show(); m_downScroll = 0; + fetchChild<TextBoxWidget>("searchCharacter")->setText(""); updateCharacterPlates(); } @@ -96,14 +96,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 +126,8 @@ void CharSelectionPane::updateCharacterPlates() { fetchChild("playerDownButton")->hide(); } +void CharSelectionPane::setReadOnly(bool readOnly) { + findChild("createCharButton")->setVisibility(!(m_readOnly = readOnly)); +} + } |