2018-01-05 19:21:07 +02:00
|
|
|
/*
|
|
|
|
* CSelectionBase.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../mainmenu/CMainMenu.h"
|
|
|
|
|
2022-07-26 15:07:42 +02:00
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
class CMapInfo;
|
|
|
|
struct StartInfo;
|
|
|
|
struct PlayerInfo;
|
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|
|
|
|
|
2018-01-05 19:21:07 +02:00
|
|
|
class CButton;
|
|
|
|
class CTextBox;
|
|
|
|
class CTextInput;
|
|
|
|
class CAnimImage;
|
|
|
|
class CToggleGroup;
|
|
|
|
class RandomMapTab;
|
|
|
|
class OptionsTab;
|
2023-11-09 16:41:00 +02:00
|
|
|
class TurnOptionsTab;
|
2023-12-28 20:41:01 +02:00
|
|
|
class ExtraOptionsTab;
|
2018-01-05 19:21:07 +02:00
|
|
|
class SelectionTab;
|
|
|
|
class InfoCard;
|
|
|
|
class CChatBox;
|
2024-04-29 23:55:02 +02:00
|
|
|
class PvPBox;
|
2024-05-01 15:58:22 +02:00
|
|
|
class TownSelector;
|
2018-01-05 19:21:07 +02:00
|
|
|
class CLabel;
|
2024-04-30 23:12:55 +02:00
|
|
|
class CSlider;
|
2018-01-05 19:21:07 +02:00
|
|
|
class CFlagBox;
|
|
|
|
class CLabelGroup;
|
2023-12-23 18:12:55 +02:00
|
|
|
class TransparentFilledRectangle;
|
2024-04-30 21:52:04 +02:00
|
|
|
class FilledTexturePlayerColored;
|
2024-04-30 23:12:55 +02:00
|
|
|
class LRClickableArea;
|
2018-01-05 19:21:07 +02:00
|
|
|
|
|
|
|
class ISelectionScreenInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ESelectionScreen screenType;
|
|
|
|
|
|
|
|
ISelectionScreenInfo(ESelectionScreen ScreenType = ESelectionScreen::unknown);
|
|
|
|
virtual ~ISelectionScreenInfo();
|
|
|
|
virtual const CMapInfo * getMapInfo() = 0;
|
|
|
|
virtual const StartInfo * getStartInfo() = 0;
|
|
|
|
|
|
|
|
virtual int getCurrentDifficulty();
|
2023-09-28 18:43:04 +02:00
|
|
|
virtual PlayerInfo getPlayerInfo(PlayerColor color);
|
2018-01-05 19:21:07 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
/// The actual map selection screen which consists of the options and selection tab
|
|
|
|
class CSelectionBase : public CWindowObject, public ISelectionScreenInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
std::shared_ptr<InfoCard> card;
|
|
|
|
|
|
|
|
std::shared_ptr<CButton> buttonSelect;
|
|
|
|
std::shared_ptr<CButton> buttonRMG;
|
|
|
|
std::shared_ptr<CButton> buttonOptions;
|
2023-11-09 16:41:00 +02:00
|
|
|
std::shared_ptr<CButton> buttonTurnOptions;
|
2023-12-28 20:41:01 +02:00
|
|
|
std::shared_ptr<CButton> buttonExtraOptions;
|
2018-01-05 19:21:07 +02:00
|
|
|
std::shared_ptr<CButton> buttonStart;
|
|
|
|
std::shared_ptr<CButton> buttonBack;
|
2023-09-22 18:57:43 +02:00
|
|
|
std::shared_ptr<CButton> buttonSimturns;
|
2018-01-05 19:21:07 +02:00
|
|
|
|
|
|
|
std::shared_ptr<SelectionTab> tabSel;
|
|
|
|
std::shared_ptr<OptionsTab> tabOpt;
|
2023-11-09 16:41:00 +02:00
|
|
|
std::shared_ptr<TurnOptionsTab> tabTurnOptions;
|
2023-12-28 20:41:01 +02:00
|
|
|
std::shared_ptr<ExtraOptionsTab> tabExtraOptions;
|
2018-01-05 19:21:07 +02:00
|
|
|
std::shared_ptr<RandomMapTab> tabRand;
|
|
|
|
std::shared_ptr<CIntObject> curTab;
|
|
|
|
|
|
|
|
CSelectionBase(ESelectionScreen type);
|
|
|
|
virtual void toggleTab(std::shared_ptr<CIntObject> tab);
|
|
|
|
};
|
|
|
|
|
|
|
|
class InfoCard : public CIntObject
|
|
|
|
{
|
|
|
|
std::shared_ptr<CPicture> playerListBg;
|
|
|
|
std::shared_ptr<CPicture> background;
|
|
|
|
|
|
|
|
std::shared_ptr<CAnimImage> iconsVictoryCondition;
|
|
|
|
std::shared_ptr<CAnimImage> iconsLossCondition;
|
|
|
|
std::shared_ptr<CAnimImage> iconsMapSizes;
|
|
|
|
|
|
|
|
std::shared_ptr<CLabel> labelSaveDate;
|
2023-10-21 16:49:50 +02:00
|
|
|
std::shared_ptr<CLabel> labelMapSize;
|
2018-01-05 19:21:07 +02:00
|
|
|
std::shared_ptr<CLabel> labelScenarioName;
|
|
|
|
std::shared_ptr<CLabel> labelScenarioDescription;
|
|
|
|
std::shared_ptr<CLabel> labelVictoryCondition;
|
|
|
|
std::shared_ptr<CLabel> labelLossCondition;
|
|
|
|
std::shared_ptr<CLabel> labelMapDiff;
|
|
|
|
std::shared_ptr<CLabel> labelPlayerDifficulty;
|
|
|
|
std::shared_ptr<CLabel> labelRating;
|
|
|
|
std::shared_ptr<CLabel> labelCampaignDescription;
|
|
|
|
|
|
|
|
std::shared_ptr<CLabel> mapName;
|
|
|
|
std::shared_ptr<CTextBox> mapDescription;
|
|
|
|
std::shared_ptr<CLabel> labelDifficulty;
|
|
|
|
std::shared_ptr<CLabel> labelDifficultyPercent;
|
|
|
|
std::shared_ptr<CLabel> labelVictoryConditionText;
|
|
|
|
std::shared_ptr<CLabel> labelLossConditionText;
|
|
|
|
|
2024-03-23 21:12:10 +02:00
|
|
|
std::shared_ptr<CLabelGroup> labelGroupPlayers;
|
|
|
|
std::shared_ptr<CButton> buttonInvitePlayers;
|
|
|
|
std::shared_ptr<CButton> buttonOpenGlobalLobby;
|
2024-04-29 23:55:02 +02:00
|
|
|
|
|
|
|
std::shared_ptr<PvPBox> pvpBox;
|
2018-01-05 19:21:07 +02:00
|
|
|
public:
|
|
|
|
|
2024-04-30 21:52:04 +02:00
|
|
|
bool showChat;
|
2018-01-05 19:21:07 +02:00
|
|
|
std::shared_ptr<CChatBox> chat;
|
|
|
|
std::shared_ptr<CFlagBox> flagbox;
|
|
|
|
|
|
|
|
std::shared_ptr<CToggleGroup> iconDifficulty;
|
|
|
|
|
|
|
|
InfoCard();
|
2019-04-20 18:26:54 +02:00
|
|
|
void disableLabelRedraws();
|
2018-01-05 19:21:07 +02:00
|
|
|
void changeSelection();
|
2024-04-30 21:52:04 +02:00
|
|
|
void toggleChat();
|
|
|
|
void setChat(bool activateChat);
|
2018-01-05 19:21:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class CChatBox : public CIntObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
std::shared_ptr<CTextBox> chatHistory;
|
|
|
|
std::shared_ptr<CTextInput> inputBox;
|
2023-12-23 18:12:55 +02:00
|
|
|
std::shared_ptr<TransparentFilledRectangle> inputBackground;
|
2018-01-05 19:21:07 +02:00
|
|
|
|
|
|
|
CChatBox(const Rect & rect);
|
|
|
|
|
2023-04-27 19:21:06 +02:00
|
|
|
void keyPressed(EShortcut key) override;
|
2023-10-01 16:40:26 +02:00
|
|
|
bool captureThisKey(EShortcut key) override;
|
2018-01-05 19:21:07 +02:00
|
|
|
void addNewMessage(const std::string & text);
|
|
|
|
};
|
|
|
|
|
2024-04-29 23:55:02 +02:00
|
|
|
class PvPBox : public CIntObject
|
|
|
|
{
|
2024-04-30 21:52:04 +02:00
|
|
|
std::shared_ptr<FilledTexturePlayerColored> backgroundTexture;
|
|
|
|
std::shared_ptr<TransparentFilledRectangle> backgroundBorder;
|
|
|
|
|
2024-05-01 15:58:22 +02:00
|
|
|
std::shared_ptr<TownSelector> townSelector;
|
2024-04-30 23:12:55 +02:00
|
|
|
|
2024-04-29 23:55:02 +02:00
|
|
|
std::shared_ptr<CButton> buttonFlipCoin;
|
2024-04-30 01:52:49 +02:00
|
|
|
std::shared_ptr<CButton> buttonRandomTown;
|
|
|
|
std::shared_ptr<CButton> buttonRandomTownVs;
|
2024-07-25 23:32:45 +02:00
|
|
|
std::shared_ptr<CButton> buttonHandicap;
|
2024-04-30 21:52:04 +02:00
|
|
|
public:
|
2024-04-29 23:55:02 +02:00
|
|
|
PvPBox(const Rect & rect);
|
|
|
|
};
|
|
|
|
|
2024-05-01 15:58:22 +02:00
|
|
|
class TownSelector : public CIntObject
|
2024-04-30 23:12:55 +02:00
|
|
|
{
|
|
|
|
std::map<FactionID, std::shared_ptr<CAnimImage>> towns;
|
|
|
|
std::map<FactionID, std::shared_ptr<LRClickableArea>> townsArea;
|
|
|
|
std::shared_ptr<CSlider> slider;
|
|
|
|
|
2024-05-01 00:49:33 +02:00
|
|
|
void sliderMove(int slidPos);
|
|
|
|
void updateListItems();
|
|
|
|
|
2024-04-30 23:12:55 +02:00
|
|
|
public:
|
2024-05-01 00:49:33 +02:00
|
|
|
std::map<FactionID, bool> townsEnabled;
|
|
|
|
|
2024-05-01 15:58:22 +02:00
|
|
|
TownSelector(const Point & loc);
|
2024-04-30 23:12:55 +02:00
|
|
|
};
|
|
|
|
|
2018-01-05 19:21:07 +02:00
|
|
|
class CFlagBox : public CIntObject
|
|
|
|
{
|
|
|
|
std::shared_ptr<CLabel> labelAllies;
|
|
|
|
std::shared_ptr<CLabel> labelEnemies;
|
|
|
|
std::vector<std::shared_ptr<CAnimImage>> flagsAllies;
|
|
|
|
std::vector<std::shared_ptr<CAnimImage>> flagsEnemies;
|
|
|
|
|
|
|
|
public:
|
|
|
|
CFlagBox(const Rect & rect);
|
|
|
|
void recreate();
|
2023-07-08 13:33:04 +02:00
|
|
|
void showPopupWindow(const Point & cursorPosition) override;
|
2018-01-05 19:21:07 +02:00
|
|
|
void showTeamsPopup();
|
|
|
|
|
|
|
|
class CFlagBoxTooltipBox : public CWindowObject
|
|
|
|
{
|
|
|
|
std::shared_ptr<CLabel> labelTeamAlignment;
|
|
|
|
std::shared_ptr<CLabelGroup> labelGroupTeams;
|
|
|
|
std::vector<std::shared_ptr<CAnimImage>> iconsFlags;
|
|
|
|
public:
|
2024-06-02 17:43:56 +02:00
|
|
|
CFlagBoxTooltipBox();
|
2018-01-05 19:21:07 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
extern ISelectionScreenInfo * SEL;
|