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
@@ -35,7 +35,7 @@
|
||||
.lineup-player:hover {background-color:transparent;}
|
||||
.lineup-player[aria-pressed=true] {border:2dp #b4ddce;}
|
||||
.lineup-player:focus-visible {border:2dp var(--accent);}
|
||||
.lineup-jersey {position:absolute;left:0;top:60.156923dp;width:66.841026dp;height:22dp;text-align:center;font-size:18dp;line-height:1.1;font-weight:bold;color:#f7fbff;pointer-events:none;}
|
||||
.lineup-jersey {position:absolute;left:0;top:24dp;width:66.841026dp;height:26dp;text-align:center;font-size:23dp;line-height:26dp;font-weight:bold;color:#ffffff;pointer-events:none;}
|
||||
.lineup-ghost {display:none;position:absolute;width:66.841026dp;height:66.841026dp;z-index:4;pointer-events:none;opacity:.7;}
|
||||
.lineup-controls {position:absolute;left:1058.529915dp;top:1256dp;width:1553.470085dp;height:608dp;}
|
||||
.lineup-tabs {display:flex;width:1553.470085dp;height:70dp;}
|
||||
|
||||
@@ -51,3 +51,33 @@ body.matchday .report-detail-striped {background-color:#f8e7e00a;}
|
||||
|
||||
.report-detail-indoor-info {height:332dp;}
|
||||
.report-detail-info-text {position:absolute;left:52dp;right:52dp;top:124dp;height:54dp;line-height:54dp;margin:0;font-size:36dp;}
|
||||
/* the detail cards are sheets of paper like the windows they lie on */
|
||||
.report-detail-card {border:2dp var(--paper-edge);border-radius:10dp;background-color:transparent;decorator:linear-gradient(175deg,var(--paper-top),var(--paper-bottom));color:var(--text);}
|
||||
.report-detail-card h2 {font-family:Display;color:var(--text);}
|
||||
.report-detail-values dd {color:var(--text);}
|
||||
.report-detail-field {border-bottom:2dp var(--rule);}
|
||||
/* the player's card */
|
||||
.report-detail-player h2 {left:612dp;top:123dp;height:76dp;line-height:76dp;text-align:left;font-size:64dp;}
|
||||
.report-detail-portrait {border:2dp var(--paper-edge);border-radius:6dp;}
|
||||
.player-card-sub {position:absolute;left:612dp;right:52dp;top:216dp;height:56dp;display:flex;align-items:center;gap:18dp;font-size:34dp;color:var(--muted);}
|
||||
.player-card-sub span {display:block;}
|
||||
.player-card-figures {position:absolute;left:612dp;right:52dp;top:328dp;height:216dp;display:flex;gap:24dp;}
|
||||
.player-card-figure {flex:1;min-width:0;height:216dp;border:2dp var(--rule);border-radius:8dp;display:flex;flex-direction:column;align-items:center;justify-content:center;}
|
||||
.player-card-figure strong {display:block;font-family:Display;font-size:92dp;line-height:104dp;font-weight:bold;color:var(--text);}
|
||||
.player-card-figure span {display:block;font-size:28dp;line-height:36dp;color:var(--muted);}
|
||||
.report-detail-player {height:1200dp;}
|
||||
.report-detail-player.listed {height:988.667dp;}
|
||||
.report-detail-player.listed .report-detail-values {top:250dp;height:380dp;}
|
||||
.player-card-skills {position:absolute;left:612dp;top:584dp;width:620dp;height:460dp;}
|
||||
.player-card-facts {position:absolute;left:1280dp;right:52dp;top:584dp;height:460dp;}
|
||||
.player-card-skills h3,.player-card-facts h3 {display:block;height:56dp;line-height:56dp;margin:0;font-family:Display;font-size:38dp;font-weight:bold;border-bottom:2dp var(--rule);}
|
||||
.player-card-skill {display:flex;align-items:center;justify-content:space-between;height:54dp;border-bottom:2dp var(--rule);font-size:32dp;}
|
||||
.player-card-skill span {display:block;}
|
||||
.player-card-skill .pips {display:flex;gap:10dp;}
|
||||
.player-card-skill .pip {width:26dp;height:26dp;border:2dp var(--rule);border-radius:13dp;}
|
||||
.player-card-skill .pip.on {background-color:var(--win);border-color:var(--win);}
|
||||
.player-card-none {margin:24dp 0 0 0;font-size:30dp;color:var(--muted);}
|
||||
.report-detail-player .player-card-facts .report-detail-values {left:0;right:0;top:64dp;height:330dp;}
|
||||
.report-detail-player .player-card-facts .report-detail-field,.report-detail-player .player-card-facts dt,.report-detail-player .player-card-facts dd {height:54dp;line-height:54dp;font-size:32dp;}
|
||||
.report-detail-player .player-card-facts dt {width:240dp;}
|
||||
.report-detail-player .player-card-facts dd {width:380dp;}
|
||||
@@ -36,7 +36,7 @@
|
||||
.report-cell[aria-sort=descending] .report-sort-arrow.down {border-top-color:var(--text);}
|
||||
.report-rank {display:flex;align-items:center;justify-content:flex-end;flex-shrink:0;width:64dp;margin-right:14dp;}
|
||||
.report-zone {display:block;flex-shrink:0;width:9dp;height:48dp;margin-right:20dp;border-radius:5dp;background-color:transparent;}
|
||||
.report-zone.champions {background-color:#79b8ed;}
|
||||
.report-zone.champions,.report-zone.europe {background-color:#79b8ed;}
|
||||
.report-zone.europa {background-color:#e6a566;}
|
||||
.report-zone.conference {background-color:#8bc493;}
|
||||
.report-zone.relegation {background-color:#e8757e;}
|
||||
|
||||
@@ -129,3 +129,5 @@ Nach der Übergabe (MVP_FOR_CLAUDE.md): A Schreibtisch (dieser Stand) → B Vorb
|
||||
`manager.join.commit`: `payload {confirmed:true, managers:[{name,club,portrait,portrait_style,strength_choice}]}`. Nur neue Menschen übergeben; vorhandene Menschen sind keine bearbeitbaren Nutzdaten dieses Auftrags. Die Session leitet das Zielvolumen aus ihrer Menschenzahl ab, bewahrt ihre übrigen Startoptionen und durchläuft ihren vorhandenen Beitrittsentwurf atomar. Harter Grenzwert vier; Prüfung von Besitzer/Revision, aktueller deutscher Vereinszugehörigkeit, eindeutigen Vereinen/Porträts, Stil und Unicode-Namen. Eine Revision pro erfolgreichem Auftrag. Die UI bietet jeweils einen neuen Menschen an.
|
||||
|
||||
`manager.resign.commit` bleibt der bestehende bestätigte Ein-Mensch-Endpfad. Mehrspieler-KI-Übergabe bleibt ausdrücklich nicht unterstützt. Moderne Beitritte behalten den aktuellen Erstligaplatz statt der ursprünglichen Neuplatzierung (#29); Classic und Neuanlage unverändert, in `DIFFERENCES.md` markiert.
|
||||
|
||||
- `league-report`: jede Tabellenzeile trägt `zone` (`europe`, `promotion`, `relegation` oder leer). Grundlage sind die Plätze der Saisonprognose (`kLeagueEurope`, in der ersten Liga vier) und die Abstiegsplätze (`kLeagueRelegation`); die Zone folgt dem Rang der gewählten Tabellenansicht.
|
||||
@@ -361,7 +361,11 @@ J league_report_data(const ModernState& g,int league,int filter,const std::strin
|
||||
form.insert(form.begin(),symbol);form_points+=outcome==3?3:outcome==2?1:0;
|
||||
}
|
||||
const int games=table.games(i),wins=table.wins[size_t(i)],loss=table.defeats[size_t(i)];
|
||||
rows.push_back(O{{"team",team_ref(g,team,today)},{"original",i},{"rank",table.rank(i)+1},{"played",games},{"wins",wins},
|
||||
// the places the season decides (schedule.hpp): the top of the first league is the
|
||||
// prediction's European target, the top of a lower league goes up, the foot goes down
|
||||
const int place=table.rank(i)+1, top=league==0?4:kLeagueEurope[league];
|
||||
const char* zone=place<=top?(league==0?"europe":"promotion"):place>count-int(kLeagueRelegation[league])?"relegation":"";
|
||||
rows.push_back(O{{"zone",zone},{"team",team_ref(g,team,today)},{"original",i},{"rank",table.rank(i)+1},{"played",games},{"wins",wins},
|
||||
{"draw",std::max(0,games-wins-loss)},{"loss",loss},{"gf",int(table.goals_for[size_t(i)])},{"ga",int(table.goals_against[size_t(i)])},
|
||||
{"diff",int(table.goals_for[size_t(i)])-int(table.goals_against[size_t(i)])},{"points",int(table.points[size_t(i)])},{"form",form_points},{"form_text",form}});
|
||||
int positions[4]={};
|
||||
|
||||
@@ -825,7 +825,7 @@ Json engine_report_squad(const Json &bundle,const Json &read,const std::string &
|
||||
const auto id=r.at("player").at("id").get<std::string>();require(!id.empty()&&ids.insert(id).second&&r.at("squadTeamId")==team,"Doppelter oder fremder Kaderspieler.");
|
||||
require(r.at("player").at("name").is_string()&&r.at("player").at("positions").is_array(),"Spieleridentität fehlt.");
|
||||
}
|
||||
auto result=data;for(auto &r:result["players"])r["live_strength"]=metric_value(r,"strength");return result;
|
||||
auto result=data;for(auto &r:result["players"])for(const auto *key:{"strength","condition","technique","form"})r[std::string("live_")+key]=metric_value(r,key);return result;
|
||||
}
|
||||
Json engine_fixtures_projection(const Json &bundle,const Json &index,const Json &read,const std::string &league,int round) {
|
||||
const auto data=engine_report_index(bundle,index);const Json *selected=nullptr;
|
||||
|
||||
@@ -34,5 +34,5 @@ std::string App::engine_rankings_player_detail() {
|
||||
std::string term="—";if(live&&live->at("contractRemaining").is_object())term=number(live->at("contractRemaining").at("value"))+" Monate";
|
||||
const auto club=r.at("currentTeam").is_object()?engine_text(r.at("currentTeam").at("name")):r.at("club_name").get<std::string>();
|
||||
const auto body="<div class=\"report-detail-portrait\">"+img(r.at("photo"),496,662.667,true,true,1024)+"</div><p class=\"report-detail-photo-caption\">"+std::string(r.at("currentTeam").is_null()?r.value("source_caption",std::string("Saisonaufzeichnung")):std::string("Porträt"))+"</p>"+report_detail_fields({{"Position",live?report_detail_position(live->at("player")):"—"},{"Alter",live?report_number(live->at("age"))+" Jahre":"—"},{"Stärke",live?report_number(live->at("live_strength")):"—"},{r.at("currentTeam").is_null()?r.value("archive_label",std::string("Archivverein")):std::string("Verein"),club},{"Vertrag",term}},73);
|
||||
return "<div id=\"report-detail-layer\" class=\"report-detail-layer\"><section id=\"report-detail-dialog\" class=\"report-detail-card report-detail-player\" role=\"dialog\" aria-modal=\"true\" aria-labelledby=\"report-detail-title\"><h2 id=\"report-detail-title\">"+esc(r.at("name").get<std::string>())+"</h2>"+body+"<nav class=\"report-detail-actions\">"+btn("report-detail-close","Schließen","report-detail-action","id=\"report-detail-close\"")+"</nav></section></div>";
|
||||
return "<div id=\"report-detail-layer\" class=\"report-detail-layer\"><section id=\"report-detail-dialog\" class=\"report-detail-card report-detail-player listed\" role=\"dialog\" aria-modal=\"true\" aria-labelledby=\"report-detail-title\"><h2 id=\"report-detail-title\">"+esc(r.at("name").get<std::string>())+"</h2>"+body+"<nav class=\"report-detail-actions\">"+btn("report-detail-close","Schließen","report-detail-action","id=\"report-detail-close\"")+"</nav></section></div>";
|
||||
}
|
||||
@@ -198,7 +198,13 @@ std::string App::engine_reports_detail() {
|
||||
const auto &p=row->at("player");title=engine_text(p.at("name"));auto photo=p.at("photoAssetId").is_string()?p.at("photoAssetId").get<std::string>():"asset:player/"+(report_detail_player_.starts_with("player:")?report_detail_player_.substr(7):report_detail_player_)+"/photo";
|
||||
actions=btn("report-detail-close","Schließen","report-detail-action","id=\"report-detail-close\"");
|
||||
std::string term="—";if(row->at("contractRemaining").is_object())term=number(row->at("contractRemaining").at("value"))+" Monate";
|
||||
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(p)},{"Alter",row->at("age").is_number_integer()?report_number(row->at("age"))+" Jahre":"—"},{"Stärke",report_number(row->at("live_strength"))},{"Verein",engine_text(team.at("name"))},{"Vertrag",term}},73);
|
||||
body=report_player_card(img(photo,496,662.667,true,true,1024),crest(world_->find("clubs",report_detail_club_),56),engine_text(team.at("name")),report_detail_role(p),
|
||||
{{"Alter",report_number(row->at("age"))},{"Stärke",report_number(row->at("live_strength"))},{"Kondition",report_number(row->at("live_condition"))},{"Technik",report_number(row->at("live_technique"))},{"Form",report_number(row->at("live_form"))}},
|
||||
{{"Status",row->at("availability")=="injured"?"Verletzt, noch "+number(row->at("injuryRemaining").at("value"))+" Wo.":row->at("availability")=="suspended"?"Gesperrt, noch "+number(row->at("suspensionRemaining").at("value"))+" Wo.":std::string("Einsatzbereit")},
|
||||
{"Kader",row->at("role")=="starter"?"Startelf":row->at("role")=="bench"?"Ersatzbank":"Tribüne"},
|
||||
{"Nation",p.at("nationIds").empty()?std::string("—"):world_->nation_name(p.at("nationIds")[0].get<std::string>())},
|
||||
{"Vertrag",term},{"Monatsgehalt",row->at("salaryMonthly").is_null()?std::string("—"):engine_price(row->at("salaryMonthly"))}},
|
||||
row->at("skills"));
|
||||
}
|
||||
return "<div id=\"report-detail-layer\" class=\"report-detail-layer\"><section id=\"report-detail-dialog\" class=\"report-detail-card report-detail-"+esc(report_detail_kind_)+"\" role=\"dialog\" aria-modal=\"true\" aria-labelledby=\"report-detail-title\"><h2 id=\"report-detail-title\">"+esc(title)+"</h2>"+body+"<nav class=\"report-detail-actions\">"+actions+"</nav></section></div>";
|
||||
}
|
||||
@@ -49,7 +49,7 @@ void App::engine_render() {
|
||||
if (auto *roster = element("lineup-roster-scroll")) lineup_roster_scroll_ = lineup_reset_scroll_ ? 0.f : roster->GetScrollTop();
|
||||
lineup_reset_scroll_ = false;
|
||||
}
|
||||
doc_->SetClassNames(theme_);
|
||||
doc_->SetClassNames(body_classes());
|
||||
std::string out;
|
||||
if (engine_data_.empty()) {
|
||||
out = "<div class=\"fill center\"><div class=\"panel\" style=\"padding:70dp;\"><h1>Dreierpack Manager</h1><p>" +
|
||||
|
||||
@@ -31,7 +31,7 @@ std::string App::files_details(bool layouts, bool save) {
|
||||
for (const auto &[id, object] : payload.at("layout").at("objects").items())
|
||||
if (object.value("visible", false)) { if (object.value("widget", false)) ++widgets; else ++apps; }
|
||||
const auto look = payload.at("theme").get<std::string>();
|
||||
const std::vector<std::pair<std::string, std::string>> meta = {{"Gestaltung", look == "silver" ? "Silver Glass" : look == "matchday" ? "Matchday" : "Midnight Glass"}, {"Widgets", std::to_string(widgets)}, {"Buttons", std::to_string(apps)}, {"Hintergrund", "Stadion bei Nacht"}};
|
||||
const std::vector<std::pair<std::string, std::string>> meta = {{"Gestaltung", look == "silver" ? "Papier" : look == "matchday" ? "Spieltag" : "Mitternacht"}, {"Widgets", std::to_string(widgets)}, {"Buttons", std::to_string(apps)}, {"Hintergrund", "Stadion bei Nacht"}};
|
||||
out += "<div class=\"files-metadata\">";
|
||||
for (const auto &[label, value] : meta) out += "<div class=\"files-metadata-cell\"><span>" + esc(label) + "</span><strong>" + esc(value) + "</strong></div>";
|
||||
return out + "</div>";
|
||||
|
||||
@@ -98,6 +98,19 @@ std::string lineup_mini(const Json &points, const std::string &theme,
|
||||
}
|
||||
return lineup_svg(body);
|
||||
}
|
||||
// A shirt in the club's colour; the dot at its hem tells the player's condition.
|
||||
std::string lineup_shirt(const std::string &colour, bool selected, const Json &condition) {
|
||||
std::string body = "<path d=\"M13 5L4 10L7 18L11 16V35H29V16L33 18L36 10L27 5Q20 10 13 5Z\" fill=\"" + colour +
|
||||
"\" stroke=\"" + (selected ? "#ffe27a" : "#ffffff") + "\" stroke-width=\"" + (selected ? "2.6" : "1.3") +
|
||||
"\" stroke-linejoin=\"round\"/><path d=\"M13 5Q20 10 27 5\" fill=\"none\" stroke=\"#ffffff\" stroke-width=\"2.2\"/>"
|
||||
"<path d=\"M11 16V35H29V16\" fill=\"#000000\" fill-opacity=\".12\" stroke=\"none\"/>";
|
||||
if (condition.is_number_integer()) {
|
||||
const int value = condition.get<int>();
|
||||
body += std::string("<circle cx=\"32\" cy=\"32\" r=\"4.2\" fill=\"") + (value >= 85 ? "#3fae6a" : value >= 70 ? "#e0b23c" : "#d9534f") +
|
||||
"\" stroke=\"#ffffff\" stroke-width=\"1.2\"/>";
|
||||
}
|
||||
return lineup_svg(body, "0 0 40 40");
|
||||
}
|
||||
std::string lineup_field(bool indoor = false) {
|
||||
std::string body;
|
||||
for (int x = 0; x < 196; x += 15)
|
||||
@@ -339,6 +352,21 @@ std::string App::render_lineup() {
|
||||
lineup_player_anchor_y_dp;
|
||||
return std::pair<double, double>{x, y};
|
||||
};
|
||||
// the manager's club gives the shirts their colour
|
||||
std::string shirt_colour;
|
||||
{
|
||||
const std::string own = engine_mode_ ? engine_data_.at("desktop").at("meta").at("scope").at("teamId").get<std::string>()
|
||||
: manager(s).value("club", "");
|
||||
if (const auto *club = world_->find("clubs", own); club && !club->value("crest", "").empty())
|
||||
shirt_colour = renderer_.crest_colour(club->value("crest", ""));
|
||||
if (shirt_colour.empty()) shirt_colour = "#3d5a73";
|
||||
}
|
||||
const auto shirt = [&](bool selected, const Json &condition) {
|
||||
const std::string level = condition.is_number_integer() ? (condition.get<int>() >= 85 ? "a" : condition.get<int>() >= 70 ? "b" : "c") : "n";
|
||||
return picture(renderer_.diagram("lineup-shirt-" + shirt_colour + (selected ? "-s-" : "-n-") + level,
|
||||
lineup_shirt(shirt_colour, selected, condition), 160),
|
||||
lineup_player_size_dp, lineup_player_size_dp);
|
||||
};
|
||||
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;
|
||||
@@ -347,8 +375,7 @@ std::string App::render_lineup() {
|
||||
const auto [x, y] = marker_position(i);
|
||||
out +=
|
||||
btn("lineup-player",
|
||||
img(selected ? "lineup.player.selected" : "lineup.player.normal",
|
||||
lineup_player_size_dp, lineup_player_size_dp) +
|
||||
shirt(selected, row.value("condition", Json())) +
|
||||
"<span class=\"lineup-jersey\">" + std::to_string(i + 1) +
|
||||
"</span>",
|
||||
paired ? "lineup-player lineup-paired" : "lineup-player",
|
||||
@@ -365,8 +392,7 @@ std::string App::render_lineup() {
|
||||
out += "<span class=\"lineup-pair-tag\" id=\"lineup-pair-group-" + std::to_string(pair.at("number").get<int>()) + "\" style=\"" + rect((ax + bx + lineup_player_size_dp) / 2 - 24, std::min(ay, by) - 24, 48, 22) + "\"><span>P" + std::to_string(pair.at("number").get<int>()) + "</span></span>";
|
||||
}
|
||||
out += "<div id=\"lineup-ghost\" class=\"lineup-ghost\">" +
|
||||
img("lineup.player.ghost", lineup_player_size_dp,
|
||||
lineup_player_size_dp) +
|
||||
shirt(false, Json()) +
|
||||
"</div></div><aside class=\"lineup-controls\"><nav "
|
||||
"class=\"lineup-tabs\" aria-label=\"Aufstellungsansichten\">" +
|
||||
data_btn() + view_btn();
|
||||
|
||||
@@ -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 {};
|
||||
|
||||
@@ -139,7 +139,7 @@ std::string App::render_reports(const std::string &mode) {
|
||||
body += report_club_button(row.at(column == 0 ? "home" : "away").get<std::string>(), column == 0);
|
||||
else if (!matches && column == 0) {
|
||||
if (!strengths) {
|
||||
const auto zone = engine_mode_?std::string():report_zone(row.value("rank", 0), int(rows.size()), tier);
|
||||
const auto zone = engine_mode_?row.value("zone", std::string()):report_zone(row.value("rank", 0), int(rows.size()), tier);
|
||||
body += "<span class=\"report-zone " + zone + "\"></span><span class=\"report-rank\"><span>" +
|
||||
std::to_string(row.value("rank", 0)) + ".</span></span>";
|
||||
}
|
||||
@@ -179,6 +179,14 @@ std::string App::render_reports(const std::string &mode) {
|
||||
body += "</div>";
|
||||
if(real_other&&rows.empty())body+="<p class=\"report-detail-empty\">"+std::string(!fixture.at("available").get<bool>()?"Diese Runde ist noch nicht ausgelost oder die vorherige Phase ist noch nicht abgeschlossen.":"Keine Paarungen vorhanden.")+"</p>";
|
||||
body+="</div>";
|
||||
if (!matches && !strengths && engine_mode_) {
|
||||
// only the zones this league has
|
||||
std::string items;
|
||||
for (const auto &[kind, label] : std::array<std::pair<const char *, const char *>, 3>{{{"europe", "Europapokal"}, {"promotion", "Aufstieg"}, {"relegation", "Abstieg"}}})
|
||||
if (std::any_of(rows.begin(), rows.end(), [&](const Json &row) { return row.value("zone", "") == kind; }))
|
||||
items += "<span class=\"report-legend-item\"><span class=\"report-zone " + std::string(kind) + "\"></span><span>" + label + "</span></span>";
|
||||
if (!items.empty()) body += "<div class=\"report-legend\">" + items + "</div>";
|
||||
}
|
||||
if (!matches && !strengths && !engine_mode_) {
|
||||
const auto legend = tier == 1
|
||||
? std::vector<std::pair<std::string, std::string>>{
|
||||
|
||||
@@ -248,6 +248,11 @@ std::string App::render_settings() {
|
||||
(p.at("theme") == type ? "true" : "false") + "\"");
|
||||
}
|
||||
pane += "</div></div>";
|
||||
pane += "<div class=\"settings-group\"><h3>Bewegung</h3>" +
|
||||
settings_row("preference-motion", "Übergänge und Einblendungen", "Reduziert: Fenster, Karten und Tor-Einblendungen erscheinen ohne Bewegung.",
|
||||
settings_select("preference-motion", {{"full", "Voll"}, {"reduced", "Reduziert"}},
|
||||
p.at("display").at("motion").get<std::string>(), "global", "display", "motion")) +
|
||||
"</div>";
|
||||
if (engine_mode_) {
|
||||
int width=0,height=0; SDL_GetWindowSize(video_.window,&width,&height);
|
||||
pane += "<div class=\"settings-group\"><h3>Fenster</h3><p>" + std::to_string(width) + " × " + std::to_string(height) + " · Automatische Anpassung</p></div>";
|
||||
|
||||
@@ -26,7 +26,8 @@ Json default_ui_preferences() {
|
||||
{{"mode", "window"},
|
||||
{"resolution", "1920x1080"},
|
||||
{"scale", "auto"},
|
||||
{"language", "de"}}},
|
||||
{"language", "de"},
|
||||
{"motion", "full"}}},
|
||||
{"sound", {{"volume", 80}, {"effects", true}, {"style", "classic"}}}};
|
||||
}
|
||||
bool valid_ui_preferences(const Json &v) {
|
||||
@@ -35,7 +36,8 @@ bool valid_ui_preferences(const Json &v) {
|
||||
!choice(v.at("theme"), {"midnight", "silver", "matchday"}))
|
||||
return false;
|
||||
const auto &d = v.at("display"), &s = v.at("sound");
|
||||
return keys(d, {"mode", "resolution", "scale", "language"}) &&
|
||||
return keys(d, {"mode", "resolution", "scale", "language", "motion"}) &&
|
||||
choice(d.at("motion"), {"full", "reduced"}) &&
|
||||
keys(s, {"volume", "effects", "style"}) &&
|
||||
choice(d.at("mode"), {"window", "fullscreen"}) &&
|
||||
choice(d.at("resolution"), {"1280x720", "1600x900", "1920x1080",
|
||||
@@ -68,7 +70,12 @@ Json legacy_ui_preferences(const Json &legacy) {
|
||||
Json load_ui_preferences(const fs::path &path) {
|
||||
if (!fs::exists(path))
|
||||
return default_ui_preferences();
|
||||
const auto envelope = Json::parse(editor::read_file(path));
|
||||
auto envelope = Json::parse(editor::read_file(path));
|
||||
// a file written before the motion setting existed keeps full motion
|
||||
if (envelope.is_object() && envelope.contains("preferences") && envelope["preferences"].is_object() &&
|
||||
envelope["preferences"].contains("display") && envelope["preferences"]["display"].is_object() &&
|
||||
!envelope["preferences"]["display"].contains("motion"))
|
||||
envelope["preferences"]["display"]["motion"] = "full";
|
||||
if (!keys(envelope, {"schema", "preferences"}) ||
|
||||
envelope.at("schema") != "openbmh-ui-preferences@1" ||
|
||||
!valid_ui_preferences(envelope.at("preferences")))
|
||||
|
||||
+13
-2
@@ -412,6 +412,7 @@ class App final : public Rml::EventListener {
|
||||
bool initialized_ = false, closed_ = false, dirty_ = true,
|
||||
needs_render_ = true;
|
||||
double scale_ = 1, canvas_left_ = 0, canvas_top_ = 0;
|
||||
bool desk_top_ = false;
|
||||
// A menu window (2720 x 2040 at the middle of the stage) is shown as large as the screen
|
||||
// allows; the desk behind it is cropped. Without a window the whole stage is fitted.
|
||||
bool window_zoom_ = false;
|
||||
@@ -565,6 +566,11 @@ class App final : public Rml::EventListener {
|
||||
bool world = false, bool cover = false, int pixels = 512) {
|
||||
return picture(renderer_.image(key, world, pixels), w, h, cover);
|
||||
}
|
||||
// the theme, and "calm" when the player asked for reduced motion
|
||||
std::string body_classes() const {
|
||||
return theme_ + (ui_preferences_.is_object() && ui_preferences_.contains("display") &&
|
||||
ui_preferences_.at("display").value("motion", "full") == "reduced" ? " calm" : "");
|
||||
}
|
||||
std::string picture(const Picture &p, double w, double h,
|
||||
bool cover = false) {
|
||||
if (p.token.empty())
|
||||
@@ -922,8 +928,12 @@ class App final : public Rml::EventListener {
|
||||
void sync_window_zoom() {
|
||||
const bool wanted = doc_->QuerySelector(".window") != nullptr || doc_->QuerySelector(".live-stage") != nullptr;
|
||||
if (!wanted) window_shown_ = "\x01";
|
||||
if (wanted == window_zoom_) return;
|
||||
// the career's desk hangs from the top edge of a taller screen, so its bar is the
|
||||
// screen's bar and the spare height shows the stadium below
|
||||
const bool desk = !wanted && (scene_ == "engine" || scene_ == "desktop");
|
||||
if (wanted == window_zoom_ && desk == desk_top_) return;
|
||||
window_zoom_ = wanted;
|
||||
desk_top_ = desk;
|
||||
resize();
|
||||
}
|
||||
void resize() {
|
||||
@@ -936,6 +946,7 @@ class App final : public Rml::EventListener {
|
||||
if (window_zoom_) scale_ = std::max(scale_, std::min(double(pw) / 2760, double(ph) / 2080));
|
||||
canvas_left_ = (pw - 3840 * scale_) / 2;
|
||||
canvas_top_ = (ph - 2160 * scale_) / 2;
|
||||
if (desk_top_ && canvas_top_ > 0) canvas_top_ = 0;
|
||||
device_ratio_ = float(pw) / w;
|
||||
renderer_.SetViewport(pw, ph);
|
||||
context_->SetDimensions({pw, ph});
|
||||
@@ -1024,7 +1035,7 @@ class App final : public Rml::EventListener {
|
||||
ticket_->close(false);
|
||||
context_open_ = false;
|
||||
context_dirty_ = true;
|
||||
doc_->SetClassNames(theme_);
|
||||
doc_->SetClassNames(body_classes());
|
||||
std::string markup;
|
||||
if (scene_ == "main")
|
||||
markup = main_menu();
|
||||
|
||||
Reference in new issue
Block a user