added judge bars
This commit is contained in:
parent
1da1ac4070
commit
2b7189f470
@ -209,6 +209,11 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
|
||||
|
||||
connect(ui_realization, SIGNAL(clicked()), this, SLOT(on_realization_clicked()));
|
||||
|
||||
connect(ui_defense_minus, SIGNAL(clicked()), this, SLOT(on_defense_minus_clicked()));
|
||||
connect(ui_defense_plus, SIGNAL(clicked()), this, SLOT(on_defense_plus_clicked()));
|
||||
connect(ui_prosecution_minus, SIGNAL(clicked()), this, SLOT(on_prosecution_minus_clicked()));
|
||||
connect(ui_prosecution_plus, SIGNAL(clicked()), this, SLOT(on_prosecution_plus_clicked()));
|
||||
|
||||
connect(ui_ooc_toggle, SIGNAL(clicked()), this, SLOT(on_ooc_toggle_clicked()));
|
||||
|
||||
connect(ui_music_search, SIGNAL(textChanged(QString)), this, SLOT(on_music_search_edited(QString)));
|
||||
@ -1211,6 +1216,23 @@ void Courtroom::handle_wtce(QString p_wtce)
|
||||
}
|
||||
}
|
||||
|
||||
void Courtroom::set_hp_bar(int p_bar, int p_state)
|
||||
{
|
||||
if (p_state < 0 || p_state > 10)
|
||||
return;
|
||||
|
||||
if (p_bar == 1)
|
||||
{
|
||||
ui_defense_bar->set_image("defensebar" + QString::number(p_state) + ".png");
|
||||
defense_bar_state = p_state;
|
||||
}
|
||||
else if (p_bar == 2)
|
||||
{
|
||||
ui_prosecution_bar->set_image("prosecutionbar" + QString::number(p_state) + ".png");
|
||||
prosecution_bar_state = p_state;
|
||||
}
|
||||
}
|
||||
|
||||
void Courtroom::on_ooc_return_pressed()
|
||||
{
|
||||
if (ui_ooc_chat_message->text() == "" || ui_ooc_chat_name->text() == "")
|
||||
@ -1361,6 +1383,38 @@ void Courtroom::on_realization_clicked()
|
||||
}
|
||||
}
|
||||
|
||||
void Courtroom::on_defense_minus_clicked()
|
||||
{
|
||||
int f_state = defense_bar_state - 1;
|
||||
|
||||
if (f_state >= 0)
|
||||
ao_app->send_server_packet(new AOPacket("HP#1#" + QString::number(f_state) + "#%"));
|
||||
}
|
||||
|
||||
void Courtroom::on_defense_plus_clicked()
|
||||
{
|
||||
int f_state = defense_bar_state + 1;
|
||||
|
||||
if (f_state <= 10)
|
||||
ao_app->send_server_packet(new AOPacket("HP#1#" + QString::number(f_state) + "#%"));
|
||||
}
|
||||
|
||||
void Courtroom::on_prosecution_minus_clicked()
|
||||
{
|
||||
int f_state = prosecution_bar_state - 1;
|
||||
|
||||
if (f_state >= 0)
|
||||
ao_app->send_server_packet(new AOPacket("HP#2#" + QString::number(f_state) + "#%"));
|
||||
}
|
||||
|
||||
void Courtroom::on_prosecution_plus_clicked()
|
||||
{
|
||||
int f_state = prosecution_bar_state + 1;
|
||||
|
||||
if (f_state <= 10)
|
||||
ao_app->send_server_packet(new AOPacket("HP#2#" + QString::number(f_state) + "#%"));
|
||||
}
|
||||
|
||||
void Courtroom::on_witness_testimony_clicked()
|
||||
{
|
||||
ao_app->send_server_packet(new AOPacket("RT#testimony1#%"));
|
||||
|
@ -72,6 +72,7 @@ public:
|
||||
void play_preanim();
|
||||
|
||||
void handle_wtce(QString p_wtce);
|
||||
void set_hp_bar(int p_bar, int p_state);
|
||||
|
||||
~Courtroom();
|
||||
|
||||
@ -134,6 +135,9 @@ private:
|
||||
int realization_state = 0;
|
||||
int text_color = 0;
|
||||
|
||||
int defense_bar_state = 0;
|
||||
int prosecution_bar_state = 0;
|
||||
|
||||
int current_emote_page = 0;
|
||||
int current_emote = 0;
|
||||
const int max_emotes_on_page = 10;
|
||||
@ -276,6 +280,11 @@ private slots:
|
||||
|
||||
void on_realization_clicked();
|
||||
|
||||
void on_defense_minus_clicked();
|
||||
void on_defense_plus_clicked();
|
||||
void on_prosecution_minus_clicked();
|
||||
void on_prosecution_plus_clicked();
|
||||
|
||||
void on_ooc_toggle_clicked();
|
||||
|
||||
void on_witness_testimony_clicked();
|
||||
|
@ -317,6 +317,11 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
||||
if (courtroom_constructed)
|
||||
w_courtroom->handle_wtce(f_contents.at(0));
|
||||
}
|
||||
else if (header == "HP")
|
||||
{
|
||||
if (courtroom_constructed && f_contents.size() > 1)
|
||||
w_courtroom->set_hp_bar(f_contents.at(0).toInt(), f_contents.at(1).toInt());
|
||||
}
|
||||
else if (header == "checkconnection")
|
||||
{
|
||||
send_server_packet(new AOPacket("CH#" + QString::number(w_courtroom->get_cid()) + "#%"));
|
||||
|
Loading…
Reference in New Issue
Block a user