123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- #ifndef RECRUITMENTSCENE_H
- #define RECRUITMENTSCENE_H
- #include "gui/scene.h"
- #include "gui/buttoneventlistener.h"
- #include "ui/hotseat_recruitment/iconhint.h"
- #include <QWidget>
- #include <vector>
- #include <memory>
- class UnitIcon;
- class RaceIcon;
- class Player;
- class Unit;
- class Race;
- namespace Ui {
- class RecruitmentScene;
- }
- class RecruitmentScene;
- class RaceIconEventListener : public QObject
- {
- Q_OBJECT
- public:
- RaceIconEventListener() = delete;
- RaceIconEventListener(QObject *parent, RecruitmentScene* scene);
- virtual bool eventFilter(QObject * watched, QEvent * event) Q_DECL_OVERRIDE;
- private:
- RecruitmentScene* scene_;
- };
- class UnitIconEventListener : public QObject
- {
- Q_OBJECT
- public:
- UnitIconEventListener() = delete;
- UnitIconEventListener(QObject *parent, RecruitmentScene* scene);
- virtual bool eventFilter(QObject * watched, QEvent * event) Q_DECL_OVERRIDE;
- private:
- RecruitmentScene* scene_;
- };
- class RecruitmentScene : public Scene
- {
- Q_OBJECT
- public:
- explicit RecruitmentScene(QWidget *parent = 0);
- ~RecruitmentScene();
-
- void parseArgs(QString args) override;
-
- void init() override;
- private:
- void initAvailableRaces();
- void initAvailableUnits();
- void showChosenUnits();
- public:
- Player *getActivePlayer();
- bool buyUnit(std::shared_ptr<Unit> unit);
- bool removeUnit(std::shared_ptr<Unit> unit);
- void changeRace(std::shared_ptr<Race> race);
- void updateMoney();
- private slots:
- void on_back_button_clicked();
- void on_complete_choice_button_clicked();
- public:
-
- std::vector<std::shared_ptr<Race>> races_list;
-
- std::vector<std::shared_ptr<Unit>> available_units_list;
-
- std::vector<std::shared_ptr<Unit>> chosen_units_list;
- public:
-
- static const unsigned RACES_NUMBER = 2;
-
- static const unsigned AVAILABLE_UNIT_NUMBER = 5;
-
- static const unsigned MAX_PARTY_SIZE = 10;
- private:
-
- unsigned int available_money_;
-
- int current_money_;
-
- int current_player_id_;
-
- Player* current_player_;
-
- QMovie *movie;
-
- ButtonEventListener *watcher;
-
- RaceIconEventListener *race_icon_watcher;
-
- UnitIconEventListener *unit_icon_watcher;
-
- Ui::RecruitmentScene *ui;
- };
- #endif
|