diff --git a/aocharbutton.cpp b/aocharbutton.cpp index 41a4f40..01b3c1c 100644 --- a/aocharbutton.cpp +++ b/aocharbutton.cpp @@ -5,13 +5,50 @@ #include -AOCharButton::AOCharButton(QWidget *parent, AOApplication *p_ao_app) : QPushButton(parent) +AOCharButton::AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos, int y_pos) : QPushButton(parent) { m_parent = parent; ao_app = p_ao_app; this->resize(60, 60); + this->move(x_pos, y_pos); + + ui_taken = new AOImage(this, ao_app); + ui_taken->resize(60, 60); + ui_taken->set_image("char_taken.png"); + ui_taken->setAttribute(Qt::WA_TransparentForMouseEvents); + ui_taken->hide(); + + ui_passworded = new AOImage(this, ao_app); + ui_passworded->resize(60, 60); + ui_passworded->set_image("char_passworded"); + ui_passworded->setAttribute(Qt::WA_TransparentForMouseEvents); + ui_passworded->hide(); + + ui_selector = new AOImage(parent, ao_app); + ui_selector->resize(62, 62); + ui_selector->move(x_pos - 1, y_pos - 1); + ui_selector->set_image("char_selector.png"); + ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents); + ui_selector->hide(); +} + +void AOCharButton::reset() +{ + ui_taken->hide(); + ui_passworded->hide(); + ui_selector->hide(); +} + +void AOCharButton::set_taken() +{ + ui_taken->show(); +} + +void AOCharButton::set_passworded() +{ + ui_passworded->show(); } void AOCharButton::set_image(QString p_character) @@ -19,6 +56,8 @@ void AOCharButton::set_image(QString p_character) QString image_path = ao_app->get_character_path(p_character) + "char_icon.png"; QString legacy_path = ao_app->get_demothings_path() + p_character.toLower() + "_char_icon.png"; + this->setText(""); + if (file_exists(image_path)) this->setStyleSheet("border-image:url(\"" + image_path + "\")"); else if (file_exists(legacy_path)) @@ -33,3 +72,20 @@ void AOCharButton::set_image(QString p_character) this->setText(p_character); } } + +void AOCharButton::enterEvent(QEvent * e) +{ + ui_selector->raise(); + ui_selector->show(); + + setFlat(false); + QPushButton::enterEvent(e); +} + +void AOCharButton::leaveEvent(QEvent * e) +{ + ui_selector->hide(); + QPushButton::leaveEvent(e); +} + + diff --git a/aocharbutton.h b/aocharbutton.h index e91a120..f715416 100644 --- a/aocharbutton.h +++ b/aocharbutton.h @@ -6,20 +6,33 @@ #include #include #include +#include "aoimage.h" class AOCharButton : public QPushButton { Q_OBJECT public: - AOCharButton(QWidget *parent, AOApplication *p_ao_app); + AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos, int y_pos); AOApplication *ao_app; + void reset(); + void set_taken(); + void set_passworded(); + void set_image(QString p_character); private: QWidget *m_parent; + + AOImage *ui_taken; + AOImage *ui_passworded; + AOImage *ui_selector; + +protected: + void enterEvent(QEvent *e); + void leaveEvent(QEvent *e); }; #endif // AOCHARBUTTON_H diff --git a/base/background/gs4/bancoacusacion.gif b/base/background/gs4/bancoacusacion.gif deleted file mode 100644 index 7b330a3..0000000 Binary files a/base/background/gs4/bancoacusacion.gif and /dev/null differ diff --git a/base/background/gs4/bancoacusacion.png b/base/background/gs4/bancoacusacion.png deleted file mode 100644 index cce6bfe..0000000 Binary files a/base/background/gs4/bancoacusacion.png and /dev/null differ diff --git a/base/background/gs4/bancodefensa.gif b/base/background/gs4/bancodefensa.gif deleted file mode 100644 index bb30ac1..0000000 Binary files a/base/background/gs4/bancodefensa.gif and /dev/null differ diff --git a/base/background/gs4/bancodefensa.png b/base/background/gs4/bancodefensa.png deleted file mode 100644 index c7121cc..0000000 Binary files a/base/background/gs4/bancodefensa.png and /dev/null differ diff --git a/base/background/gs4/defenseempty.png b/base/background/gs4/defenseempty.png deleted file mode 100644 index fc9069e..0000000 Binary files a/base/background/gs4/defenseempty.png and /dev/null differ diff --git a/base/background/gs4/estrado.gif b/base/background/gs4/estrado.gif deleted file mode 100644 index cd5075f..0000000 Binary files a/base/background/gs4/estrado.gif and /dev/null differ diff --git a/base/background/gs4/estrado.png b/base/background/gs4/estrado.png deleted file mode 100644 index 9341a81..0000000 Binary files a/base/background/gs4/estrado.png and /dev/null differ diff --git a/base/background/gs4/gallery.gif b/base/background/gs4/gallery.gif deleted file mode 100644 index 4469bce..0000000 Binary files a/base/background/gs4/gallery.gif and /dev/null differ diff --git a/base/background/gs4/helperstand.png b/base/background/gs4/helperstand.png deleted file mode 100644 index 882c30c..0000000 Binary files a/base/background/gs4/helperstand.png and /dev/null differ diff --git a/base/background/gs4/judgestand.png b/base/background/gs4/judgestand.png deleted file mode 100644 index 6a17e7c..0000000 Binary files a/base/background/gs4/judgestand.png and /dev/null differ diff --git a/base/background/gs4/prohelperstand.png b/base/background/gs4/prohelperstand.png deleted file mode 100644 index 6554d32..0000000 Binary files a/base/background/gs4/prohelperstand.png and /dev/null differ diff --git a/base/background/gs4/prosecutorempty.png b/base/background/gs4/prosecutorempty.png deleted file mode 100644 index eecf852..0000000 Binary files a/base/background/gs4/prosecutorempty.png and /dev/null differ diff --git a/base/background/gs4/speedlineupclose.png b/base/background/gs4/speedlineupclose.png deleted file mode 100644 index 06dc9b3..0000000 Binary files a/base/background/gs4/speedlineupclose.png and /dev/null differ diff --git a/base/background/gs4/super anim.png b/base/background/gs4/super anim.png deleted file mode 100644 index fd3ec29..0000000 Binary files a/base/background/gs4/super anim.png and /dev/null differ diff --git a/base/background/gs4/tribunal.gif b/base/background/gs4/tribunal.gif deleted file mode 100644 index 4469bce..0000000 Binary files a/base/background/gs4/tribunal.gif and /dev/null differ diff --git a/base/background/gs4/witnessempty.png b/base/background/gs4/witnessempty.png deleted file mode 100644 index 11e22f7..0000000 Binary files a/base/background/gs4/witnessempty.png and /dev/null differ diff --git a/base/config.ini~ b/base/config.ini~ deleted file mode 100644 index 61e1883..0000000 --- a/base/config.ini~ +++ /dev/null @@ -1 +0,0 @@ -theme = default diff --git a/base/serverlist.txt b/base/serverlist.txt new file mode 100644 index 0000000..fef701d --- /dev/null +++ b/base/serverlist.txt @@ -0,0 +1,4 @@ +10.0.0.1:27071:the shit server +88.203.168.170:27777:Demon Server For Demons! Vanilla! 1.8+ +24.193.75.13:27053:The Flaming Phoenix +51.255.160.217:50000:Attorney Online Vidya(Dedicated) diff --git a/base/themes/default/courtroom_design.ini b/base/themes/default/courtroom_design.ini index c96d262..e7a3de4 100644 --- a/base/themes/default/courtroom_design.ini +++ b/base/themes/default/courtroom_design.ini @@ -8,7 +8,7 @@ area_list = 266, 494, 224, 174 music_list = 490, 342, 224, 326 ic_chat_message = 0, 192, 255, 23 ooc_chat_message = 492, 281, 222, 19 -ooc_chat_name = 492, 300, 32, 19 +ooc_chat_name = 492, 300, 85, 19 area_password = 266, 471, 224, 23 music_search = 490, 319, 226, 23 emote_left = 0, 253, 20, 20 @@ -20,6 +20,7 @@ sfx_label = 260, 410, 21, 16 blip_label = 260, 430, 31, 16 hold_it = 10, 312, 76, 28 objection = 90, 312, 76, 28 +take_that = 170, 312, 76, 28 ooc_toggle = 580, 300, 133, 19 witness_testimony = 5, 345, 85, 42 cross_examination = 95, 345, 85, 42 @@ -30,8 +31,8 @@ pre = 187, 345, 51, 21 flip = 187, 362, 51, 21 guard = 187, 379, 61, 21 custom_objection = 250, 325, 40, 40 -realization = 295, 323, 40, 40 -mute = 340, 325, 40, 40 +realization = 295, 325, 40, 40 +mute_button = 340, 325, 40, 40 defense_plus = 477, 325, 9, 9 defense_minus = 385, 325, 9, 9 prosecution_plus = 477, 342, 9, 9 diff --git a/base/themes/default/design.ini b/base/themes/default/design.ini deleted file mode 100644 index 5488ac4..0000000 --- a/base/themes/default/design.ini +++ /dev/null @@ -1,28 +0,0 @@ -hold_it = 10, 312 -objection = 90, 312 -take_that = 170, 312 -objection_custom = 250, 325 -realization = 295, 325 -mute = 340, 325 -text_color = 390, 360 -defense_bar = 393, 323 -prosecution_bar = 393, 340 -def_plus = 477, 325 -def_minus = 385, 325 -pro_plus = 477, 342 -pro_minus = 385, 342 -witness_testimony = 5, 345 -cross_examination = 95, 345 -pre = 187, 345 -flip = 187, 362 -guard = 187, 379 -change_character = 5, 390 -reload_theme = 5, 415 -call_mod = 5, 440 -music_label = 260, 390 -music_slider = 310, 392 -sfx_label = 260, 410 -sfx_slider = 310, 412 -blips_label = 260, 430 -blips_slider = 310, 432 - diff --git a/base/themes/default/loadingbackground.png b/base/themes/default/loadingbackground.png new file mode 100644 index 0000000..202a881 Binary files /dev/null and b/base/themes/default/loadingbackground.png differ diff --git a/base/themes/default/lobby_design.ini b/base/themes/default/lobby_design.ini new file mode 100644 index 0000000..efce59a --- /dev/null +++ b/base/themes/default/lobby_design.ini @@ -0,0 +1,16 @@ +lobby = 0, 0, 517, 666 +public_servers = 46, 88, 114, 30 +favorites = 164, 88, 114, 30 +refresh = 56, 381, 132, 28 +add_to_fav = 194, 381, 132, 28 +connect = 332, 381, 132, 28 +about = 428, 1, 88, 21 +server_list = 20, 125, 286, 240 +player_count = 336, 91, 173, 16 +description = 337, 109, 173, 245 +chatbox = 2, 445, 515, 198 +chatname = 3, 646, 85, 19 +chatmessage = 93, 646, 424, 19 +loading_label = 135, 92, 254, 95 +progress_bar = 135, 188, 254, 21 +cancel = 220, 220, 80, 20 diff --git a/base/themes/default/muted.png b/base/themes/default/muted.png index f9878f1..969da04 100644 Binary files a/base/themes/default/muted.png and b/base/themes/default/muted.png differ diff --git a/base/themes/default/muted_old.png b/base/themes/default/muted_old.png new file mode 100644 index 0000000..f9878f1 Binary files /dev/null and b/base/themes/default/muted_old.png differ diff --git a/courtroom.cpp b/courtroom.cpp index 282c70c..381d159 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -11,6 +11,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() { ao_app = p_ao_app; + char_button_mapper = new QSignalMapper(this); + ui_background = new AOImage(this, ao_app); //viewport elements like background, desk, etc. @@ -91,7 +93,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_char_select_background = new AOImage(this, ao_app); - //setting up the grid and positions + //constructing character button grid const int base_x_pos{25}; const int base_y_pos{36}; @@ -103,15 +105,37 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() for (int n = 0 ; n < 90 ; ++n) { - ui_char_button_list.append(new AOCharButton(ui_char_select_background, ao_app)); + int x_pos = base_x_pos + (x_modifier * x_mod_count); + int y_pos = base_y_pos + (y_modifier * y_mod_count); + + ui_char_button_list.append(new AOCharButton(ui_char_select_background, ao_app, x_pos, y_pos)); + + connect(ui_char_button_list.at(n), SIGNAL(clicked()), char_button_mapper, SLOT(map())) ; + char_button_mapper->setMapping (ui_char_button_list.at(n), n) ; + + ++x_mod_count; + + //if char number is divisible by ten with rest 9 then the next charicon should start on a new line + if (n % 10 == 9 && n != 0) + { + ++y_mod_count; + x_mod_count = 0; + } } + connect (char_button_mapper, SIGNAL(mapped(int)), this, SLOT(char_clicked(int))) ; + ui_selector = new AOImage(ui_char_select_background, ao_app); + ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents); + ui_selector->resize(62, 62); ui_back_to_lobby = new AOButton(ui_char_select_background, ao_app); ui_char_password = new QLineEdit(ui_char_select_background); + ui_char_select_left = new AOButton(ui_char_select_background, ao_app); + ui_char_select_right = new AOButton(ui_char_select_background, ao_app); + ui_spectator = new AOButton(ui_char_select_background, ao_app); connect(ui_change_character, SIGNAL(clicked()), this, SLOT(on_change_character_clicked())); @@ -120,6 +144,9 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(ui_back_to_lobby, SIGNAL(clicked()), this, SLOT(on_back_to_lobby_clicked())); + connect(ui_char_select_left, SIGNAL(clicked()), this, SLOT(on_char_select_left_clicked())); + connect(ui_char_select_right, SIGNAL(clicked()), this, SLOT(on_char_select_right_clicked())); + connect(ui_spectator, SIGNAL(clicked()), this, SLOT(on_spectator_clicked())); set_widgets(); @@ -256,10 +283,9 @@ void Courtroom::set_widgets() ui_char_select_background->move(0, 0); ui_char_select_background->resize(m_courtroom_width, m_courtroom_height); - //T0D0: uncomment and set position properly - //QVector ui_char_button_list; + //buttons are in the constructor - ui_selector->set_image("selector.png"); + ui_selector->set_image("char_selector.png"); ui_selector->hide(); ui_back_to_lobby->setText("Back to Lobby"); @@ -267,6 +293,14 @@ void Courtroom::set_widgets() set_size_and_pos(ui_char_password, "char_password"); + ui_char_select_left->set_image("arrow_left.png"); + ui_char_select_left->move(2, 325); + ui_char_select_left->resize(20, 20); + + ui_char_select_right->set_image("arrow_right.png"); + ui_char_select_right->move(691, 325); + ui_char_select_right->resize(20, 20); + ui_spectator->setText("Spectator"); set_size_and_pos(ui_spectator, "spectator"); @@ -305,13 +339,57 @@ void Courtroom::set_taken(int n_char, bool p_taken) } char_type f_char; - f_char.name = char_list.at(0).name; - f_char.description = char_list.at(1).description; + f_char.name = char_list.at(n_char).name; + f_char.description = char_list.at(n_char).description; f_char.taken = p_taken; char_list.replace(n_char, f_char); } +void Courtroom::set_char_select_page() +{ + ui_char_select_background->show(); + + ui_char_select_left->hide(); + ui_char_select_right->hide(); + + for (AOCharButton *i_button : ui_char_button_list) + i_button->hide(); + + int total_pages = char_list.size() / 90; + int chars_on_page = 0; + + if (char_list.size() % 90 != 0) + { + ++total_pages; + //i. e. not on the last page + if (total_pages > current_char_page + 1) + chars_on_page = 90; + else + chars_on_page = char_list.size() % 90; + + } + else + chars_on_page = 90; + + qDebug() << "chars_on_page: " << chars_on_page; + + if (total_pages > current_char_page + 1) + ui_char_select_right->show(); + + if (current_char_page > 0) + ui_char_select_left->show(); + + for (int n_button = 0 ; n_button < chars_on_page ; ++n_button) + { + int n_real_char = n_button + current_char_page * 90; + + ui_char_button_list.at(n_button)->set_image(char_list.at(n_real_char).name); + ui_char_button_list.at(n_button)->show(); + } + +} + void Courtroom::on_change_character_clicked() { ui_char_select_background->show(); @@ -331,11 +409,28 @@ void Courtroom::on_back_to_lobby_clicked() ao_app->destruct_courtroom(); } +void Courtroom::on_char_select_left_clicked() +{ + --current_char_page; + set_char_select_page(); +} + +void Courtroom::on_char_select_right_clicked() +{ + ++current_char_page; + set_char_select_page(); +} + void Courtroom::on_spectator_clicked() { ui_char_select_background->hide(); } +void Courtroom::char_clicked(int n_char) +{ + +} + Courtroom::~Courtroom() { diff --git a/courtroom.h b/courtroom.h index ec31961..5b2a111 100644 --- a/courtroom.h +++ b/courtroom.h @@ -16,6 +16,7 @@ #include #include #include +#include class AOApplication; @@ -32,6 +33,7 @@ public: void set_widgets(); void set_size_and_pos(QWidget *p_widget, QString p_identifier); void set_taken(int n_char, bool p_taken); + void set_char_select_page(); ~Courtroom(); @@ -51,8 +53,15 @@ private: QVector evidence_list; QVector music_list; + QSignalMapper *char_button_mapper; + + //0 is the first page, 1 second etc. + //makes char arithmetic easier + int current_char_page = 0; + AOImage *ui_background; - //viewport elements like background, desk, etc. + + //T0D0: add viewport elements like background, desk, etc. QPlainTextEdit *ui_ic_chatlog; @@ -72,7 +81,7 @@ private: QLineEdit *ui_area_password; QLineEdit *ui_music_search; - //emote buttons + //T0D0: add emote buttons AOButton *ui_emote_left; AOButton *ui_emote_right; @@ -129,6 +138,9 @@ private: QLineEdit *ui_char_password; + AOButton *ui_char_select_left; + AOButton *ui_char_select_right; + AOButton *ui_spectator; private slots: void on_change_character_clicked(); @@ -138,6 +150,11 @@ private slots: void on_spectator_clicked(); + void on_char_select_left_clicked(); + void on_char_select_right_clicked(); + + void char_clicked(int n_char); + }; #endif // COURTROOM_H diff --git a/packet_distribution.cpp b/packet_distribution.cpp index a20429e..d53b5a6 100644 --- a/packet_distribution.cpp +++ b/packet_distribution.cpp @@ -176,6 +176,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet) w_lobby->set_loading_text("Loading chars:\n" + QString::number(loaded_chars) + "/" + QString::number(char_list_size)); w_courtroom->append_char(f_char); + //qDebug() << "appended " << f_char.name << " to char_list"; } if (loaded_chars < char_list_size) @@ -278,6 +279,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet) if (!courtroom_constructed) return; + w_courtroom->set_char_select_page(); + w_courtroom->show(); destruct_lobby();