1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-14 10:12:59 +02:00
vcmi/client/battle/BattleWindow.h

112 lines
3.0 KiB
C
Raw Normal View History

/*
* BattleWindow.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 "../gui/CIntObject.h"
2022-12-25 12:22:07 +02:00
#include "../gui/InterfaceObjectConfigurable.h"
2022-12-20 01:28:20 +02:00
#include "../../lib/battle/CBattleInfoCallback.h"
#include "../../lib/battle/PossiblePlayerBattleAction.h"
VCMI_LIB_NAMESPACE_BEGIN
class CStack;
VCMI_LIB_NAMESPACE_END
class CButton;
class BattleInterface;
class BattleConsole;
class BattleRenderer;
class StackQueue;
class HeroInfoBasicPanel;
/// GUI object that handles functionality of panel at the bottom of combat screen
class BattleWindow : public InterfaceObjectConfigurable
{
2022-12-13 13:58:16 +02:00
BattleInterface & owner;
std::shared_ptr<StackQueue> queue;
std::shared_ptr<BattleConsole> console;
std::shared_ptr<HeroInfoBasicPanel> attackerHeroWindow;
std::shared_ptr<HeroInfoBasicPanel> defenderHeroWindow;
/// button press handling functions
void bOptionsf();
void bSurrenderf();
void bFleef();
void bAutofightf();
void bSpellf();
void bWaitf();
2022-12-20 01:28:20 +02:00
void bSwitchActionf();
void bDefencef();
void bConsoleUpf();
void bConsoleDownf();
void bTacticNextStack();
void bTacticPhaseEnd();
/// functions for handling actions after they were confirmed by popup window
void reallyFlee();
void reallySurrender();
2022-12-20 01:28:20 +02:00
/// management of alternative actions
std::list<PossiblePlayerBattleAction> alternativeActions;
PossiblePlayerBattleAction defaultAction;
void showAlternativeActionIcon(PossiblePlayerBattleAction);
2023-02-15 23:38:41 +02:00
/// flip battle queue visibility to opposite
void toggleQueueVisibility();
void createQueue();
void toggleStickyHeroWindowsVisibility();
void createStickyHeroInfoWindows();
std::shared_ptr<BattleConsole> buildBattleConsole(const JsonNode &) const;
public:
BattleWindow(BattleInterface & owner );
2022-12-21 18:04:19 +02:00
~BattleWindow();
/// Closes window once battle finished
void close();
2023-02-15 23:38:41 +02:00
/// Toggle StackQueue visibility
void hideQueue();
void showQueue();
void hideStickyHeroWindows();
void showStickyHeroWindows();
/// block all UI elements when player is not allowed to act, e.g. during enemy turn
void blockUI(bool on);
/// Refresh queue after turn order changes
void updateQueue();
2023-01-22 21:03:11 +02:00
/// Get mouse-hovered battle queue unit ID if any found
2023-04-16 19:42:56 +02:00
std::optional<uint32_t> getQueueHoveredUnitId();
2023-01-22 21:03:11 +02:00
void activate() override;
void deactivate() override;
void keyPressed(EShortcut key) override;
bool captureThisKey(EShortcut key) override;
2023-07-15 21:18:04 +02:00
void clickPressed(const Point & cursorPosition) override;
void show(Canvas & to) override;
void showAll(Canvas & to) override;
/// Toggle UI to displaying tactics phase
void tacticPhaseStarted();
/// Toggle UI to displaying battle log in place of tactics UI
void tacticPhaseEnded();
2022-12-20 01:28:20 +02:00
/// Set possible alternative options. If more than 1 - the last will be considered as default option
void setAlternativeActions(const std::list<PossiblePlayerBattleAction> &);
};