diff options
author | Vladimir Krasheninnikov <boba09@list.ru> | 2025-02-22 13:37:27 +0100 |
---|---|---|
committer | Vladimir Krasheninnikov <boba09@list.ru> | 2025-02-22 13:37:27 +0100 |
commit | b28ef790ea54ac75be3cc4937525ceacbc8656fc (patch) | |
tree | af1802cff6222eb5a848bf84dc449a08a0cdbfb6 /source/frontend | |
parent | 50d7386bbbf6b712f007789c7858aa95b83fda92 (diff) |
Create CharacterSwap pane
Diffstat (limited to 'source/frontend')
-rw-r--r-- | source/frontend/StarClientCommandProcessor.cpp | 6 | ||||
-rw-r--r-- | source/frontend/StarMainInterface.cpp | 9 | ||||
-rw-r--r-- | source/frontend/StarMainInterfaceTypes.cpp | 3 | ||||
-rw-r--r-- | source/frontend/StarMainInterfaceTypes.hpp | 3 |
4 files changed, 17 insertions, 4 deletions
diff --git a/source/frontend/StarClientCommandProcessor.cpp b/source/frontend/StarClientCommandProcessor.cpp index c19c68f..da0cbd6 100644 --- a/source/frontend/StarClientCommandProcessor.cpp +++ b/source/frontend/StarClientCommandProcessor.cpp @@ -426,8 +426,10 @@ String ClientCommandProcessor::upgradeShip(String const& argumentsString) { String ClientCommandProcessor::swap(String const& argumentsString) { auto arguments = m_parser.tokenizeToStringList(argumentsString); - if (arguments.size() == 0) - return "Not enough arguments to /swap"; + if (arguments.size() == 0) { + m_paneManager->displayRegisteredPane(MainInterfacePanes::CharacterSwap); + return ""; + } if (m_universeClient->switchPlayer(arguments[0])) return "Successfully swapped player"; diff --git a/source/frontend/StarMainInterface.cpp b/source/frontend/StarMainInterface.cpp index 8468f7f..e3b28eb 100644 --- a/source/frontend/StarMainInterface.cpp +++ b/source/frontend/StarMainInterface.cpp @@ -57,6 +57,7 @@ #include "StarContainerInteractor.hpp" #include "StarChatBubbleManager.hpp" #include "StarNpc.hpp" +#include "StarCharSelection.hpp" namespace Star { @@ -168,6 +169,14 @@ MainInterface::MainInterface(UniverseClientPtr client, WorldPainterPtr painter, planetName->addChild("planetText", m_planetText); m_paneManager.registerPane(MainInterfacePanes::PlanetText, PaneLayer::Hud, planetName); + auto charSelectionMenu = make_shared<CharSelectionPane>(m_client->playerStorage(), [=]() {}, [=](PlayerPtr mainPlayer) { + m_client->playerStorage()->moveToFront(mainPlayer->uuid()); + m_client->switchPlayer(mainPlayer->name()); + m_paneManager.dismissRegisteredPane(MainInterfacePanes::CharacterSwap); }, [=](Uuid) {}); + charSelectionMenu->setAnchor(PaneAnchor::Center); + + m_paneManager.registerPane(MainInterfacePanes::CharacterSwap, PaneLayer::ModalWindow, charSelectionMenu); + m_nameplatePainter = make_shared<NameplatePainter>(); m_questIndicatorPainter = make_shared<QuestIndicatorPainter>(m_client); m_chatBubbleManager = make_shared<ChatBubbleManager>(); diff --git a/source/frontend/StarMainInterfaceTypes.cpp b/source/frontend/StarMainInterfaceTypes.cpp index 957b69d..9ba23ad 100644 --- a/source/frontend/StarMainInterfaceTypes.cpp +++ b/source/frontend/StarMainInterfaceTypes.cpp @@ -29,7 +29,8 @@ EnumMap<MainInterfacePanes> const MainInterfacePanesNames{ {MainInterfacePanes::CraftingPlain, "CraftingPlain"}, {MainInterfacePanes::QuestTracker, "QuestTracker"}, {MainInterfacePanes::MmUpgrade, "MmUpgrade"}, - {MainInterfacePanes::Collections, "Collections"} + {MainInterfacePanes::Collections, "Collections"}, + {MainInterfacePanes::CharacterSwap, "CharacterSwap"} }; MainInterfaceConfigPtr MainInterfaceConfig::loadFromAssets() { diff --git a/source/frontend/StarMainInterfaceTypes.hpp b/source/frontend/StarMainInterfaceTypes.hpp index b5f228a..afa9fb2 100644 --- a/source/frontend/StarMainInterfaceTypes.hpp +++ b/source/frontend/StarMainInterfaceTypes.hpp @@ -34,7 +34,8 @@ enum class MainInterfacePanes { CraftingPlain, QuestTracker, MmUpgrade, - Collections + Collections, + CharacterSwap }; extern EnumMap<MainInterfacePanes> const MainInterfacePanesNames; |