#include "ui/hotseat_intro/playervsplayerintro.h"
#include "gui/guiscenemanager.h"
#include "playermanager.h"
#include "soundengine.h"
#include "gui/scene.h"

#include "ui_playervsplayerintro.h"

#include <QMovie>

PlayerVsPlayerIntro::PlayerVsPlayerIntro(QWidget *parent) :
    Scene(parent),
    ui(new Ui::PlayerVsPlayerIntro)
{
    ui->setupUi(this);

    watcher = new ButtonEventListener(this);
    ui->back_button->installEventFilter(watcher);
    ui->continue_button->installEventFilter(watcher);

    movie = new QMovie(":/assets/hotseat_intro/image.gif");
    ui->image->setMovie(movie);
    movie->start();
}

void PlayerVsPlayerIntro::init()
{
//    GuiSceneManager::getInstance().show("main_menu_background");
//    raise();
}

PlayerVsPlayerIntro::~PlayerVsPlayerIntro()
{
    delete ui;
    delete watcher;
}

void PlayerVsPlayerIntro::on_back_button_clicked() {
    GuiSceneManager::getInstance().changeScene("main_menu");
}

void PlayerVsPlayerIntro::on_continue_button_clicked() {
    PlayerManager::getInstance().setPlayersNum(2);
    /// TODO - Check if money input correct
    GuiSceneManager::getInstance().changeScene("recruit_army", "0|" + ui->money->text());
}
