diff --git a/assets/modern/calendar.rcss b/assets/modern/calendar.rcss index ea1e8ad..bd0bf72 100644 --- a/assets/modern/calendar.rcss +++ b/assets/modern/calendar.rcss @@ -48,3 +48,67 @@ body.silver .calendar-day.valid-target .calendar-event-mark, body.silver .calendar-day.rescheduled-date .calendar-event-mark {background-color:#256a4f;} body.silver .calendar-day .calendar-outline.source-outline {border-color:#256a4f;} body.silver .postpone-layout .postpone-summary small.valid {color:#256a4f;} + +/* --- The season calendar: twelve months, and a month opened as a sheet. --- */ +@keyframes cal-zoom-in {from {transform:scale(0.25);opacity:0;} to {transform:scale(1);opacity:1;}} +@keyframes cal-zoom-out {from {transform:scale(3.2);opacity:0;} to {transform:scale(1);opacity:1;}} +.cal-months.zoom-out {animation:0.3s cubic-out cal-zoom-out;} +.cal-sheet.zoom-in {animation:0.3s cubic-out cal-zoom-in;} +.cal-head {position:absolute;left:0;top:0;width:2612dp;height:120dp;display:flex;align-items:center;gap:24dp;border-bottom:4dp #9a7a3a;} +.cal-head h2 {display:block;margin:0;font-family:Display;font-size:64dp;line-height:76dp;font-weight:normal;} +.cal-head p {display:block;margin:0 0 0 auto;font-size:30dp;color:var(--muted);} +.cal-back,.cal-step {height:72dp;padding:0 30dp;border:2dp var(--rule);border-radius:36dp;background-color:transparent;decorator:none;font-size:32dp;display:flex;align-items:center;justify-content:center;} +.cal-step {width:72dp;padding:0;font-size:44dp;} +.cal-months {position:absolute;left:0;top:150dp;width:2612dp;height:1584dp;} +.cal-month {position:absolute;display:block;padding:22dp 28dp;border:2dp var(--rule);border-radius:10dp;background-color:var(--panel);decorator:none;text-align:left;transition:transform 0.12s cubic-out;} +.cal-month:hover {transform:scale(1.03);border-color:#25617a;background-color:#fffdf6;} +.cal-month.current {border:4dp #9a7a3a;} +.cal-month-name {display:block;position:absolute;left:28dp;top:18dp;font-family:Display;font-size:52dp;line-height:64dp;} +.cal-month-year {display:block;position:absolute;right:28dp;top:34dp;font-size:30dp;line-height:40dp;color:var(--muted);} +.cal-mini-grid {display:flex;flex-wrap:wrap;position:absolute;left:28dp;top:104dp;width:581dp;height:340dp;} +.cal-mini {display:flex;align-items:center;justify-content:center;width:83dp;height:48dp;font-size:28dp;color:var(--text);} +.cal-mini span {display:block;width:44dp;height:44dp;line-height:44dp;text-align:center;border-radius:22dp;} +.cal-mini.head {color:var(--muted);font-size:24dp;} +.cal-mini.match span {background-color:#25617a;color:#ffffff;font-weight:bold;} +.cal-mini.event span {border:2dp #9a7a3a;line-height:40dp;} +.cal-mini.today span {border:4dp #b24a4f;line-height:36dp;} +.cal-month-foot {display:block;position:absolute;left:28dp;right:28dp;bottom:16dp;height:40dp;line-height:40dp;font-size:28dp;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;} +.cal-legend {position:absolute;left:0;bottom:0;height:50dp;display:flex;align-items:center;font-size:28dp;color:var(--muted);} +.cal-legend span {display:block;flex-shrink:0;} +.cal-legend .key {width:34dp;height:34dp;border-radius:17dp;margin:0 12dp 0 36dp;} +.cal-legend .key.match {background-color:#25617a;margin-left:0;} +.cal-legend .key.event {border:2dp #9a7a3a;} +.cal-legend .key.today {border:4dp #b24a4f;} +.cal-sheet {position:absolute;left:0;top:140dp;width:2612dp;height:1590dp;} +.cal-weekdays {position:absolute;left:0;top:0;width:2612dp;height:70dp;display:flex;border-radius:8dp;background-color:#9a7a3a;} +.cal-weekdays span {display:block;flex:1;line-height:70dp;text-align:center;font-size:32dp;color:#ffffff;} +.cal-day {position:absolute;display:block;padding:0;border:2dp var(--rule);border-radius:8dp;background-color:var(--panel);decorator:none;overflow:hidden;} +.cal-day:hover {border-color:#25617a;} +.cal-day.weekend {background-color:#f3ead2b0;} +.cal-day.today {border:5dp #b24a4f;} +.cal-day.chosen {border:5dp #25617a;background-color:#fffdf6;} +.cal-day-number {display:block;position:absolute;right:16dp;top:6dp;font-family:Display;font-size:50dp;line-height:60dp;font-weight:bold;color:var(--muted);} +.cal-day.match .cal-day-number {color:var(--text);} +.cal-day-crest {display:block;position:absolute;left:16dp;top:14dp;width:104dp;height:104dp;} +.cal-day-name {display:block;position:absolute;left:16dp;right:12dp;bottom:50dp;height:38dp;line-height:38dp;font-size:28dp;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;} +.cal-day-note {display:block;position:absolute;left:16dp;right:12dp;bottom:10dp;height:38dp;line-height:38dp;font-size:28dp;text-align:left;color:var(--muted);white-space:nowrap;} +.cal-day-note.won {color:var(--win);font-weight:bold;} +.cal-day-note.lost {color:var(--loss);font-weight:bold;} +.cal-day-note.drawn {color:var(--text);font-weight:bold;} +.cal-day-event {display:block;position:absolute;left:16dp;right:12dp;bottom:12dp;line-height:36dp;font-size:27dp;text-align:left;color:#7d5f22;} +.cal-info {bottom:0;height:60dp;line-height:60dp;font-size:34dp;} +body.calm .cal-month:hover {transform:none;} +/* text never stands on the bare picture: lines of text get a framed field */ +.cal-head p,.cal-legend,.cal-info {padding:0 28dp;border:2dp var(--rule);border-radius:30dp;background-color:#fffbf2e6;color:var(--text);} +.cal-head p {height:60dp;line-height:60dp;font-size:32dp;} +.cal-legend {height:60dp;font-size:32dp;} +.cal-info {left:auto;right:0;width:auto;max-width:1900dp;text-align:right;} +.cal-month-foot {font-size:30dp;color:var(--text);} +.cal-mini {font-size:30dp;} +.cal-day-name,.cal-day-note {font-size:30dp;} +.cal-day-event {font-size:30dp;} +.cal-mini-grid {top:92dp;height:330dp;} +.cal-mini {height:46dp;flex-shrink:0;} +.cal-mini.head span {font-size:26dp;color:var(--muted);} +.cal-day-event {padding:0 14dp;right:auto;border:2dp #9a7a3a66;border-radius:18dp;background-color:#fffbf2;} +.cal-day-crest {width:120dp;height:120dp;} diff --git a/assets/modern/theme.rcss b/assets/modern/theme.rcss index 73fac25..a6e6a0e 100644 --- a/assets/modern/theme.rcss +++ b/assets/modern/theme.rcss @@ -171,7 +171,7 @@ body.silver {--paper-top:#fdfaf2;--paper-bottom:#f3ecdd;--paper-edge:#7b6a4a66;- --win:#3f7d63;--draw:#6c7780;--loss:#a23f45;--club:#25617a;--club-ink:#f7fcff;} body.matchday {--paper-top:#333237;--paper-bottom:#252428;--paper-edge:#00000090;--paper-under:#2c2b30;--paper-shadow:#000000a8;--rule:#f0e2e42a; --win:#9fd0a8;--draw:#c8c4c8;--loss:#f0a6a7;--club:#efb2aa;--club-ink:#2a2022;} -body.silver .window {--text:#262b31;--muted:#666d74;--border:#7d76664d;--soft:#5c513a0d;--panel:#ffffff70;--input:#ffffffd0;--hover:#b89a5a24;--selected:#e3d3a878;--strong:#f6f3ecfc;} +body.silver .window {--text:#262b31;--muted:#666d74;--border:#7d76664d;--soft:#5c513a0d;--panel:#fffbf2cc;--input:#ffffffd0;--hover:#b89a5a24;--selected:#e3d3a878;--strong:#f6f3ecfc;} /* paper buttons: a warm sheet with a darker foot; the main action carries the accent */ body.silver .window button.primary,body.silver .live-stage button.primary {background-color:#25617a;border-color:#1b4a5e;color:#f7fcff;decorator:none;} body.silver .window button.primary:hover,body.silver .live-stage button.primary:hover {background-color:#2f7592;} @@ -201,3 +201,24 @@ body.calm .desktop-app:hover .app-tile,body.calm .desktop-card[data-action]:hove .titlebar-club {margin-left:auto;width:68dp;height:68dp;flex-shrink:0;} /* a faint picture of the sheet's subject, under the content and under a veil of the paper's own tone */ .window-art {position:absolute;left:0;top:108dp;width:2720dp;height:1932dp;overflow:hidden;opacity:.85;pointer-events:none;} + +/* --- The training camps: a map on paper, the chosen camp as a card. --- */ +body.silver .camp-map {border:2dp var(--paper-edge);} +body.silver .camp-map-art {filter:invert(1) sepia(1) saturate(0.55) brightness(1.04);} +.camp-regions button {height:76dp;padding:0 36dp;border-radius:38dp;font-size:34dp;} +body.silver .camp-regions button.primary {background-color:#9a7a3a;border-color:#9a7a3a;color:#ffffff;decorator:none;} +.camp-pin,.camp-pin:hover {padding:0;border:0dp;border-radius:40dp;background-color:transparent;decorator:none;display:flex;align-items:center;justify-content:center;} +.camp-pin-dot {display:block;width:34dp;height:34dp;border:5dp #fffbf2;border-radius:22dp;background-color:#25617a;} +.camp-pin:hover .camp-pin-dot {background-color:#9a7a3a;} +.camp-pin.chosen .camp-pin-dot {width:50dp;height:50dp;border-radius:30dp;background-color:#b24a4f;} +.camp-pin-label {position:absolute;width:0;height:0;pointer-events:none;} +.camp-pin-label>span {display:block;position:absolute;left:-220dp;top:0;width:440dp;height:40dp;line-height:40dp;text-align:center;font-size:28dp;color:#3d362a;white-space:nowrap;} +.camp-pin-label.chosen>span {top:6dp;font-size:32dp;font-weight:bold;} +.camp-card {border:2dp var(--rule);border-radius:10dp;background-color:var(--panel);padding:36dp;} +.camp-card h2 {font-family:Display;font-size:60dp;line-height:72dp;} +.camp-card .small {font-size:32dp;color:var(--muted);} +.camp-card .field-row {font-size:36dp;} +.camp-card .field-row.camp-price strong {font-family:Display;font-size:52dp;} +.camp-card input {height:56dp;} +.camp-book-row button {width:100%;height:110dp;font-size:42dp;display:flex;align-items:center;justify-content:center;} +.camp-note {font-size:32dp;line-height:44dp;color:var(--text);} diff --git a/src/modern/ui/calendar_screen.inc b/src/modern/ui/calendar_screen.inc index 33f9c61..fb9a655 100644 --- a/src/modern/ui/calendar_screen.inc +++ b/src/modern/ui/calendar_screen.inc @@ -87,7 +87,7 @@ std::string App::calendar_grid(const Json &calendar, double top, double height, std::string App::render_calendar() { const auto calendar = engine_mode_ ? engine_calendar_view() : snap().state.at("calendar"); - if (engine_mode_) return "
" + calendar_grid(calendar,0,1640,28,28,false,false) + "

" + esc(calendar_day_info(calendar)) + "

" + engine_calendar_footer(calendar) + "
"; + if (engine_mode_) return render_calendar_year(); return "
" + calendar_grid(calendar, 0, 1640, 28, 28, false, false) + "

" + esc(calendar_day_info(calendar)) + diff --git a/src/modern/ui/calendar_year.inc b/src/modern/ui/calendar_year.inc new file mode 100644 index 0000000..e5ef0e4 --- /dev/null +++ b/src/modern/ui/calendar_year.inc @@ -0,0 +1,119 @@ +// SPDX-License-Identifier: GPL-3.0-only +// The season calendar of a career: the twelve months as small sheets; a click opens a month +// as a large sheet with a field per day (the own matches with crest and result, other +// dates as a line), the right mouse button returns to the year. The change is a zoom from +// and to the month's place among the twelve. +namespace { +constexpr std::array calendar_month_names = {"Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"}; +std::string calendar_kind_label(const std::string &k) { + return k == "league" ? "Liga" : k == "friendly" ? "Testspiel" : k == "replay" ? "Nachholtermin" : k == "indoor" ? "Halle" : k == "national" ? "Länderspiel" : k.starts_with("cup:") ? "Pokal" : "Wettbewerb"; +} +} + +std::string App::render_calendar_year() { + const auto view = engine_calendar_view(); + const auto days = calendar_days(view.at("start").get()); + const int selected = view.at("selected"), today = view.at("today").is_number_integer() ? view.at("today").get() : -1; + const auto own = engine_data_.at("desktop").at("meta").at("scope").at("teamId").get(); + // where each of the twelve months begins + std::vector first; + for (int i = 0; i < int(days.size()); ++i) + if (i == 0 || days[size_t(i)].month != days[size_t(i - 1)].month) first.push_back(i); + const int months = std::min(12, int(first.size())); + if (calendar_month_ >= months) calendar_month_ = -1; + const auto events_of = [&](int index) { return view.at("events").value(std::to_string(index), Json{{"kinds", Json::array()}, {"ids", Json::array()}}); }; + const auto fixture_of = [&](int index) -> const Json * { + for (const auto &f : view.at("fixtures")) if (f.at("day") == index) return &f; + return nullptr; + }; + const std::string anim = calendar_anim_; + calendar_anim_.clear(); + const auto origin = [&](int panel) { return " style=\"transform-origin:" + scalar(12.5 + (panel % 4) * 25) + "% " + scalar(20 + (panel / 4) * 30) + "%;\""; }; + const auto season = engine_data_.at("desktop").at("meta").at("season").at("label").get(); + std::string out = "

"; + if (calendar_month_ < 0) { + out += "

Saison " + esc(season) + "

Einen Monat anklicken, um seine Tage zu sehen.

"; + for (int panel = 0; panel < months; ++panel) { + const int begin = first[size_t(panel)], end = panel + 1 < int(first.size()) ? first[size_t(panel + 1)] : int(days.size()); + const int month = days[size_t(begin)].month, offset = days[size_t(begin)].weekday; + int matches = 0, others = 0; + std::string grid; + for (const char *w : {"M", "D", "M", "D", "F", "S", "S"}) grid += std::string("") + w + ""; + for (int blank = 0; blank < offset; ++blank) grid += ""; + for (int index = begin; index < end; ++index) { + const bool match = fixture_of(index) != nullptr, other = !match && !events_of(index).at("kinds").empty(); + matches += match; others += other; + grid += "" + std::to_string(days[size_t(index)].day) + ""; + } + const bool current = today >= begin && today < end; + out += btn("calendar-month", "" + std::string(calendar_month_names[size_t(month - 1)]) + "" + std::to_string(days[size_t(begin)].year) + + "" + grid + "" + + (matches ? std::to_string(matches) + (matches == 1 ? " eigenes Spiel" : " eigene Spiele") : std::string("kein eigenes Spiel")) + (others ? " · " + std::to_string(others) + " weitere Termine" : std::string()) + "", + std::string("cal-month") + (current ? " current" : ""), + "id=\"calendar-month-" + std::to_string(panel) + "\" data-id=\"" + std::to_string(panel) + "\" aria-label=\"" + calendar_month_names[size_t(month - 1)] + " öffnen\" style=\"" + + rect((panel % 4) * 659, (panel / 4) * 536, 635, 512) + "\""); + } + out += "
eigenes Spielweiterer Terminheute
"; + return out + "
"; + } + const int panel = calendar_month_, begin = first[size_t(panel)], end = panel + 1 < int(first.size()) ? first[size_t(panel + 1)] : int(days.size()); + const int month = days[size_t(begin)].month, offset = days[size_t(begin)].weekday; + out += "
" + btn("calendar-month", "‹ Saison", "cal-back", "id=\"calendar-year\" data-id=\"-1\"") + + btn("calendar-month", "‹", "cal-step", "id=\"calendar-previous\" data-id=\"" + std::to_string(panel - 1) + "\" aria-label=\"Vorheriger Monat\" " + (panel > 0 ? "" : "disabled")) + + "

" + calendar_month_names[size_t(month - 1)] + " " + std::to_string(days[size_t(begin)].year) + "

" + + btn("calendar-month", "›", "cal-step", "id=\"calendar-next\" data-id=\"" + std::to_string(panel + 1) + "\" aria-label=\"Nächster Monat\" " + (panel + 1 < months ? "" : "disabled")) + + "

Rechte Maustaste: zurück zur Saison

"; + for (const char *w : {"Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"}) out += std::string("") + w + ""; + out += "
"; + const int rows = (offset + (end - begin) + 6) / 7; + const double cell_w = 2612.0 / 7, cell_h = 1500.0 / rows; + for (int index = begin; index < end; ++index) { + const int slot = offset + index - begin; + const auto *fixture = fixture_of(index); + const auto events = events_of(index); + std::string body = "" + std::to_string(days[size_t(index)].day) + ""; + if (fixture) { + const bool home = fixture->at("home").at("id") == own; + const auto &other = fixture->at(home ? "away" : "home"); + const auto *club = world_->find("clubs", other.value("id", std::string())); + std::string result, tone; + if (!fixture->at("result").is_null()) { + const int a = fixture->at("result")[0].get(), b = fixture->at("result")[1].get(), mine = home ? a : b, theirs = home ? b : a; + result = std::to_string(a) + ":" + std::to_string(b); + tone = mine > theirs ? " won" : mine < theirs ? " lost" : " drawn"; + } + const auto status = fixture->value("status", std::string()); + body += "" + crest(club, 120) + "" + esc(engine_text(other.at("name"))) + "" + + (result.empty() ? std::string(home ? "Heim" : "Auswärts") + (status == "rescheduled" ? " · verlegt" : status == "postponed" ? " · ausgefallen" : "") : (home ? "Heim " : "Auswärts ") + result) + ""; + } else if (!events.at("kinds").empty()) { + std::set labels; + for (const auto &kind : events.at("kinds")) labels.insert(calendar_kind_label(kind.get())); + std::string text; + for (const auto &label : labels) text += (text.empty() ? "" : " · ") + label; + body += "" + esc(text) + ""; + } + out += btn("calendar-select", body, std::string("cal-day") + (fixture ? " match" : !events.at("kinds").empty() ? " event" : "") + (index == today ? " today" : "") + (index == selected ? " chosen" : "") + (slot % 7 >= 5 ? " weekend" : ""), + "id=\"calendar-day-" + std::to_string(index) + "\" data-id=\"" + std::to_string(index) + "\" aria-pressed=\"" + (index == selected ? "true" : "false") + "\" aria-label=\"" + calendar_date_label(days[size_t(index)].iso) + + "\" style=\"" + rect((slot % 7) * cell_w + 6, 76 + (slot / 7) * cell_h + 6, cell_w - 12, cell_h - 12) + "\""); + } + out += "

" + esc(calendar_day_info(view)) + "

"; + return out + "
"; +} +// Opens a month (0..11 in season order) or returns to the year (-1), with the zoom. +bool App::calendar_month_action(const std::string &action, Rml::Element *target) { + if (action != "calendar-month" || menu_ != "calendar" || !engine_mode_ || !target) return false; + const int next = target->GetAttribute("data-id", -1); + if (next < -1 || next > 11 || next == calendar_month_) return true; + calendar_open_month(next); + return true; +} +void App::calendar_open_month(int next) { + const bool calm = ui_preferences_.is_object() && ui_preferences_.contains("display") && ui_preferences_.at("display").value("motion", "full") == "reduced"; + // between two months the sheet only changes; into and out of a month it zooms + calendar_anim_ = calm || (next >= 0 && calendar_month_ >= 0) ? "" : next >= 0 ? "zoom-in" : "zoom-out"; + calendar_from_ = calendar_month_ >= 0 ? calendar_month_ : next; + calendar_month_ = next; + focus_after_render_ = next >= 0 ? "calendar-year" : "calendar-month-" + std::to_string(calendar_from_); + refresh(); +} diff --git a/src/modern/ui/engine_calendar.inc b/src/modern/ui/engine_calendar.inc index 163b932..ab4168e 100644 --- a/src/modern/ui/engine_calendar.inc +++ b/src/modern/ui/engine_calendar.inc @@ -78,6 +78,7 @@ std::string App::engine_postpone_view() { } bool App::engine_calendar_action(const std::string &action,Rml::Element *target) { if (menu_ != "calendar" && menu_ != "postpone") return false; + if (calendar_month_action(action, target)) return true; if (action != "calendar-select" && !action.starts_with("postpone-")) return false; if (engine_busy_ || !engine_fresh_) return true; const auto view = engine_calendar_view(); diff --git a/src/modern/ui/engine_controls.inc b/src/modern/ui/engine_controls.inc index 12bab66..0009f41 100644 --- a/src/modern/ui/engine_controls.inc +++ b/src/modern/ui/engine_controls.inc @@ -277,6 +277,12 @@ void App::engine_event(Rml::Event &event) { if (type == "keydown") keyboard_navigation_ = true; if (type == "mousedown") keyboard_navigation_ = false; if (balance_simulation_event(event)) return; + // the right mouse button leaves an opened month of the calendar + if (menu_ == "calendar" && calendar_month_ >= 0 && popup_.empty() && + (type == "contextmenu" || (type == "mousedown" && event.GetParameter("button", 0) == 1))) { + if (type == "mousedown") calendar_open_month(-1); + return; + } if (scene_ == "live" && live_.available()) { // The ticker of a played kickoff: only its own controls, nothing of the desk beneath. if (live_event(event)) return; @@ -486,7 +492,7 @@ void App::engine_event(Rml::Event &event) { else if(action=="engine-open"&&(id=="tables"||id=="strengths")){menu_=id;engine_reports_sync();engine_reports_load(engine_reports_state_.at("league"),engine_reports_state_.at("filter"));} else if (action == "engine-open" && id == "almanac") { menu_=id;engine_almanac_sync();engine_almanac_load({{"kind","index"}}); } else if (action == "engine-open" && id == "friendlies") { menu_ = id; planning_dialog_.clear(); engine_friendly_sync(); refresh(); } - else if (action == "engine-open" && (id == "calendar" || id == "postpone")) { menu_ = id; engine_move_id_.clear(); engine_calendar_sync(); refresh(); } + else if (action == "engine-open" && (id == "calendar" || id == "postpone")) { menu_ = id; engine_move_id_.clear(); calendar_month_ = -1; calendar_anim_.clear(); engine_calendar_sync(); refresh(); } else if (action == "engine-open" && id == "contracts") { menu_ = id; engine_contracts_clear(false); contracts_player_.clear(); engine_contract_scroll_ = 0.f; refresh(); } else if (action == "engine-open" && id == "bank") { bank_view_ = "entrance"; bank_hint_.clear(); menu_ = "bank"; refresh(); } else if (action == "engine-open" && id == "save") engine_save(); diff --git a/src/modern/ui/screens.inc b/src/modern/ui/screens.inc index ddcf484..a1b0e19 100644 --- a/src/modern/ui/screens.inc +++ b/src/modern/ui/screens.inc @@ -93,34 +93,31 @@ std::string App::render_camp() { auto region = selections_["camp-region"]; if (region.empty()) region = chosen->value("map", "map:eu"); - std::string body = "
"; + "bottom:0;\">
"; for (const auto &m : demo.at("maps")) body += btn("camp-region", esc(m.value("name", "")), m.value("id", "") == region ? "primary" : "", "data-id=\"" + esc(m.value("id", "")) + "\""); - body += "
" + - img("map." + region.substr(4), 1440, 1603.2, false, false, 1600); + "2dp;overflow:hidden;border-radius:10dp;\">
" + + img("map." + region.substr(4), 1440, 1603.2, false, false, 1600) + "
"; for (const auto &c : camps) if (c.value("map", "") == region && c.value("positioned", true)) { const double x = c.value("x", 0) * 1.2, y = c.value("y", 0) * 1.2; - body += btn("camp-select", - "", - c.value("id", "") == id ? "primary" : "", - "data-id=\"" + esc(c.value("id", "")) + - "\" style=\"position:absolute;" + - rect(x - 34, y - 34, 68, 68) + - "padding:23dp;border-radius:34dp;\""); + const bool here = c.value("id", "") == id; + body += btn("camp-select", "", here ? "camp-pin chosen" : "camp-pin", + "data-id=\"" + esc(c.value("id", "")) + "\" aria-label=\"" + esc(c.value("name", "")) + "\" style=\"position:absolute;" + rect(x - 40, y - 40, 80, 80) + "\""); + // every camp carries its place on the map; the chosen one its name + body += "" + + esc(here ? c.value("name", "") : c.value("place", "")) + ""; } - body += "
<" - "div style=\"height:570dp;overflow:hidden;border-radius:24dp;\">" + - img(chosen->value("gui_image", ""), 1100, 570, false, true, 1400) + + body += "
<" + "div class=\"camp-photo\" style=\"height:520dp;overflow:hidden;border-radius:8dp;\">" + + img(chosen->value("gui_image", ""), 1060, 520, false, true, 1400) + "

" + esc(chosen->value("name", "")) + "

" + @@ -131,14 +128,14 @@ std::string App::render_camp() { const int q = chosen->at("quality")[i].get(); std::string stars; for (int j = 0; j < q; ++j) - stars += glyph("star", 32); - body += "

" + std::string(qualities[i]) + "" + stars + "
"; } - body += "
PreisPreis" + (chosen->at("price").is_null() ? std::string("—") : (engine_mode_ ? money(chosen->at("price").get(), {{"code", "EUR"}, {"minor_units", 2}}) : cash(chosen->at("price").get()))) + "
"; const std::array focus = {"Kondition", "Technik", "Spiel", @@ -171,9 +168,9 @@ std::string App::render_camp() { else if (reason == "visit_limit") booking_note = "Das Trainingslagerlimit dieser Saison ist erreicht."; else if (quote.value("exceedsCash", false)) booking_note = "Der Preis übersteigt das aktuelle Guthaben."; } - body += "
" + - btn("camp-remember", engine_mode_ ? "Verbindlich buchen" : "Vormerken", "primary", "id=\"camp-book\" " + std::string(engine_mode_ && ![&]() { for (const auto &camp : engine_data_.at("camps").at("data").at("camps")) if (camp.at("id") == id) return engine_fresh_ && camp.at("quote").is_object() && camp.at("quote").value("allowed", false); return false; }() ? "disabled" : "")) + "
" + (engine_mode_ ? "

" + esc(engine_busy_ ? engine_operation_ : (booking_note.empty() ? engine_notice_ : booking_note)) + "

" : "") + ""; + btn("camp-remember", engine_mode_ ? "Verbindlich buchen" : "Vormerken", "primary", "id=\"camp-book\" " + std::string(engine_mode_ && ![&]() { for (const auto &camp : engine_data_.at("camps").at("data").at("camps")) if (camp.at("id") == id) return engine_fresh_ && camp.at("quote").is_object() && camp.at("quote").value("allowed", false); return false; }() ? "disabled" : "")) + "" + (engine_mode_ ? "

" + esc(engine_busy_ ? engine_operation_ : (booking_note.empty() ? engine_notice_ : booking_note)) + "

" : "") + ""; return body; } std::string App::render_menu(const std::string &key) { diff --git a/src/modern/ui/view.cpp b/src/modern/ui/view.cpp index d25c0b0..191aeef 100644 --- a/src/modern/ui/view.cpp +++ b/src/modern/ui/view.cpp @@ -634,8 +634,9 @@ class App final : public Rml::EventListener { // gradient stay on top of the picture's; without such pictures the sheet is plain. std::string window_art() { static const std::map motifs{ - {"stadium", "seats"}, {"advertising", "stand"}, {"environment", "fans"}, {"training", "training"}, {"camps", "training"}, - {"lineup", "kickoff"}, {"tactics", "kickoff"}, {"squad", "locker"}, {"contracts", "locker"}, {"transfer", "locker"}, + {"stadium", "seats"}, {"advertising", "boards"}, {"calendar", "bench"}, {"postpone", "bench"}, {"friendlies", "bench"}, {"camp", "training"}, + {"almanac", "trophies"}, {"achievements", "trophies"}, {"highscore", "trophies"}, {"news", "press"}, {"newplayer", "press"}, {"settings", "press"}, {"environment", "fans"}, {"training", "training"}, {"camps", "training"}, + {"lineup", "bench"}, {"tactics", "bench"}, {"squad", "locker"}, {"contracts", "locker"}, {"transfer", "press"}, {"tables", "stand"}, {"league", "stand"}, {"other", "stand"}, {"strengths", "stand"}, {"statistics", "kickoff"}, {"scorers", "kickoff"}, {"fairplay", "kickoff"}}; if (theme_ != "silver") return {}; @@ -830,6 +831,12 @@ class App final : public Rml::EventListener { std::string render_training(); std::string render_tactics(); std::string render_calendar(); + // the career's calendar: -1 the twelve months, else the opened month (calendar_year.inc) + int calendar_month_ = -1, calendar_from_ = 0; + std::string calendar_anim_; + std::string render_calendar_year(); + bool calendar_month_action(const std::string &, Rml::Element *); + void calendar_open_month(int); Json planning_calendar() const; std::string calendar_day_info(const Json &) const; std::string calendar_grid(const Json &, double, double, double, double, bool, bool); @@ -1700,6 +1707,7 @@ public: #include "modern/ui/engine_friendlies.inc" #include "modern/ui/engine_almanac.inc" #include "modern/ui/engine_reports.inc" +#include "modern/ui/calendar_year.inc" #include "modern/ui/finance_simulation.inc" #include "modern/ui/statistics_analysis.inc" #include "modern/ui/engine_rankings.inc"