diff --git a/assets/modern/pages.rcss b/assets/modern/pages.rcss index 4c5dc9b..1625959 100644 --- a/assets/modern/pages.rcss +++ b/assets/modern/pages.rcss @@ -707,7 +707,7 @@ body.midnight .cp-map-name,body.matchday .cp-map-name {color:#f0ece2;font-effect .mg-owner select {width:520dp;height:68dp;padding:0 27dp;border:2dp var(--p-div);border-radius:36dp;background-color:var(--p-n1);font-family:Modern;font-size:30dp;color:var(--p-text);} /* --- advertising: the ground with its fourteen boards, five pictures, the offers as a note --- */ -.ad-ground {position:relative;display:block;flex:none;width:1714.5dp;height:1395dp;} +.ad-ground {position:relative;display:block;flex:none;width:2160dp;height:1503dp;} .ad-ground img {position:absolute;left:0;top:0;} .ad-board,.ad-board:hover,.ad-board:focus,.ad-board:disabled {position:absolute;display:block;padding:0;margin:0;border:0dp;border-radius:27dp;background-color:transparent;decorator:none;overflow:visible;} .ad-board:hover {background-color:#c8733c26;} @@ -750,3 +750,26 @@ body.midnight .cp-map-name,body.matchday .cp-map-name {color:#f0ece2;font-effect .ad-tile:disabled,.ad-tile[disabled] {opacity:1;} .ad-note.wide {width:1056dp;} .ad-help {display:block;font-size:27dp;line-height:36dp;} + +/* advertising: three wide pictures under one another fill the column */ +.ad-tiles {flex-direction:column;flex-wrap:nowrap;} +.ad-tiles.wide {flex-direction:row;flex-wrap:wrap;} +/* investments: the use of each budget, and the pencilled note taped to the page */ +.ad-use {display:block;font-size:28dp;line-height:40dp;} +.ad-use .pg-bar {display:block;flex:none;margin:4dp 0 11dp;} +.ad-use span {display:block;white-space:nowrap;} +.ad-memo {position:relative;display:block;flex:none;margin:0 18dp 9dp 9dp;padding:54dp 40dp 36dp;border-radius:9dp;background-color:#fbf1bd;border:2dp #e3d59a;transform:rotate(-1.6deg);font-family:Pencil;color:#3a332b;} +.ad-memo-tape {position:absolute;left:50%;top:-22dp;display:block;width:200dp;height:50dp;margin-left:-100dp;background-color:#e9dcc0cc;transform:rotate(2.5deg);} +.ad-memo strong {display:block;margin-bottom:9dp;font-family:Pencil;font-weight:bold;font-size:50dp;line-height:58dp;color:#8c491a;} +.ad-memo span {display:block;font-size:40dp;line-height:52dp;} + +/* advertising: three pictures of 4:3 beside the larger ground, the forecast as one line */ +.ad-tile.four,.ad-tile.four:hover,.ad-tile.four:focus,.ad-tile.four:disabled {width:612dp;} +.ad-tile.four .ad-tile-art {width:612dp;} +.ad-tile.four .ad-tile-cap,.ad-tile.four .ad-tile-over {width:608dp;} +.ad-strip {display:flex;flex:1;min-height:0;align-items:center;gap:45dp;padding:0 36dp;border:2dp var(--p-div);border-radius:45dp;background-color:var(--p-n1);} +.ad-strip-item {display:flex;align-items:baseline;gap:16dp;font-size:29dp;} +.ad-strip-item span {display:block;} +.ad-strip-item strong {display:block;font-family:Display;font-weight:normal;font-size:40dp;white-space:nowrap;} +.ad-board-no {font-size:21dp;} +.ad-board-face strong {font-size:28dp;line-height:34dp;} diff --git a/src/modern/ui/advertising_screens.inc b/src/modern/ui/advertising_screens.inc index 303d6c1..893fa94 100644 --- a/src/modern/ui/advertising_screens.inc +++ b/src/modern/ui/advertising_screens.inc @@ -1,52 +1,64 @@ // SPDX-License-Identifier: GPL-3.0-only namespace { -// Where the fourteen boards stand around the pitch, in units of the page on a ground of -// 762 x 620: five along the far side, two at each end, five along the near side, numbered -// clockwise from the upper left. +// Where the fourteen boards stand around the pitch, in units of the page: five along the far +// side, two at each end, five along the near side, numbered clockwise from the upper left. struct AdBoard { double x, y, w, h; int turn; }; // turn: 0 flat, 1 right end, -1 left end -constexpr double ad_ground_w = 762, ad_ground_h = 620; +constexpr double ad_ground_w = 960, ad_ground_h = 668, ad_board_deep = 66; AdBoard ad_board(int index) { - constexpr double long_w = 117.3, deep = 62, step = 123.4, first = 76.2, tall = 208; - if (index < 5) return {first + index * step, 0, long_w, deep, 0}; - if (index < 7) return {ad_ground_w - deep, 92 + (index - 5) * (tall + 20), deep, tall, 1}; - if (index < 12) return {first + (11 - index) * step, ad_ground_h - deep, long_w, deep, 0}; - return {0, 92 + (13 - index) * (tall + 20), deep, tall, -1}; + constexpr double first = ad_board_deep + 14, gap = 6, long_w = (ad_ground_w - 2 * first - 4 * gap) / 5, step = long_w + gap; + constexpr double end_top = ad_board_deep + 26, end_gap = 20, tall = (ad_ground_h - 2 * end_top - end_gap) / 2; + if (index < 5) return {first + index * step, 0, long_w, ad_board_deep, 0}; + if (index < 7) return {ad_ground_w - ad_board_deep, end_top + (index - 5) * (tall + end_gap), ad_board_deep, tall, 1}; + if (index < 12) return {first + (11 - index) * step, ad_ground_h - ad_board_deep, long_w, ad_board_deep, 0}; + return {0, end_top + (13 - index) * (tall + end_gap), ad_board_deep, tall, -1}; } // The ground seen from above: the apron with its track, the mown pitch with all its lines, // goals, benches and corner flags, and around it the frames of the fourteen boards: lit where // a sponsor has signed, an empty frame where the place is free. std::string ad_ground_svg(const std::array &taken, int chosen) { const auto n = [](double v) { return scalar(std::round(v * 10) / 10); }; - std::string svg = ""; - // apron and running track - svg += ""; - for (int lane = 0; lane < 3; ++lane) svg += ""; - svg += ""; - // the pitch: eleven mown stripes - constexpr double px = 112, py = 110, pw = 538, ph = 400; - for (int stripe = 0; stripe < 11; ++stripe) - svg += ""; - const double cx = px + pw / 2, cy = py + ph / 2; - svg += ""; + constexpr double W = ad_ground_w, H = ad_ground_h, D = ad_board_deep; + const auto frame = [&](double inset, double radius, const std::string &more) { + return ""; + }; + std::string svg = ""; + // apron, running track with its lanes, the grass around the pitch + svg += frame(0, 46, "fill=\"#d9c9a4\"") + frame(8, 40, "fill=\"#c98a5e\""); + for (int lane = 0; lane < 4; ++lane) svg += frame(12.5 + lane * 4.6, 36 - lane * 3.4, "fill=\"none\" stroke=\"#f6e3d2\" stroke-opacity=\".55\" stroke-width=\".9\""); + svg += frame(31, 22, "fill=\"#8fb271\""); + // the pitch: thirteen mown stripes + constexpr double px = D + 48, py = D + 46, pw = W - 2 * px, ph = H - 2 * py; + constexpr int stripes = 13; + for (int stripe = 0; stripe < stripes; ++stripe) + svg += ""; + // lengths on the pitch in metres: it is 105 long + const double m = pw / 105, cx = px + pw / 2, cy = py + ph / 2; + svg += ""; for (const int side : {-1, 1}) { const double edge = side < 0 ? px : px + pw; // penalty area, goal area, the arc at the area, the corner arcs - svg += ""; - svg += ""; + svg += ""; + svg += ""; svg += ""; } - svg += ""; + svg += ""; for (const int side : {-1, 1}) { - const double edge = side < 0 ? px : px + pw, back = edge + side * 13; + const double edge = side < 0 ? px : px + pw, back = edge + side * 14, half = 3.66 * m + 4; // the goal with its net, and the flags in the corners - svg += ""; - for (int k = 1; k < 5; ++k) svg += ""; + svg += ""; + for (int k = 1; k < 6; ++k) svg += ""; + svg += ""; for (const double flag_y : {py, py + ph}) - svg += ""; + svg += ""; } - // the two benches on the far side, with their roofs - for (const double bench : {cx - 96, cx + 40}) - svg += ""; + // the two benches on the far side with their glass roofs, and the coaches' zones before them + for (const double bench : {cx - 118, cx + 46}) { + svg += ""; + svg += ""; + for (int seat = 0; seat < 8; ++seat) svg += ""; + } + // the players' tunnel between the benches + svg += ""; // the boards: a shadow towards the pitch, two feet, the frame for (int i = 0; i < 14; ++i) { const auto b = ad_board(i); @@ -54,9 +66,9 @@ std::string ad_ground_svg(const std::array &taken, int chosen) { const double fx = b.x + 4, fy = b.y + 4, fw = b.w - 8, fh = b.h - 8; svg += ""; if (b.turn == 0) - for (const double foot : {fx + 14, fx + fw - 14}) svg += ""; + for (const double foot : {fx + 16, fx + fw - 16}) svg += ""; else - for (const double foot : {fy + 16, fy + fh - 16}) svg += " 0 ? fx - 5 : fx + fw - 2) + "\" y=\"" + n(foot - 2) + "\" width=\"7\" height=\"4\" fill=\"#6f6a60\"/>"; + for (const double foot : {fy + 18, fy + fh - 18}) svg += " 0 ? fx - 5 : fx + fw - 2) + "\" y=\"" + n(foot - 2) + "\" width=\"7\" height=\"4\" fill=\"#6f6a60\"/>"; svg += ""; // a sponsor's board carries a stripe in the accent along its outer edge @@ -117,7 +129,7 @@ std::string App::render_advertising() { // or "big"; `amount` stands beside the title where the picture is large enough for it. const auto tile = [&](const std::string &action, const std::string &id, const std::string &attrs, const std::string &art, const std::string &title, const std::string &kicker, const std::string &value, const std::string &detail, bool selected, const std::string &shape = std::string(), const std::string &amount = std::string()) { - const double w = shape == "big" ? 921 : shape == "wide" ? 1056 : 520, h = shape == "big" ? 690 : 459; + const double w = shape == "big" ? 921 : shape == "four" ? 612 : 520, h = shape == "big" ? 690 : 459; return btn(action, "" + img(art, w, h, false, true, shape.empty() ? 1100 : 1600) + "" + esc(pg_upper(kicker)) + "" + esc(value) + "" + esc(detail) + "" + esc(title) + "" + (amount.empty() ? std::string() : "" + esc(amount) + "") + "", std::string("ad-tile") + (shape.empty() ? "" : " " + shape) + (selected ? " selected" : ""), "id=\"" + id + "\" " + attrs + " aria-label=\"" + esc(title + ": " + value + (detail.empty() ? "" : ", " + detail)) + "\""); @@ -130,7 +142,9 @@ std::string App::render_advertising() { if (investing) { page_hint_ = "Wohin der Verein sein Geld steckt"; static constexpr std::array spending_art{"advertising.scene.merchandise", "advertising.scene.press", "advertising.scene.fans"}; - std::string rows; + std::string rows, use; + int64_t largest = 0; + for (const auto &row : view.at("spending")) largest = std::max(largest, row.at("amount").get()); out += "
"; for (int i = 0; i < 3; ++i) { const auto &row = view.at("spending")[size_t(i)]; @@ -139,15 +153,34 @@ std::string App::render_advertising() { out += tile("ad-spending", "ad-spending-" + std::to_string(i), "data-ad-spending=\"" + std::to_string(i) + "\" data-id=\"" + std::to_string(i) + "\"", spending_art[size_t(i)], row.at("name").get(), i == 0 ? "Bestellung" : "Monatsbudget", amount, waiting ? "Die Lieferung läuft noch" : "Anklicken zum Ändern", false, "big", amount); rows += "
" + esc(row.at("name").get()) + "" + esc(amount) + (i == 0 ? "" : " / Monat") + "
"; + // how much of what the budget may hold is used; without a limit the largest budget is the measure + const auto value = row.at("amount").get(), limit = row.value("max", int64_t(0)); + const double share = limit > 0 ? double(value) * 100 / double(limit) : largest > 0 ? double(value) * 100 / double(largest) : 0; + use += "
" + esc(row.at("name").get()) + "" + + esc(limit > 0 ? std::to_string(int(std::lround(share))) + " % von " + ad_cash(limit) : amount) + "
" + pg_bar(share, i == 0 ? "soft" : i == 1 ? "accent" : "sage") + "
"; } out += tile("ad-soon", "ad-spending-international", soon, "investment.scene.international", "Internationale Vermarktung", "Neu", "Noch nicht im Spiel", "Diese Investition folgt", false, "big", "—") + "
" + pg_kicker("Investitionen") + rows + "
Internationale Vermarktungfolgt
" + (delivery.empty() ? std::string() : "" + esc(delivery) + "") + "
" + pg_kicker("Vereinsprognose / Monat") + "
Einnahmen" + esc(ad_cash(view.at("income").get())) + "
Ausgaben" + esc(ad_cash(view.at("expenses").get())) + "
Saldo() >= 0 ? "ad-plus" : "ad-minus") + "\">" + - esc((view.at("balance").get() > 0 ? "+ " : "") + ad_cash(view.at("balance").get())) + "
Der Mauszeiger auf einem Bild zeigt den aktuellen Stand, ein Klick öffnet das Zahlenfeld. Fanartikel werden bestellt und geliefert; Öffentlichkeitsarbeit und Fanbetreuung sind Budgets je Monat.
"; + esc((view.at("balance").get() > 0 ? "+ " : "") + ad_cash(view.at("balance").get())) + ""; + // the note: only what the figures above say, in the manager's own hand + const auto monthly = view.at("spending")[1].at("amount").get() + view.at("spending")[2].at("amount").get(); + const auto expenses = view.at("expenses").get(), merchandise = view.at("spending")[0].at("amount").get(); + std::vector lines; + if (monthly > 0) { + lines.push_back("Presse und Fans: " + ad_cash(monthly) + " im Monat."); + if (expenses > 0) lines.push_back("Das sind " + std::to_string(std::max(1, std::llround(double(monthly) * 100 / double(expenses)))) + " % aller Monatsausgaben."); + } else lines.push_back("Presse und Fans bekommen gerade nichts!"); + lines.push_back(!delivery.empty() ? "Fanartikel sind unterwegs – abwarten." : merchandise > 0 ? "Fanartikel zuletzt bestellt für " + ad_cash(merchandise) + "." : "Fanshop leer. Nachbestellen?"); + if (view.at("balance").get() < 0) lines.push_back("Achtung: Der Monat schließt im Minus."); + lines.push_back("Ausland: kommt noch."); + out += "
" + pg_kicker("Auslastung der Budgets") + use + "
Merkzettel"; + for (const auto &line : lines) out += "" + esc(line) + ""; + out += "
"; } else { out += "
" + - picture(renderer_.diagram("advertising-ground", ad_ground_svg(taken, advertising_selected_ >= 0 && advertising_selected_ < 14 ? advertising_selected_ : -1), 2400), ad_ground_w * 2.25, ad_ground_h * 2.25); + picture(renderer_.diagram("advertising-ground", ad_ground_svg(taken, advertising_selected_ >= 0 && advertising_selected_ < 14 ? advertising_selected_ : -1), 3000), ad_ground_w * 2.25, ad_ground_h * 2.25); for (int i = 0; i < 14; ++i) { const auto &c = slots[size_t(i)]; const auto b = ad_board(i); @@ -160,16 +193,20 @@ std::string App::render_advertising() { "id=\"ad-contract-" + std::to_string(i) + "\" data-ad-contract=\"" + std::to_string(i) + "\" data-id=\"" + std::to_string(i) + "\" aria-pressed=\"" + (advertising_selected_ == i ? "true" : "false") + "\" aria-label=\"Bande " + std::to_string(i + 1) + ", " + esc(on ? name + ", " + terms(c) : std::string("Platz frei")) + "\" title=\"" + esc(on ? name + " · " + terms(c) : std::string("Platz frei · anklicken für Angebote")) + "\" style=\"left:" + pg(b.x) + ";top:" + pg(b.y) + ";width:" + pg(b.w) + ";height:" + pg(b.h) + ";\""); } - out += "
" + forecast() + "
"; + out += "
" + pg_kicker("Vereinsprognose / Monat"); + for (const auto &[label, key] : std::array, 3>{{{"Einnahmen", "income"}, {"Ausgaben", "expenses"}, {"Saldo", "balance"}}}) { + const auto value = view.at(key).get(); + out += "" + std::string(label) + "= 0 ? "ad-plus" : "ad-minus") : "") + "\">" + + esc((std::string(key) == "balance" && value > 0 ? "+ " : "") + ad_cash(value)) + ""; + } + out += "
"; for (const auto &[slot, art, title] : std::array, 2>{{{14, "advertising.scene.shirt", "Trikotwerbung"}, {15, "advertising.scene.tv", "TV-Rechte"}}}) { const auto &c = slots[size_t(slot)]; const bool on = c.at("active") == true; out += tile("ad-contract", "ad-contract-" + std::to_string(slot), "data-ad-contract=\"" + std::to_string(slot) + "\" data-id=\"" + std::to_string(slot) + "\" aria-pressed=\"" + (advertising_selected_ == slot ? "true" : "false") + "\"", art, title, - on ? (slot == 14 ? "Aktueller Sponsor" : "Aktueller Sender") : "Platz frei", on ? c.at("name").get() : std::string("Kein Vertrag"), on ? terms(c) : std::string("Anklicken für Angebote"), advertising_selected_ == slot); + on ? (slot == 14 ? "Aktueller Sponsor" : "Aktueller Sender") : "Platz frei", on ? c.at("name").get() : std::string("Kein Vertrag"), on ? terms(c) : std::string("Anklicken für Angebote"), advertising_selected_ == slot, "four"); } - out += tile("ad-soon", "ad-contract-naming", soon, "advertising.scene.arena", "Namensrecht Stadion", "Neu", "Noch nicht im Spiel", "Dieser Vertrag folgt", false, "wide") + - "
WerbungDer Mauszeiger auf einem Bild zeigt den aktuellen Vertrag. Ein Klick auf eine Bande, das Trikot oder die Kamera blättert durch die Angebote. Fanartikel, Öffentlichkeitsarbeit und Fanbetreuung stehen unter Investitionen." + - "
" + btn(engine_mode_ ? std::string("engine-open") : std::string("open:investments"), "Zu den Investitionen ›", "pg-btn", "id=\"ad-to-investments\" data-id=\"investments\"") + "
"; + out += tile("ad-soon", "ad-contract-naming", soon, "advertising.scene.arena", "Namensrecht Stadion", "Neu", "Noch nicht im Spiel", "Dieser Vertrag folgt", false, "four") + ""; } out += ""; if (advertising_selected_ < 0 || advertising_selected_ > 15) return out;