diff --git a/assets/modern/pages.rcss b/assets/modern/pages.rcss index 6dc5c4a..cb02b23 100644 --- a/assets/modern/pages.rcss +++ b/assets/modern/pages.rcss @@ -323,3 +323,56 @@ body .popup-box input {height:84dp;padding:0 26dp;border:2dp var(--p-div);border .alm-row .pg-match-side strong {display:block;white-space:nowrap;} .alm-ball {display:block;width:30dp;height:30dp;border:3dp var(--p-n9);border-radius:15dp;background-color:var(--p-n1);} .alm-event span {display:block;} + +/* --- the line-up: the squad as a table, the eleven as shirts on the pitch --- */ +.pg-root .lp-cell,.pg-root .lp-cell:hover {display:block;flex:none;height:100%;padding:0 8dp;border:0dp;border-radius:0dp;background-color:transparent;decorator:none;font-family:Modern;font-size:30dp;font-weight:normal;color:var(--p-text);text-align:center;white-space:nowrap;overflow:hidden;} +.lp-cell span,.lp-cell strong {display:inline-block;} +.lp-cell .pg-pos,.lp-cell .pg-dots,.lp-cell .pg-tag,.lp-flag {display:inline-block;vertical-align:middle;} +.lp-cell .pg-dots span {display:inline-block;margin:0 3dp;} +.lp-flag {width:45dp;height:27dp;} +.lp-pitch {display:block;position:relative;flex:none;border:2dp var(--p-n5);border-radius:58dp;overflow:hidden;} +.lp-shirt,.lp-shirt:hover,.lp-shirt:disabled {display:flex;flex-direction:column;align-items:center;width:220dp;padding:4dp 0;border:0dp;border-radius:27dp;background-color:transparent;decorator:none;} +.lp-shirt:hover {background-color:#ffffff40;} +.lp-shirt.sel,.lp-shirt.sel:hover {background-color:#ffffff80;border:6dp var(--p-a8);padding:0;width:220dp;} +.lp-shirt-art {display:block;position:relative;width:100dp;height:100dp;} +.lp-num {display:block;position:absolute;left:0;top:24dp;width:100dp;line-height:44dp;text-align:center;font-family:Display;font-size:34dp;color:#ffffff;} +.lp-name {display:block;max-width:214dp;height:38dp;line-height:38dp;padding:0 16dp;border-radius:19dp;background-color:var(--p-n1);font-family:Modern;font-size:26dp;font-weight:bold;color:var(--p-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;} +.lp-team {gap:14dp;overflow-y:auto;} +.lp-team-row {display:flex;flex-wrap:wrap;gap:14dp 0dp;} +.lp-team .lp-shirt {width:206dp;} +.lp-team .lp-shirt:hover {background-color:var(--p-row);} +.lp-team .lp-shirt.sel {background-color:var(--p-a1);width:206dp;} +.lp-dot {border-radius:14dp;} +.lp-dot.a {background-color:#3fae6a;} .lp-dot.b {background-color:#e0b23c;} .lp-dot.c {background-color:#d9534f;} +.pg-root .lp-cell {line-height:64dp;} +.lp-pairs {display:flex;flex-wrap:wrap;margin-top:6dp;} +.lp-pair {display:block;width:50%;font-size:28dp;line-height:38dp;} +.lp-pair strong {font-weight:bold;} + +/* --- friendlies: the opponents as tiles, both crests on each --- */ +.fr-tiles {display:flex;flex-wrap:wrap;gap:18dp;align-content:flex-start;padding:4dp;} +.pg-root .fr-tile,.pg-root .fr-tile:hover {display:flex;align-items:center;gap:18dp;width:677dp;height:150dp;padding:0 27dp;border:2dp var(--p-div);border-radius:45dp;background-color:var(--p-n1);decorator:none;font-family:Modern;font-size:30dp;color:var(--p-text);text-align:left;} +.pg-root .fr-tile:hover {border-color:var(--p-a6);} +.pg-root .fr-tile.sel,.pg-root .fr-tile.sel:hover {background-color:var(--p-a1);border-color:var(--p-a6);} +.fr-versus {display:block;flex:none;font-family:Display;font-size:26dp;color:var(--p-n6);} +.fr-tile-text {display:block;flex:1;min-width:0;} +.fr-tile-text strong {display:block;font-weight:bold;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;} +.fr-tile-text small {display:block;font-size:26dp;line-height:34dp;color:var(--p-n7);} +.fr-tile .pg-num {flex:none;} + +/* --- training: the game's own arrangement and pictures on the page --- */ +.tr-skill {display:flex;flex:none;align-items:center;gap:22dp;height:84dp;border-bottom:2dp var(--p-rule);} +.pg-root .training-balls {display:flex;flex:none;align-items:center;} +.pg-root .training-ball,.pg-root .training-ball:hover,.pg-root .training-ball:disabled {display:block;flex:none;padding:0;border:0dp;border-radius:40dp;background-color:transparent;decorator:none;} +.pg-root .training-ball.is-empty {opacity:.22;} +.pg-root .training-ball:hover {opacity:.75;} +.tr-pitch {display:block;position:relative;flex:none;width:540dp;height:440dp;border:2dp var(--p-n5);border-radius:36dp;overflow:hidden;} +.tr-stripe {position:absolute;top:0;width:54dp;height:440dp;} +.tr-line {position:absolute;border:3dp #fdfbf4;} +.tr-line.mid {left:268dp;top:0;width:0dp;height:440dp;border-width:0dp 0dp 0dp 3dp;} +.tr-line.circle {left:215dp;top:165dp;width:104dp;height:104dp;border-radius:55dp;} +.tr-line.box {top:120dp;width:70dp;height:194dp;} +.tr-line.box.left {left:-3dp;} .tr-line.box.right {right:-3dp;} +.tr-type {position:absolute;padding:8dp 14dp;border-radius:27dp;background-color:#fdfbf4cc;} +.pg-root .tr-auto {height:60dp;font-size:28dp;} +.tr-player select {width:360dp;height:54dp;padding:0 18dp;border:2dp var(--p-div);border-radius:27dp;background-color:var(--p-n1);font-size:27dp;color:var(--p-text);} diff --git a/src/modern/ui/lineup_page.inc b/src/modern/ui/lineup_page.inc new file mode 100644 index 0000000..afa6e60 --- /dev/null +++ b/src/modern/ui/lineup_page.inc @@ -0,0 +1,164 @@ +// SPDX-License-Identifier: GPL-3.0-only +// The line-up as a page of the notebook (the real game): the squad as a table at the left, +// grouped into starting eleven, bench and the rest; at the right the pitch seen from behind +// the own goal with the eleven as shirts, or the whole squad as shirts. Two players are +// clicked to swap them; any other cell of a row opens the player's card. +std::string App::render_lineup_page() { + const auto projection = engine_lineup_projection(engine_data_); + if (!projection.value("ok", false)) return "
Die Aufstellung ist derzeit nicht verfügbar.
"; + const auto &l = projection.at("board"); + const auto &rows = projection.at("rows"); + const int field_count = projection.at("field_count").get(); + const bool indoor = projection.at("surface") == "indoor"; + if (lineup_slot(l, lineup_selected_) < 0) lineup_selected_.clear(); + lineup_data_ = lineup_data_ == 1 ? 1 : 0; + const auto attr = [](const std::string &key, const std::string &value) { return " " + key + "=\"" + esc(value) + "\""; }; + const auto player_attrs = [&](const Json &row, const std::string &prefix) { + const auto id = row.at("id").get(); + return attr("id", prefix + id) + attr("data-id", id) + attr("data-squad-player", id) + attr("data-slot", std::to_string(row.at("slot").get())) + + attr("aria-pressed", lineup_selected_ == id ? "true" : "false") + attr("aria-label", row.at("name").get() + ", " + lineup_position(row.at("position"))); + }; + const auto last_name = [](const std::string &name) { const auto at = name.rfind(' '); return at == std::string::npos ? name : name.substr(at + 1); }; + const auto flag = [&](const Json &nation) -> std::string { + if (!nation.is_string()) return "—"; + auto code = nation.get(); + if (code.starts_with("nation:")) code = code.substr(7); + const auto svg = code == "de" ? lineup_svg("", "0 0 40 24") : ui_nation_flag_svg(code); + if (!svg.empty()) return "" + picture(renderer_.diagram("lineup-flag-" + code, svg, 80), 45, 27) + ""; + std::transform(code.begin(), code.end(), code.begin(), [](unsigned char c) { return char(std::toupper(c)); }); + return code.size() == 2 ? esc(code) : std::string("—"); + }; + + // --- the table --- + struct Column { const char *label, *key; double width; const char *align; }; + const std::vector columns = lineup_data_ == 0 + ? std::vector{{"Nr.", "", 40, "r"}, {"Name", "", 0, ""}, {"Pos.", "position", 60, "c"}, {"Ko", "condition", 42, "c"}, {"Te", "technique", 42, "c"}, {"Fo", "form", 42, "c"}, {"Stärke", "strength", 60, "c"}, + {"Status", "status", 104, "c"}, {"Land", "nation", 50, "c"}, {"Sp.", "games", 42, "c"}, {"Tore", "goals", 46, "c"}, {"Vorl.", "assists", 46, "c"}} + : std::vector{{"Nr.", "", 40, "r"}, {"Name", "", 0, ""}, {"Alter", "age", 54, "c"}, {"Eck.", "corner", 58, "c"}, {"Frei.", "free_kick", 58, "c"}, {"Zwei.", "tackling", 58, "c"}, {"Pass", "passing", 58, "c"}, + {"Schuss", "shooting", 58, "c"}, {"Schn.", "speed", 58, "c"}, {"Team", "teamplay", 58, "c"}, {"Spiele", "games", 56, "c"}, {"Note", "grade", 52, "c"}}; + std::string out = "
"; + for (const auto &column : columns) out += pg_th(column.label, column.width, column.align); + out += "
"; + int group = -1; + for (const auto &row : rows) { + const auto slot = row.at("slot").get(); + const auto id = row.at("id").get(); + const int part = slot < field_count ? 0 : row.value("role", std::string()) == "bench" ? 1 : 2; + if (part != group) { + group = part; + out += "
" + pg_td(pg_upper(part == 0 ? (indoor ? "Aufgebot" : "Startelf") : part == 1 ? "Ersatzbank" : "Übriger Kader"), 0) + "
"; + } + out += "
"; + size_t field = 0; + for (const auto &column : columns) { + const std::string key = column.key; + if (std::string(column.label) == "Nr.") { out += pg_td(slot < field_count ? std::to_string(slot + 1) : std::string("–"), column.width, "r"); continue; } + if (std::string(column.label) == "Name") { + auto name = esc(row.at("name").get()); + if (row.at("pair_number").is_number_integer()) name += "P" + std::to_string(row.at("pair_number").get()); + out += pg_td(btn("lineup-player", "" + name + "", "pg-link", player_attrs(row, "lineup-name-")), 0, "", true); + continue; + } + std::string value; + if (key == "position") value = pg_pos(lineup_position(row.at("position"))); + else if (key == "nation") value = flag(row.at("nation")); + else if (key == "status") { + const auto text = row.at("status").get(); + const bool out_of_action = text.find("erletz") != std::string::npos || text.find("esperr") != std::string::npos; + value = out_of_action ? "" + esc(text) + "" : "" + esc(text) + ""; + } else if (key == "strength") value = "" + esc(lineup_value(row.at(key))) + ""; + else if (lineup_data_ == 1 && key != "age" && key != "games" && key != "grade" && row.at(key).is_number_integer() && row.at(key).get() >= 0 && row.at(key).get() <= 3) + value = pg_dots(row.at(key).get(), 3); + else value = "" + esc(lineup_value(row.at(key))) + ""; + out += btn("player-detail", value, std::string("pg-td lp-cell ") + column.align, + attr("id", "lineup-detail-" + id + "-" + std::to_string(field++)) + attr("data-id", id) + attr("aria-label", row.at("name").get() + ", Spielerinformationen") + " style=\"width:" + pg(column.width) + ";\""); + } + out += "
"; + } + if (rows.empty()) out += "
Für diesen Verein sind keine Spieler überliefert.
"; + out += "
"; + + // --- the pitch or the squad as shirts --- + std::string shirt_colour; + if (const auto *club = world_->find("clubs", engine_data_.at("desktop").at("meta").at("scope").at("teamId").get()); club && !club->value("crest", "").empty()) + shirt_colour = renderer_.crest_colour(club->value("crest", "")); + if (shirt_colour.empty()) shirt_colour = "#b2622d"; + const double shirt_size = 100; + const auto shirt = [&](const Json &row, size_t index, const std::string &style) { + const auto &condition = row.contains("condition") ? row.at("condition") : Json(); + const bool selected = lineup_selected_ == row.at("id").get(); + const std::string level = condition.is_number_integer() ? (condition.get() >= 85 ? "a" : condition.get() >= 70 ? "b" : "c") : "n"; + return btn("lineup-player", "" + picture(renderer_.diagram("lineup-shirt-" + shirt_colour + (selected ? "-s-" : "-n-") + level, lineup_shirt(shirt_colour, selected, condition), 160), shirt_size, shirt_size) + + "" + (index < size_t(field_count) ? std::to_string(index + 1) : std::string()) + "" + esc(last_name(row.at("name").get())) + "", + std::string("lp-shirt") + (selected ? " sel" : ""), player_attrs(row, "lineup-player-") + (style.empty() ? std::string() : " style=\"" + style + "\"")); + }; + const double side_width = 900, pitch_height = 1512 - 27 - (indoor ? 420 : 250); + out += "
"; + if (lineup_pitch_) { + std::string stripes; + for (int band = 0; band < 8; ++band) + stripes += ""; + const auto field = "" + stripes + + ""; + out += "
" + + picture(renderer_.diagram(std::string("lineup-page-field") + (indoor ? "-indoor" : ""), field, 900), side_width, pitch_height, true); + const double depth_max = l.value("depth_max", 18), lane_max = l.value("lane_max", 8); + for (size_t i = 0; i < std::min(size_t(field_count), rows.size()); ++i) { + const auto &row = rows[i], &point = l.at("points")[i]; + if (point.is_null()) continue; + // the own goal is at the bottom: depth runs up the pitch, the lanes from left to right + const bool paired = row.at("pair_number").is_number_integer(); + const double x = (14 + point[1].get() / lane_max * 72) / 100 * side_width + (paired ? (row.at("pair_member") == 0 ? -0.62 : 0.62) * shirt_size : 0); + const double y = (87 - point[0].get() / depth_max * 76) / 100 * pitch_height; + out += shirt(row, i, "position:absolute;left:" + scalar(x - 110) + "dp;top:" + scalar(y - 70) + "dp;"); + } + out += "
"; + } else { + out += "
"; + for (int part = 0; part < 3; ++part) { + std::string shirts; + for (size_t i = 0; i < rows.size(); ++i) { + const int slot = rows[i].at("slot").get(); + if ((slot < field_count ? 0 : rows[i].value("role", std::string()) == "bench" ? 1 : 2) == part) shirts += shirt(rows[i], size_t(slot), ""); + } + if (!shirts.empty()) out += pg_kicker(part == 0 ? (indoor ? "Aufgebot" : "Startelf") : part == 1 ? "Ersatzbank" : "Reserve") + "
" + shirts + "
"; + } + out += "
"; + } + out += "
Aufstellung" + "ab 85ab 70" + "darunter
Zwei Spieler zum Tauschen anklicken." + "Der Tausch wird erst nach Bestätigung übernommen."; + if (indoor) { + out += "
" + pg_kicker("Halle · Wechselpaare", "width:100%;"); + for (const auto &pair : projection.at("pairs")) { + std::string names; + for (const auto &id : pair.at("playerIds")) + for (const auto &row : rows) if (row.at("id") == id) names += (names.empty() ? "" : " / ") + last_name(row.at("name").get()); + out += "P" + std::to_string(pair.at("number").get()) + " · " + esc(names) + ""; + } + if (projection.at("pairs").empty()) out += "Keine Wechselpaare bestätigt."; + out += "
"; + } + out += "
"; + + // --- the foot --- + const auto pair_of = [&](const char *action, const char *id, const std::string &first, const std::string &second, bool second_on) { + std::string seg = "
"; + for (int i = 0; i < 2; ++i) { + const bool on = (i == 1) == second_on; + seg += btn(action, "" + (i ? second : first) + "", std::string(i ? "" : "first ") + (on ? "on" : ""), on ? std::string("style=\"pointer-events:none;\" aria-pressed=\"true\"") : "id=\"" + std::string(id) + "\" aria-pressed=\"false\""); + } + return seg + "
"; + }; + std::string status = engine_busy_ ? engine_operation_ : engine_notice_; + if (!lineup_selected_.empty()) + for (const auto &row : rows) if (row.at("id") == lineup_selected_) status = row.at("name").get() + " markiert · zweiten Spieler wählen."; + if (status.empty()) status = "Kein Spieler markiert."; + out += "
"; + return out + engine_player_profile(projection); +} diff --git a/src/modern/ui/lineup_screens.inc b/src/modern/ui/lineup_screens.inc index 5eb16aa..c178975 100644 --- a/src/modern/ui/lineup_screens.inc +++ b/src/modern/ui/lineup_screens.inc @@ -164,6 +164,7 @@ std::string lineup_zone(const Json &l, const std::string &id) { } // namespace std::string App::render_lineup() { + if (engine_mode_ && page_native()) return render_lineup_page(); const auto s = engine_mode_ ? Snapshot{0, world_, Json()} : snap(); if (!s.world) return "

Die Aufstellung ist derzeit nicht " diff --git a/src/modern/ui/pages.inc b/src/modern/ui/pages.inc index 1ad0211..54180e6 100644 --- a/src/modern/ui/pages.inc +++ b/src/modern/ui/pages.inc @@ -5,8 +5,8 @@ // The menus that are laid out as a page of the notebook. Every other career menu is still a // sheet of the old format, shown scaled inside the book. bool App::page_native() const { - static const std::set native{"almanac", "tactics", "achievements", "highscore", "balance", "contracts", "environment", "tables", "league", "other", "strengths", "fairplay", "indoor", "scorers"}; - if (menu_ == "calendar" || menu_ == "postpone") return notebook_page() && engine_mode_; + static const std::set native{"training", "almanac", "tactics", "achievements", "highscore", "balance", "contracts", "environment", "tables", "league", "other", "strengths", "fairplay", "indoor", "scorers"}; + if (menu_ == "calendar" || menu_ == "postpone" || menu_ == "lineup") return notebook_page() && engine_mode_; // a national coach arranges friendlies on the older sheet if (menu_ == "friendlies") return notebook_page() && engine_mode_ && engine_data_.contains("desktop") && engine_data_.at("desktop").at("meta").at("scope").at("role") == "club"; if (menu_ == "calendar") return notebook_page() && engine_mode_; // the demo keeps its older calendar diff --git a/src/modern/ui/planning_page.inc b/src/modern/ui/planning_page.inc index 7856a99..42aa1c3 100644 --- a/src/modern/ui/planning_page.inc +++ b/src/modern/ui/planning_page.inc @@ -85,13 +85,16 @@ std::string App::engine_friendlies_view() { std::string out="

"+pg_kicker(league?world_->name(*league):std::string("Weitere Vereine"))+"

Freundschaftsspiel vereinbaren · Saison "+esc(engine_data_.at("desktop").at("meta").at("season").at("label").get())+"

"+page_steps("Gegner","Termin",booking)+"
"; if(!booking) { - out+="
"+pg_th("Gegner",0)+pg_th("Stärke",110,"r")+"
"; + // the opponents as tiles in four columns: the own crest, the opponent's, its name and strength + const auto *own_club=world_->find("clubs",engine_data_.at("desktop").at("meta").at("scope").at("teamId").get()); + out+="
"; for(const auto &r:plan.at("opponents"))if(friendly_league_key(r)==engine_friendly_league_) { const auto &team=r.at("team");const auto id=team.at("id").get(); - out+="
"+pg_td(btn("friendly-opponent",crest(world_->find("clubs",id),50)+""+esc(engine_text(team.at("name")))+"","pg-link","id=\"friendly-opponent-"+esc(id)+"\" data-id=\""+esc(id)+"\" aria-pressed=\""+(id==engine_friendly_opponent_?"true":"false")+"\""),0,"",true)+ - pg_td(""+(r.at("strength").is_number_integer()?number(r.at("strength")):std::string("—"))+"",110,"r")+"
"; + out+=btn("friendly-opponent",crest(own_club,84)+"–"+crest(world_->find("clubs",id),84)+""+esc(engine_text(team.at("name")))+"Stärke"+ + (r.at("strength").is_number_integer()?number(r.at("strength")):std::string("—"))+"",std::string("fr-tile ")+(id==engine_friendly_opponent_?"sel":""), + "id=\"friendly-opponent-"+esc(id)+"\" data-id=\""+esc(id)+"\" aria-pressed=\""+(id==engine_friendly_opponent_?"true":"false")+"\""); } - out+="
"; } else { const auto calendar=engine_calendar_view();const auto &dates=quote.at("dates");const bool available=std::find(dates.begin(),dates.end(),Json(engine_friendly_date_))!=dates.end(); diff --git a/src/modern/ui/sports_screens.inc b/src/modern/ui/sports_screens.inc index 42f0731..f7ac915 100644 --- a/src/modern/ui/sports_screens.inc +++ b/src/modern/ui/sports_screens.inc @@ -22,89 +22,41 @@ std::string App::training_balls(const std::string &group, int index, int value, "dp;\" " + (automatic ? "disabled" : "")); return body + "
"; } +// Training as a page of the notebook, in the game's own arrangement and pictures: the nine +// areas with their marks at the left, under them the pitch with the four kinds of session and +// the automatic switches; at the right every player with his focus and intensity. std::string App::render_training() { const auto t = engine_mode_ ? engine_training_draft_ : snap().state.at("training"); const auto &automatic = t.at("autos"); - const std::array skills = { - "Kondition", "Technik", "Eckball", "Freistoß", "Zweikampf", - "Pass", "Schuss", "Schnelligkeit", "Teamplay"}; - const std::vector> focuses = { - {"0", "Allgemein"}, {"1", "Eckball"}, {"2", "Freistoß"}, - {"3", "Zweikampf"}, {"4", "Pass"}, {"5", "Schuss"}, - {"6", "Schnelligkeit"}, {"7", "Teamplay"}}; + const std::array skills = {"Kondition", "Technik", "Eckball", "Freistoß", "Zweikampf", "Pass", "Schuss", "Schnelligkeit", "Teamplay"}; + const std::vector> focuses = {{"0", "Allgemein"}, {"1", "Eckball"}, {"2", "Freistoß"}, {"3", "Zweikampf"}, {"4", "Pass"}, {"5", "Schuss"}, {"6", "Schnelligkeit"}, {"7", "Teamplay"}}; int skill_total = 0, type_total = 0; - for (size_t i = 2; i < 9; ++i) - skill_total += t["areas"][i].get(); - for (const auto &v : t["types"]) - type_total += v.get(); - std::string body = "
"; + for (size_t i = 2; i < 9; ++i) skill_total += t["areas"][i].get(); + for (const auto &v : t["types"]) type_total += v.get(); + // the areas + std::string body = "
"; for (size_t i = 0; i < 9; ++i) - body += - "
" + - img("training.skill." + std::to_string(i), 80, 80, false, false, 160) + - "
" + skills[i] + - ":
" + - training_balls("area", int(i), t["areas"][i].get(), - !engine_mode_ && automatic[i < 2 ? 1 : 2].get(), {}, 56, 10, - !engine_mode_ && i >= 2 && skill_total > 14) + - "
"; - body += "
"; - for (int i = 0; i < 10; ++i) - body += "
"; - body += "
"; + body += "
" + img("training.skill." + std::to_string(i), 72, 72, false, false, 160) + "" + skills[i] + "" + + training_balls("area", int(i), t["areas"][i].get(), !engine_mode_ && automatic[i < 2 ? 1 : 2].get(), {}, 54, 10, !engine_mode_ && i >= 2 && skill_total > 14) + "
"; + // the pitch with the four kinds of session, the budget and the switches beside it + body += "
"; + for (int i = 0; i < 10; ++i) body += "
"; + body += "
"; for (int i = 0; i < 4; ++i) - body += "
" + - training_balls("type", i, t["types"][size_t(i)].get(), - !engine_mode_ && automatic[0].get(), {}, 48, 5) + - "
"; - body += "
"; - const std::array auto_names = { - "AUTO · Arten", "AUTO · Kondition", "AUTO · Fertigkeiten", - "AUTO · Spieler"}; - const std::array, 4> auto_boxes = { - {{0, 1456, 570, 76}, - {604, 1040, 440, 76}, - {604, 1136, 440, 76}, - {2312, 1803, 300, 61}}}; - for (size_t i = 0; i < 4; ++i) { - const auto a = auto_boxes[i]; - body += btn( - "training-auto", auto_names[i], - std::string(i == 3 ? "training-auto auto-players " : "training-auto ") + - (automatic[i].get() ? "primary" : ""), - "id=\"training-auto-" + std::to_string(i) + "\" data-id=\"" + - std::to_string(i) + "\" style=\"position:absolute;" + - rect(a[0], a[1], a[2], a[3]) + "\" " + (engine_mode_ ? "disabled" : "")); - } - const bool all_auto = engine_mode_ ? t.at("master_auto").get() : std::all_of(automatic.begin(), automatic.end(), - [](const auto &v) { return v == true; }); - body += btn("training-auto-all", "Automatisch", - std::string("training-auto ") + (all_auto ? "primary" : ""), - "id=\"training-auto-all\" style=\"position:absolute;" + - rect(604, 1232, 440, 76) + "\" " + (engine_mode_ ? "disabled" : "")); - body += "

Arten: " + std::to_string(type_total) + - " / " + std::to_string(engine_mode_ ? t.at("limits").at("types").get() : 8) + " Bälle ·
Kondition/Technik: " + - std::to_string(t["areas"][0].get() + t["areas"][1].get()) + - " / " + std::to_string(engine_mode_ ? t.at("limits").at("fitnessAndSkill").get() : 4) + " ·
Fertigkeiten: " + std::to_string(skill_total) + " / " + std::to_string(engine_mode_ ? t.at("limits").at("otherAreas").get() : 18) + - (!engine_mode_ && skill_total > 14 ? " · hohe
Belastung" : "") + - "

"; - const std::array headings = {"Pos.", "Spieler", "Stärke", - "Schwerpunkt", "Intensität"}; - const std::array widths = {90, 760, 95, 330, 217}; - for (size_t i = 0; i < 5; ++i) - body += "
" + - headings[i] + "
"; - body += "
"; + body += "
" + + training_balls("type", i, t["types"][size_t(i)].get(), !engine_mode_ && automatic[0].get(), {}, 52, 6) + "
"; + body += "
" + pg_kicker("Ballbudget") + + "
Arten" + std::to_string(type_total) + " / " + std::to_string(engine_mode_ ? t.at("limits").at("types").get() : 8) + "
Kondition/Technik" + + std::to_string(t["areas"][0].get() + t["areas"][1].get()) + " / " + std::to_string(engine_mode_ ? t.at("limits").at("fitnessAndSkill").get() : 4) + "
Fertigkeiten" + + std::to_string(skill_total) + " / " + std::to_string(engine_mode_ ? t.at("limits").at("otherAreas").get() : 18) + (!engine_mode_ && skill_total > 14 ? " · hohe Belastung" : "") + "
"; + const std::array auto_names = {"AUTO · Arten", "AUTO · Kondition", "AUTO · Fertigkeiten", "AUTO · Spieler"}; + for (size_t i = 0; i < 4; ++i) + body += pg_button("training-auto", auto_names[i], std::string("block tr-auto ") + (automatic[i].get() ? "on" : ""), "id=\"training-auto-" + std::to_string(i) + "\" data-id=\"" + std::to_string(i) + "\" " + (engine_mode_ ? "disabled" : "")); + const bool all_auto = engine_mode_ ? t.at("master_auto").get() : std::all_of(automatic.begin(), automatic.end(), [](const auto &v) { return v == true; }); + body += pg_button("training-auto-all", "Automatisch", std::string("block tr-auto ") + (all_auto ? "on" : ""), "id=\"training-auto-all\" " + std::string(engine_mode_ ? "disabled" : "")) + "
"; + // the players + body += "
" + pg_th("Pos.", 56) + pg_th("Spieler", 0) + pg_th("Stärke", 70, "r") + pg_th("Schwerpunkt", 170) + + pg_th("Intensität", 100) + "
"; std::vector players; if (engine_mode_) { for (const auto &p : t.at("roster")) players.push_back(&p); } else players = world_->squad(t.value("club", "")); @@ -113,31 +65,15 @@ std::string App::render_training() { const auto id = p->value("id", ""); const auto &row = t["players"].at(id); const auto position = p->value("positions", Json::array()); - const auto pos = position.empty() ? "" : position[0].get(); - body += - "
" + - std::string(pos == "gk" ? "TW" - : pos == "def" ? "ABW" - : pos == "mid" ? "MIT" - : pos == "fwd" ? "STU" - : pos) + - "
name(*p)) + "\">" + esc(world_->name(*p)) + - "
" + - sports_number(p->value("attributes", Json::object()).value("strength", Json())) + - "
"; - auto selector = - select("training-focus-" + std::to_string(i), focuses, - std::to_string(row.value("focus", 0)), "training-focus"); - const auto end = selector.find('>'); - selector.insert(end, " data-player=\"" + esc(id) + "\" " + - (engine_mode_ || automatic[3] == true ? "disabled" : "")); - body += selector + "
" + - training_balls("player", int(i), row.value("intensity", 0), - !engine_mode_ && automatic[3].get(), id, 50, 9) + - "
"; + const auto pos = position.empty() ? std::string() : position[0].get(); + auto selector = select("training-focus-" + std::to_string(i), focuses, std::to_string(row.value("focus", 0)), "training-focus"); + selector.insert(selector.find('>'), " data-player=\"" + esc(id) + "\" " + (engine_mode_ || automatic[3] == true ? "disabled" : "")); + body += "
" + pg_td(pg_pos(pos == "gk" ? "TW" : pos == "def" ? "ABW" : pos == "mid" ? "MIT" : pos == "fwd" ? "STU" : pos), 56, "", true) + + pg_td("name(*p)) + "\">" + esc(world_->name(*p)) + "", 0) + pg_td("" + sports_number(p->value("attributes", Json::object()).value("strength", Json())) + "", 70, "r") + + pg_td(selector, 170, "", true) + pg_td(training_balls("player", int(i), row.value("intensity", 0), !engine_mode_ && automatic[3].get(), id, 50, 8), 100, "", true) + "
"; } - return body + "
" + (engine_mode_ ? engine_sports_footer() : ""); + body += "
"; } diff --git a/src/modern/ui/view.cpp b/src/modern/ui/view.cpp index 312449f..a0e7210 100644 --- a/src/modern/ui/view.cpp +++ b/src/modern/ui/view.cpp @@ -892,6 +892,7 @@ class App final : public Rml::EventListener { static std::string pg_dialog(const std::string &title, const std::string &sub, const std::string &body, const std::string &actions, double width, const std::string &attrs = {}); std::string pg_club(const std::string &id, double size = 50, bool reverse = false); void notebook_finish(std::string &markup); + std::string render_lineup_page(); // lineup_page.inc // postponing and friendlies (planning_page.inc) std::string page_months(const Json &calendar, bool booking, bool postpone, const std::set &movable); static std::string page_steps(const std::string &first, const std::string &second, bool at_second); @@ -1791,6 +1792,7 @@ public: #include "modern/ui/pages.inc" #include "modern/ui/tactics_page.inc" #include "modern/ui/planning_page.inc" +#include "modern/ui/lineup_page.inc" #include "modern/ui/finance_simulation.inc" #include "modern/ui/statistics_analysis.inc" #include "modern/ui/engine_rankings.inc"