1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00
This commit is contained in:
Laserlicht 2024-07-25 23:32:45 +02:00
parent ec005593d3
commit ecd7e17764
6 changed files with 25 additions and 16 deletions

View File

@ -91,6 +91,7 @@ enum class EShortcut
LOBBY_FLIP_COIN,
LOBBY_RANDOM_TOWN,
LOBBY_RANDOM_TOWN_VS,
LOBBY_HANDICAP,
MAPS_SIZE_S,
MAPS_SIZE_M,

View File

@ -288,6 +288,7 @@ EShortcut ShortcutHandler::findShortcut(const std::string & identifier ) const
{"lobbyFlipCoin", EShortcut::LOBBY_FLIP_COIN },
{"lobbyRandomTown", EShortcut::LOBBY_RANDOM_TOWN },
{"lobbyRandomTownVs", EShortcut::LOBBY_RANDOM_TOWN_VS },
{"lobbyHandicap", EShortcut::LOBBY_HANDICAP },
{"mapsSizeS", EShortcut::MAPS_SIZE_S },
{"mapsSizeM", EShortcut::MAPS_SIZE_M },
{"mapsSizeL", EShortcut::MAPS_SIZE_L },

View File

@ -437,6 +437,11 @@ PvPBox::PvPBox(const Rect & rect)
CSH->sendLobbyPack(lpa);
}, EShortcut::LOBBY_RANDOM_TOWN_VS);
buttonRandomTownVs->setTextOverlay(CGI->generaltexth->translate("vcmi.lobby.pvp.randomTownVs.hover"), EFonts::FONT_SMALL, Colors::WHITE);
buttonHandicap = std::make_shared<CButton>(Point(190, 81), AnimationPath::builtin("GSPBUT2.DEF"), CButton::tooltip("", CGI->generaltexth->translate("vcmi.lobby.handicap")), [this](){
GH.windows().createAndPushWindow<OptionsTab::HandicapWindow>();
}, EShortcut::LOBBY_HANDICAP);
buttonHandicap->setTextOverlay(CGI->generaltexth->translate("vcmi.lobby.handicap"), EFonts::FONT_SMALL, Colors::WHITE);
}
TownSelector::TownSelector(const Point & loc)

View File

@ -153,6 +153,7 @@ class PvPBox : public CIntObject
std::shared_ptr<CButton> buttonFlipCoin;
std::shared_ptr<CButton> buttonRandomTown;
std::shared_ptr<CButton> buttonRandomTownVs;
std::shared_ptr<CButton> buttonHandicap;
public:
PvPBox(const Rect & rect);
};

View File

@ -53,6 +53,22 @@ public:
BONUS
};
class HandicapWindow : public CWindowObject
{
std::shared_ptr<FilledTexturePlayerColored> backgroundTexture;
std::vector<std::shared_ptr<CLabel>> labels;
std::vector<std::shared_ptr<CAnimImage>> anim;
std::vector<std::shared_ptr<TransparentFilledRectangle>> textinputbackgrounds;
std::map<PlayerColor, std::map<EGameResID, std::shared_ptr<CTextInput>>> textinputs;
std::vector<std::shared_ptr<CButton>> buttons;
bool receiveEvent(const Point & position, int eventType) const override;
void clickReleased(const Point & cursorPosition) override;
public:
HandicapWindow();
};
private:
struct CPlayerSettingsHelper
@ -161,22 +177,6 @@ private:
SelectionWindow(const PlayerColor & color, SelType _type, int sliderPos = 0);
};
class HandicapWindow : public CWindowObject
{
std::shared_ptr<FilledTexturePlayerColored> backgroundTexture;
std::vector<std::shared_ptr<CLabel>> labels;
std::vector<std::shared_ptr<CAnimImage>> anim;
std::vector<std::shared_ptr<TransparentFilledRectangle>> textinputbackgrounds;
std::map<PlayerColor, std::map<EGameResID, std::shared_ptr<CTextInput>>> textinputs;
std::vector<std::shared_ptr<CButton>> buttons;
bool receiveEvent(const Point & position, int eventType) const override;
void clickReleased(const Point & cursorPosition) override;
public:
HandicapWindow();
};
/// Image with current town/hero/bonus
struct SelectedBox : public Scrollable, public CPlayerSettingsHelper
{

View File

@ -150,6 +150,7 @@
"lobbyRandomMap": "R",
"lobbyRandomTown": "T",
"lobbyRandomTownVs": "V",
"lobbyHandicap": "C",
"lobbyReplayVideo": "R",
"lobbySaveGame": [ "S", "Return", "Keypad Enter"],
"lobbySelectScenario": "S",