diff --git a/client/gui/Shortcut.h b/client/gui/Shortcut.h index b8a3884e3..62c20acb9 100644 --- a/client/gui/Shortcut.h +++ b/client/gui/Shortcut.h @@ -74,6 +74,7 @@ enum class EShortcut HIGH_SCORES_CAMPAIGNS, HIGH_SCORES_SCENARIOS, HIGH_SCORES_RESET, + HIGH_SCORES_STATISTIC, // Game lobby / scenario selection LOBBY_BEGIN_STANDARD_GAME, // b diff --git a/client/gui/ShortcutHandler.cpp b/client/gui/ShortcutHandler.cpp index 6b1dd03c9..d8057bbeb 100644 --- a/client/gui/ShortcutHandler.cpp +++ b/client/gui/ShortcutHandler.cpp @@ -281,6 +281,7 @@ EShortcut ShortcutHandler::findShortcut(const std::string & identifier ) const {"highScoresCampaigns", EShortcut::HIGH_SCORES_CAMPAIGNS }, {"highScoresScenarios", EShortcut::HIGH_SCORES_SCENARIOS }, {"highScoresReset", EShortcut::HIGH_SCORES_RESET }, + {"highScoresStatistic", EShortcut::HIGH_SCORES_STATISTIC }, {"lobbyReplayVideo", EShortcut::LOBBY_REPLAY_VIDEO }, {"lobbyExtraOptions", EShortcut::LOBBY_EXTRA_OPTIONS }, {"lobbyTurnOptions", EShortcut::LOBBY_TURN_OPTIONS }, diff --git a/client/mainmenu/CHighScoreScreen.cpp b/client/mainmenu/CHighScoreScreen.cpp index b05e91699..31547592b 100644 --- a/client/mainmenu/CHighScoreScreen.cpp +++ b/client/mainmenu/CHighScoreScreen.cpp @@ -207,7 +207,7 @@ CHighScoreInputScreen::CHighScoreInputScreen(bool won, HighScoreCalculation calc CCS->musich->playMusic(AudioPath::builtin("music/UltimateLose"), false, true); } - statisticButton = std::make_shared(Point(736, 0), AnimationPath::builtin("TPTAV02.DEF"), CButton::tooltip(CGI->generaltexth->translate("vcmi.statisticWindow.statistic")), [this](){ GH.windows().createAndPushWindow(stat); }); + statisticButton = std::make_shared(Point(736, 0), AnimationPath::builtin("TPTAV02.DEF"), CButton::tooltip(CGI->generaltexth->translate("vcmi.statisticWindow.statistic")), [this](){ GH.windows().createAndPushWindow(stat); }, EShortcut::HIGH_SCORES_STATISTIC); texts.push_back(std::make_shared(Rect(0, 0, 726, 32), FONT_HIGH_SCORE, ETextAlignment::CENTERRIGHT, Colors::WHITE, CGI->generaltexth->translate("vcmi.statisticWindow.statistic") + ":")); } @@ -288,6 +288,8 @@ void CHighScoreInputScreen::clickPressed(const Point & cursorPosition) void CHighScoreInputScreen::keyPressed(EShortcut key) { + if(key == EShortcut::HIGH_SCORES_STATISTIC) + return; clickPressed(Point()); } diff --git a/client/mainmenu/CStatisticScreen.cpp b/client/mainmenu/CStatisticScreen.cpp index 99b4e5c5c..40d3ff425 100644 --- a/client/mainmenu/CStatisticScreen.cpp +++ b/client/mainmenu/CStatisticScreen.cpp @@ -11,12 +11,19 @@ #include "StdInc.h" #include "CStatisticScreen.h" +#include "../CGameInfo.h" + #include "../gui/CGuiHandler.h" #include "../gui/WindowHandler.h" +#include "../gui/Shortcut.h" #include "../widgets/Images.h" +#include "../widgets/GraphicalPrimitiveCanvas.h" +#include "../widgets/TextControls.h" +#include "../widgets/Buttons.h" #include "../../lib/gameState/GameStatistics.h" +#include "../../lib/texts/CGeneralTextHandler.h" CStatisticScreen::CStatisticScreen(StatisticDataSet statistic) : CWindowObject(BORDERED) @@ -24,11 +31,9 @@ CStatisticScreen::CStatisticScreen(StatisticDataSet statistic) OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE; pos = center(Rect(0, 0, 800, 600)); filledBackground = std::make_shared(ImagePath::builtin("DiBoxBck"), Rect(0, 0, pos.w, pos.h)); + filledBackground->setPlayerColor(PlayerColor(1)); - addUsedEvents(LCLICK); -} - -void CStatisticScreen::clickPressed(const Point & cursorPosition) -{ - close(); + layout.push_back(std::make_shared(Rect(0, 0, 800, 30), FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->translate("vcmi.statisticWindow.statistic"))); + layout.push_back(std::make_shared(Rect(10, 30, 780, 530), ColorRGBA(0, 0, 0, 64), ColorRGBA(64, 80, 128, 255), 1)); + layout.push_back(std::make_shared(Point(725, 564), AnimationPath::builtin("MUBCHCK"), CButton::tooltip(), [this](){ close(); }, EShortcut::GLOBAL_ACCEPT)); } diff --git a/client/mainmenu/CStatisticScreen.h b/client/mainmenu/CStatisticScreen.h index 158e02485..bee5bb140 100644 --- a/client/mainmenu/CStatisticScreen.h +++ b/client/mainmenu/CStatisticScreen.h @@ -16,8 +16,8 @@ class FilledTexturePlayerColored; class CStatisticScreen : public CWindowObject { std::shared_ptr filledBackground; + + std::vector> layout; public: CStatisticScreen(StatisticDataSet statistic); - - void clickPressed(const Point & cursorPosition) override; }; diff --git a/config/shortcutsConfig.json b/config/shortcutsConfig.json index 5ed18867a..2bcc70f2b 100644 --- a/config/shortcutsConfig.json +++ b/config/shortcutsConfig.json @@ -137,6 +137,7 @@ "heroToggleTactics": "B", "highScoresCampaigns": "C", "highScoresReset": "R", + "highScoresStatistic": ".", "highScoresScenarios": "S", "kingdomHeroesTab": "H", "kingdomTownsTab": "T",