From bfab92082bb5ea037e247b0cc3be6e6d96f2483f Mon Sep 17 00:00:00 2001 From: Inky Date: Thu, 13 Jun 2019 15:41:44 +0300 Subject: [PATCH] Changed: char selection keyboard navigation handler --HG-- branch : compatibility-develop --- .../src/interface_v3/action_handler_game.cpp | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/code/ryzom/client/src/interface_v3/action_handler_game.cpp b/code/ryzom/client/src/interface_v3/action_handler_game.cpp index 9ccdf1b11..813bda15d 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -4609,3 +4609,38 @@ public: }; REGISTER_ACTION_HANDLER( CHandlerSortTribeFame, "sort_tribefame"); +// *************************************************************************** +// navigate_charsel +// Arg : current slot selected +// *************************************************************************** +class CHandlerCharselNaviGetKeys : public IActionHandler +{ + virtual void execute (CCtrlBase * /* pCaller */, const string &Params) + { + sint32 slot = 0; + if (!getParam(Params, "cs").empty()) + fromString(getParam(Params, "cs"), slot); + + if (Driver->AsyncListener.isKeyPushed(KeyESCAPE)) + CAHManager::getInstance()->runActionHandler("proc", NULL, "proc_quit"); + + if (Driver->AsyncListener.isKeyPushed(KeyRETURN)) + CAHManager::getInstance()->runActionHandler("proc", NULL, "proc_charsel_enterkeyslot"); + + const sint32 index = slot; + if (Driver->AsyncListener.isKeyPushed(KeyUP)) + { + slot--; + if (slot < 0) slot = 4; + } + else if (Driver->AsyncListener.isKeyPushed(KeyDOWN)) + { + slot++; + if (slot > 4) slot = 0; + } + // now select + if (index != slot) + CAHManager::getInstance()->runActionHandler("proc", NULL, toString("proc_charsel_clickslot|%i", slot)); + } +}; +REGISTER_ACTION_HANDLER( CHandlerCharselNaviGetKeys, "navigate_charsel" );