From eec7f40a52390707622b3855168d0250b3776648 Mon Sep 17 00:00:00 2001 From: Weyoune Date: Sat, 14 Nov 2026 18:43:40 +0100 Subject: [PATCH] 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 --- assets/modern/lineup.rcss | 2 +- assets/modern/report_details.rcss | 30 ++++++++++++++++++ assets/modern/reports.rcss | 2 +- docs/new_engine/ui-anbindung.md | 2 ++ src/modern/content/ui_contract.cpp | 6 +++- src/modern/ui/engine_dto.cpp | 2 +- src/modern/ui/engine_rankings.inc | 2 +- src/modern/ui/engine_reports.inc | 8 ++++- src/modern/ui/engine_screens.inc | 2 +- src/modern/ui/files_screens.inc | 2 +- src/modern/ui/lineup_screens.inc | 34 +++++++++++++++++--- src/modern/ui/report_details.inc | 51 +++++++++++++++++++++++++----- src/modern/ui/reports_screens.inc | 10 +++++- src/modern/ui/settings_screens.inc | 5 +++ src/modern/ui/ui_preferences.cpp | 13 ++++++-- src/modern/ui/view.cpp | 15 +++++++-- 16 files changed, 160 insertions(+), 26 deletions(-) diff --git a/assets/modern/lineup.rcss b/assets/modern/lineup.rcss index d0246a8..b51c4b2 100644 --- a/assets/modern/lineup.rcss +++ b/assets/modern/lineup.rcss @@ -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;} diff --git a/assets/modern/report_details.rcss b/assets/modern/report_details.rcss index 11f0fce..2f4289b 100644 --- a/assets/modern/report_details.rcss +++ b/assets/modern/report_details.rcss @@ -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;} diff --git a/assets/modern/reports.rcss b/assets/modern/reports.rcss index efc6820..ec7c222 100644 --- a/assets/modern/reports.rcss +++ b/assets/modern/reports.rcss @@ -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;} diff --git a/docs/new_engine/ui-anbindung.md b/docs/new_engine/ui-anbindung.md index b6a6939..8996420 100644 --- a/docs/new_engine/ui-anbindung.md +++ b/docs/new_engine/ui-anbindung.md @@ -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. diff --git a/src/modern/content/ui_contract.cpp b/src/modern/content/ui_contract.cpp index e6fdbee..0cd4564 100644 --- a/src/modern/content/ui_contract.cpp +++ b/src/modern/content/ui_contract.cpp @@ -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]={}; diff --git a/src/modern/ui/engine_dto.cpp b/src/modern/ui/engine_dto.cpp index cb685ac..b7a1c2f 100644 --- a/src/modern/ui/engine_dto.cpp +++ b/src/modern/ui/engine_dto.cpp @@ -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();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; diff --git a/src/modern/ui/engine_rankings.inc b/src/modern/ui/engine_rankings.inc index 4f423dc..7965dcd 100644 --- a/src/modern/ui/engine_rankings.inc +++ b/src/modern/ui/engine_rankings.inc @@ -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(); const auto body="
"+img(r.at("photo"),496,662.667,true,true,1024)+"

"+std::string(r.at("currentTeam").is_null()?r.value("source_caption",std::string("Saisonaufzeichnung")):std::string("Porträt"))+"

"+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 "

"+esc(r.at("name").get())+"

"+body+"
"; + return "

"+esc(r.at("name").get())+"

"+body+"
"; } diff --git a/src/modern/ui/engine_reports.inc b/src/modern/ui/engine_reports.inc index bb3f84f..c91be13 100644 --- a/src/modern/ui/engine_reports.inc +++ b/src/modern/ui/engine_reports.inc @@ -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():"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="
"+img(photo,496,662.667,true,true,1024)+"

Porträt

"+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())}, + {"Vertrag",term},{"Monatsgehalt",row->at("salaryMonthly").is_null()?std::string("—"):engine_price(row->at("salaryMonthly"))}}, + row->at("skills")); } return "

"+esc(title)+"

"+body+"
"; } diff --git a/src/modern/ui/engine_screens.inc b/src/modern/ui/engine_screens.inc index 6d692a4..d51e70b 100644 --- a/src/modern/ui/engine_screens.inc +++ b/src/modern/ui/engine_screens.inc @@ -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 = "

Dreierpack Manager

" + diff --git a/src/modern/ui/files_screens.inc b/src/modern/ui/files_screens.inc index 386cf54..69c5447 100644 --- a/src/modern/ui/files_screens.inc +++ b/src/modern/ui/files_screens.inc @@ -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(); - const std::vector> 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> meta = {{"Gestaltung", look == "silver" ? "Papier" : look == "matchday" ? "Spieltag" : "Mitternacht"}, {"Widgets", std::to_string(widgets)}, {"Buttons", std::to_string(apps)}, {"Hintergrund", "Stadion bei Nacht"}}; out += "

"; for (const auto &[label, value] : meta) out += ""; return out + "
"; diff --git a/src/modern/ui/lineup_screens.inc b/src/modern/ui/lineup_screens.inc index 368d4cc..27abf68 100644 --- a/src/modern/ui/lineup_screens.inc +++ b/src/modern/ui/lineup_screens.inc @@ -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 = "" + ""; + if (condition.is_number_integer()) { + const int value = condition.get(); + body += std::string("= 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{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() + : 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() >= 85 ? "a" : condition.get() >= 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())) + "" + std::to_string(i + 1) + "", paired ? "lineup-player lineup-paired" : "lineup-player", @@ -365,8 +392,7 @@ std::string App::render_lineup() { out += "()) + "\" style=\"" + rect((ax + bx + lineup_player_size_dp) / 2 - 24, std::min(ay, by) - 24, 48, 22) + "\">P" + std::to_string(pair.at("number").get()) + ""; } out += "
" + - img("lineup.player.ghost", lineup_player_size_dp, - lineup_player_size_dp) + + shirt(false, Json()) + "
"; return result + ""; } +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> &figures, + const std::vector> &facts, + const Json &skills = Json()) { + std::string out = "
" + portrait + "
" + crest + + "" + esc(club) + " · " + esc(role) + "
"; + for (const auto &[label, value] : figures) + out += "
" + esc(value) + "" + esc(label) + "
"; + out += "
"; + // the seven skills, each on the engine's scale of none to three marks + out += "

Fähigkeiten

"; + bool any = false; + for (const auto &[key, label] : std::array, 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(), 0, 3); + any = true; + out += std::string("
") + label + "
"; + for (int pip = 0; pip < 3; ++pip) out += pip < value ? "
" : "
"; + out += "
"; + } + if (!any) out += "

Für diesen Spieler liegen keine Einzelwerte vor.

"; + out += "

Vertrag und Status

" + report_detail_fields(facts, 64) + "
"; + 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 = "
" + - img(photo, 496, 662.667, true, true, 1024) + - "

Porträt

" + - 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()) : 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 {}; diff --git a/src/modern/ui/reports_screens.inc b/src/modern/ui/reports_screens.inc index 2bbee34..3b1925d 100644 --- a/src/modern/ui/reports_screens.inc +++ b/src/modern/ui/reports_screens.inc @@ -139,7 +139,7 @@ std::string App::render_reports(const std::string &mode) { body += report_club_button(row.at(column == 0 ? "home" : "away").get(), 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 += "" + std::to_string(row.value("rank", 0)) + "."; } @@ -179,6 +179,14 @@ std::string App::render_reports(const std::string &mode) { body += ""; if(real_other&&rows.empty())body+="

"+std::string(!fixture.at("available").get()?"Diese Runde ist noch nicht ausgelost oder die vorherige Phase ist noch nicht abgeschlossen.":"Keine Paarungen vorhanden.")+"

"; body+=""; + if (!matches && !strengths && engine_mode_) { + // only the zones this league has + std::string items; + for (const auto &[kind, label] : std::array, 3>{{{"europe", "Europapokal"}, {"promotion", "Aufstieg"}, {"relegation", "Abstieg"}}}) + if (std::any_of(rows.begin(), rows.end(), [&](const Json &row) { return row.value("zone", "") == kind; })) + items += "" + label + ""; + if (!items.empty()) body += "
" + items + "
"; + } if (!matches && !strengths && !engine_mode_) { const auto legend = tier == 1 ? std::vector>{ diff --git a/src/modern/ui/settings_screens.inc b/src/modern/ui/settings_screens.inc index 152342c..eb6ef11 100644 --- a/src/modern/ui/settings_screens.inc +++ b/src/modern/ui/settings_screens.inc @@ -248,6 +248,11 @@ std::string App::render_settings() { (p.at("theme") == type ? "true" : "false") + "\""); } pane += ""; + pane += "

Bewegung

" + + 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(), "global", "display", "motion")) + + "
"; if (engine_mode_) { int width=0,height=0; SDL_GetWindowSize(video_.window,&width,&height); pane += "

Fenster

" + std::to_string(width) + " × " + std::to_string(height) + " · Automatische Anpassung

"; diff --git a/src/modern/ui/ui_preferences.cpp b/src/modern/ui/ui_preferences.cpp index e5625fd..62ac7e3 100644 --- a/src/modern/ui/ui_preferences.cpp +++ b/src/modern/ui/ui_preferences.cpp @@ -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"))) diff --git a/src/modern/ui/view.cpp b/src/modern/ui/view.cpp index b838e25..634c350 100644 --- a/src/modern/ui/view.cpp +++ b/src/modern/ui/view.cpp @@ -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();