A player's card with figures and skills; shirts in the club's colour; table zones; reduced motion
The card shows age, strength, condition, technique and form as numerals, the seven skills as marks and contract and status as a list. The line-up pitch draws shirts in the club's colour with a condition dot instead of the data set's figures. League tables carry the prediction's European places and the promotion and relegation places. A display setting turns transitions off. The desk hangs from the top edge of a taller screen. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
9b33e1f8c1
commit
eec7f40a52
16 files changed
+160
-26
No files matched your search
@@ -101,6 +101,39 @@ std::string report_detail_fields(
|
||||
"</dd></div>";
|
||||
return result + "</dl>";
|
||||
}
|
||||
std::string report_detail_role(const Json &player) {
|
||||
const auto text = report_detail_position(player);
|
||||
return text == "TW" ? "Torwart" : text == "ABW" ? "Abwehr" : text == "MIT" ? "Mittelfeld" : text == "STU" ? "Sturm" : text;
|
||||
}
|
||||
// The player's card: under the name the club and the role, then the figures a manager
|
||||
// looks at first as large numerals, then the remaining facts as a list.
|
||||
std::string report_player_card(const std::string &portrait, const std::string &crest, const std::string &club,
|
||||
const std::string &role,
|
||||
const std::vector<std::pair<std::string, std::string>> &figures,
|
||||
const std::vector<std::pair<std::string, std::string>> &facts,
|
||||
const Json &skills = Json()) {
|
||||
std::string out = "<div class=\"report-detail-portrait\">" + portrait + "</div><div class=\"player-card-sub\">" + crest +
|
||||
"<span>" + esc(club) + " · " + esc(role) + "</span></div><div class=\"player-card-figures\">";
|
||||
for (const auto &[label, value] : figures)
|
||||
out += "<div class=\"player-card-figure\"><strong>" + esc(value) + "</strong><span>" + esc(label) + "</span></div>";
|
||||
out += "</div>";
|
||||
// the seven skills, each on the engine's scale of none to three marks
|
||||
out += "<div class=\"player-card-skills\"><h3>Fähigkeiten</h3>";
|
||||
bool any = false;
|
||||
for (const auto &[key, label] : std::array<std::pair<const char *, const char *>, 7>{
|
||||
{{"teamplay", "Spielübersicht"}, {"speed", "Schnelligkeit"}, {"shooting", "Schuss"}, {"passing", "Passspiel"},
|
||||
{"tackling", "Zweikampf"}, {"free_kick", "Freistöße"}, {"corner", "Ecken"}}}) {
|
||||
if (!skills.is_object() || !skills.contains(key) || !skills.at(key).is_number_integer()) continue;
|
||||
const int value = std::clamp(skills.at(key).get<int>(), 0, 3);
|
||||
any = true;
|
||||
out += std::string("<div class=\"player-card-skill\"><span>") + label + "</span><div class=\"pips\" title=\"" + std::to_string(value) + " von 3\">";
|
||||
for (int pip = 0; pip < 3; ++pip) out += pip < value ? "<div class=\"pip on\"></div>" : "<div class=\"pip\"></div>";
|
||||
out += "</div></div>";
|
||||
}
|
||||
if (!any) out += "<p class=\"player-card-none\">Für diesen Spieler liegen keine Einzelwerte vor.</p>";
|
||||
out += "</div><div class=\"player-card-facts\"><h3>Vertrag und Status</h3>" + report_detail_fields(facts, 64) + "</div>";
|
||||
return out;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
std::string App::render_report_detail() {
|
||||
@@ -234,14 +267,16 @@ std::string App::render_report_detail() {
|
||||
photo = "asset:player/" + (id.starts_with("player:") ? id.substr(7) : id) +
|
||||
"/photo";
|
||||
}
|
||||
body = "<div class=\"report-detail-portrait\">" +
|
||||
img(photo, 496, 662.667, true, true, 1024) +
|
||||
"</div><p class=\"report-detail-photo-caption\">Porträt</p>" +
|
||||
report_detail_fields({{"Position", report_detail_position(*player)},
|
||||
{"Alter", report_detail_age(*player, current_date, true)},
|
||||
{"Stärke", report_detail_strength(*player)},
|
||||
{"Verein", display_name(club)},
|
||||
{"Vertrag", report_detail_term(*world_, *player, current_date)}}, 73);
|
||||
const auto figure = [&](const char *key) {
|
||||
const auto attributes = player->value("attributes", Json::object());
|
||||
return attributes.is_object() && attributes.contains(key) && attributes[key].is_number_integer()
|
||||
? number(attributes[key].get<int64_t>()) : std::string("—");
|
||||
};
|
||||
body = report_player_card(img(photo, 496, 662.667, true, true, 1024), crest(club, 56), display_name(club),
|
||||
report_detail_role(*player),
|
||||
{{"Alter", report_detail_age(*player, current_date, false)}, {"Stärke", figure("strength")},
|
||||
{"Kondition", figure("condition")}, {"Technik", figure("technique")}, {"Form", figure("form")}},
|
||||
{{"Vertrag", report_detail_term(*world_, *player, current_date)}});
|
||||
actions = close("Schließen");
|
||||
} else
|
||||
return {};
|
||||
|
||||
Reference in new issue
Block a user