Advertising with a larger ground and three pictures of 4:3; a note on the investments
The ground with its boards takes the width of the page, shirt, television and the stadium's name stand beside it under one another, and the forecast is one line. The investments show how far each budget is used and a pencilled note of what the figures say. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
7bdf47d7fd
commit
e14b2f2374
2 files changed
+102
-42
No files matched your search
@@ -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;}
|
||||
@@ -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<bool, 14> &taken, int chosen) {
|
||||
const auto n = [](double v) { return scalar(std::round(v * 10) / 10); };
|
||||
std::string svg = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 762 620\"><defs><linearGradient id=\"lit\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"><stop offset=\"0\" stop-color=\"#fffaf0\"/><stop offset=\"1\" stop-color=\"#f1e6d0\"/></linearGradient></defs>";
|
||||
// apron and running track
|
||||
svg += "<rect x=\"66\" y=\"66\" width=\"630\" height=\"488\" rx=\"46\" fill=\"#d9c9a4\"/><rect x=\"74\" y=\"74\" width=\"614\" height=\"472\" rx=\"40\" fill=\"#c98a5e\"/>";
|
||||
for (int lane = 0; lane < 3; ++lane) svg += "<rect x=\"" + n(79 + lane * 5) + "\" y=\"" + n(79 + lane * 5) + "\" width=\"" + n(604 - lane * 10) + "\" height=\"" + n(462 - lane * 10) + "\" rx=\"" + n(36 - lane * 4) + "\" fill=\"none\" stroke=\"#f6e3d2\" stroke-opacity=\".55\" stroke-width=\".9\"/>";
|
||||
svg += "<rect x=\"96\" y=\"96\" width=\"570\" height=\"428\" rx=\"22\" fill=\"#8fb271\"/>";
|
||||
// the pitch: eleven mown stripes
|
||||
constexpr double px = 112, py = 110, pw = 538, ph = 400;
|
||||
for (int stripe = 0; stripe < 11; ++stripe)
|
||||
svg += "<rect x=\"" + n(px + stripe * pw / 11) + "\" y=\"" + n(py) + "\" width=\"" + n(pw / 11 + .4) + "\" height=\"" + n(ph) + "\" fill=\"" + (stripe % 2 ? "#a3c182" : "#b2cd92") + "\"/>";
|
||||
const double cx = px + pw / 2, cy = py + ph / 2;
|
||||
svg += "<g fill=\"none\" stroke=\"#fdfbf4\" stroke-width=\"2.2\" stroke-linejoin=\"round\"><rect x=\"" + n(px) + "\" y=\"" + n(py) + "\" width=\"" + n(pw) + "\" height=\"" + n(ph) + "\"/><path d=\"M" + n(cx) + " " + n(py) + "V" + n(py + ph) + "\"/><circle cx=\"" + n(cx) + "\" cy=\"" + n(cy) + "\" r=\"50\"/>";
|
||||
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 "<rect x=\"" + n(D + inset) + "\" y=\"" + n(D + inset) + "\" width=\"" + n(W - 2 * (D + inset)) + "\" height=\"" + n(H - 2 * (D + inset)) + "\" rx=\"" + n(radius) + "\" " + more + "/>";
|
||||
};
|
||||
std::string svg = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 " + n(W) + " " + n(H) + "\"><defs><linearGradient id=\"lit\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"><stop offset=\"0\" stop-color=\"#fffaf0\"/><stop offset=\"1\" stop-color=\"#f1e6d0\"/></linearGradient></defs>";
|
||||
// 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 += "<rect x=\"" + n(px + stripe * pw / stripes) + "\" y=\"" + n(py) + "\" width=\"" + n(pw / stripes + .4) + "\" height=\"" + n(ph) + "\" fill=\"" + (stripe % 2 ? "#a3c182" : "#b2cd92") + "\"/>";
|
||||
// lengths on the pitch in metres: it is 105 long
|
||||
const double m = pw / 105, cx = px + pw / 2, cy = py + ph / 2;
|
||||
svg += "<g fill=\"none\" stroke=\"#fdfbf4\" stroke-width=\"2.4\" stroke-linejoin=\"round\"><rect x=\"" + n(px) + "\" y=\"" + n(py) + "\" width=\"" + n(pw) + "\" height=\"" + n(ph) + "\"/><path d=\"M" + n(cx) + " " + n(py) + "V" + n(py + ph) + "\"/><circle cx=\"" + n(cx) + "\" cy=\"" + n(cy) + "\" r=\"" + n(9.15 * m) + "\"/>";
|
||||
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 += "<path d=\"M" + n(edge) + " " + n(cy - 110) + "h" + n(-side * 88) + "v220h" + n(side * 88) + "\"/><path d=\"M" + n(edge) + " " + n(cy - 50) + "h" + n(-side * 30) + "v100h" + n(side * 30) + "\"/>";
|
||||
svg += "<path d=\"M" + n(edge - side * 88) + " " + n(cy - 40) + "A50 50 0 0 " + (side < 0 ? "1" : "0") + " " + n(edge - side * 88) + " " + n(cy + 40) + "\"/>";
|
||||
svg += "<path d=\"M" + n(edge) + " " + n(cy - 20.16 * m) + "h" + n(-side * 16.5 * m) + "v" + n(40.32 * m) + "h" + n(side * 16.5 * m) + "\"/><path d=\"M" + n(edge) + " " + n(cy - 9.16 * m) + "h" + n(-side * 5.5 * m) + "v" + n(18.32 * m) + "h" + n(side * 5.5 * m) + "\"/>";
|
||||
svg += "<path d=\"M" + n(edge - side * 16.5 * m) + " " + n(cy - 7.3 * m) + "A" + n(9.15 * m) + " " + n(9.15 * m) + " 0 0 " + (side < 0 ? "1" : "0") + " " + n(edge - side * 16.5 * m) + " " + n(cy + 7.3 * m) + "\"/>";
|
||||
svg += "<path d=\"M" + n(edge) + " " + n(py + 9) + "A9 9 0 0 " + (side < 0 ? "0" : "1") + " " + n(edge - side * 9) + " " + n(py) + "\"/><path d=\"M" + n(edge) + " " + n(py + ph - 9) + "A9 9 0 0 " + (side < 0 ? "1" : "0") + " " + n(edge - side * 9) + " " + n(py + ph) + "\"/>";
|
||||
}
|
||||
svg += "</g><g fill=\"#fdfbf4\"><circle cx=\"" + n(cx) + "\" cy=\"" + n(cy) + "\" r=\"3\"/><circle cx=\"" + n(px + 60) + "\" cy=\"" + n(cy) + "\" r=\"2.6\"/><circle cx=\"" + n(px + pw - 60) + "\" cy=\"" + n(cy) + "\" r=\"2.6\"/></g>";
|
||||
svg += "</g><g fill=\"#fdfbf4\"><circle cx=\"" + n(cx) + "\" cy=\"" + n(cy) + "\" r=\"3.2\"/><circle cx=\"" + n(px + 11 * m) + "\" cy=\"" + n(cy) + "\" r=\"2.8\"/><circle cx=\"" + n(px + pw - 11 * m) + "\" cy=\"" + n(cy) + "\" r=\"2.8\"/></g>";
|
||||
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 += "<path d=\"M" + n(edge) + " " + n(cy - 20) + "H" + n(back) + "V" + n(cy + 20) + "H" + n(edge) + "\" fill=\"#ffffff\" fill-opacity=\".5\" stroke=\"#fdfbf4\" stroke-width=\"2\"/>";
|
||||
for (int k = 1; k < 5; ++k) svg += "<path d=\"M" + n(edge) + " " + n(cy - 20 + k * 8) + "H" + n(back) + "\" stroke=\"#fdfbf4\" stroke-opacity=\".7\" stroke-width=\".7\"/>";
|
||||
svg += "<path d=\"M" + n(edge) + " " + n(cy - half) + "H" + n(back) + "V" + n(cy + half) + "H" + n(edge) + "\" fill=\"#ffffff\" fill-opacity=\".5\" stroke=\"#fdfbf4\" stroke-width=\"2.2\"/>";
|
||||
for (int k = 1; k < 6; ++k) svg += "<path d=\"M" + n(edge) + " " + n(cy - half + k * half / 3) + "H" + n(back) + "\" stroke=\"#fdfbf4\" stroke-opacity=\".7\" stroke-width=\".7\"/>";
|
||||
svg += "<path d=\"M" + n(edge + side * 7) + " " + n(cy - half) + "V" + n(cy + half) + "\" stroke=\"#fdfbf4\" stroke-opacity=\".7\" stroke-width=\".7\"/>";
|
||||
for (const double flag_y : {py, py + ph})
|
||||
svg += "<path d=\"M" + n(edge) + " " + n(flag_y) + "v-9\" stroke=\"#3a332b\" stroke-width=\"1.2\"/><path d=\"M" + n(edge) + " " + n(flag_y - 9) + "l" + n(side * -7) + " 2.6l" + n(side * 7) + " 2.6z\" fill=\"#c8733c\"/>";
|
||||
svg += "<path d=\"M" + n(edge) + " " + n(flag_y) + "v-10\" stroke=\"#3a332b\" stroke-width=\"1.3\"/><path d=\"M" + n(edge) + " " + n(flag_y - 10) + "l" + n(side * -8) + " 3l" + n(side * 8) + " 3z\" fill=\"#c8733c\"/>";
|
||||
}
|
||||
// the two benches on the far side, with their roofs
|
||||
for (const double bench : {cx - 96, cx + 40})
|
||||
svg += "<rect x=\"" + n(bench) + "\" y=\"99\" width=\"56\" height=\"9\" rx=\"3\" fill=\"#f3ede0\" stroke=\"#3a332b\" stroke-opacity=\".5\" stroke-width=\".8\"/><rect x=\"" + n(bench + 3) + "\" y=\"101\" width=\"50\" height=\"3.5\" rx=\"1.5\" fill=\"#bfe0ea\"/>";
|
||||
// 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 += "<rect x=\"" + n(bench - 6) + "\" y=\"" + n(py - 4) + "\" width=\"84\" height=\"4\" fill=\"none\" stroke=\"#fdfbf4\" stroke-opacity=\".8\" stroke-width=\"1\" stroke-dasharray=\"4 3\"/>";
|
||||
svg += "<rect x=\"" + n(bench) + "\" y=\"" + n(py - 17) + "\" width=\"72\" height=\"11\" rx=\"3.5\" fill=\"#f3ede0\" stroke=\"#3a332b\" stroke-opacity=\".5\" stroke-width=\".8\"/><rect x=\"" + n(bench + 3) + "\" y=\"" + n(py - 15) + "\" width=\"66\" height=\"4.5\" rx=\"2\" fill=\"#bfe0ea\"/>";
|
||||
for (int seat = 0; seat < 8; ++seat) svg += "<circle cx=\"" + n(bench + 8 + seat * 8) + "\" cy=\"" + n(py - 8.6) + "\" r=\"1.5\" fill=\"#8c491a\" fill-opacity=\".6\"/>";
|
||||
}
|
||||
// the players' tunnel between the benches
|
||||
svg += "<rect x=\"" + n(cx - 13) + "\" y=\"" + n(D + 31) + "\" width=\"26\" height=\"" + n(py - D - 31) + "\" fill=\"#e6dcc6\" stroke=\"#3a332b\" stroke-opacity=\".35\" stroke-width=\".8\"/>";
|
||||
// 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<bool, 14> &taken, int chosen) {
|
||||
const double fx = b.x + 4, fy = b.y + 4, fw = b.w - 8, fh = b.h - 8;
|
||||
svg += "<rect x=\"" + n(fx + 2) + "\" y=\"" + n(fy + 3) + "\" width=\"" + n(fw) + "\" height=\"" + n(fh) + "\" rx=\"9\" fill=\"#2e2b25\" fill-opacity=\".16\"/>";
|
||||
if (b.turn == 0)
|
||||
for (const double foot : {fx + 14, fx + fw - 14}) svg += "<rect x=\"" + n(foot - 2) + "\" y=\"" + n(b.y < 100 ? fy + fh - 2 : fy - 5) + "\" width=\"4\" height=\"7\" fill=\"#6f6a60\"/>";
|
||||
for (const double foot : {fx + 16, fx + fw - 16}) svg += "<rect x=\"" + n(foot - 2) + "\" y=\"" + n(b.y < 100 ? fy + fh - 2 : fy - 5) + "\" width=\"4\" height=\"7\" fill=\"#6f6a60\"/>";
|
||||
else
|
||||
for (const double foot : {fy + 16, fy + fh - 16}) svg += "<rect x=\"" + n(b.turn > 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 += "<rect x=\"" + n(b.turn > 0 ? fx - 5 : fx + fw - 2) + "\" y=\"" + n(foot - 2) + "\" width=\"7\" height=\"4\" fill=\"#6f6a60\"/>";
|
||||
svg += "<rect x=\"" + n(fx) + "\" y=\"" + n(fy) + "\" width=\"" + n(fw) + "\" height=\"" + n(fh) + "\" rx=\"9\" fill=\"" + (on ? "url(#lit)" : "#e6eed6") + "\" stroke=\"" + (here ? "#8c491a" : on ? "#645c50" : "#7c8a66") + "\" stroke-width=\"" + (here ? "3.2" : "1.6") + "\"" +
|
||||
(on ? "" : " stroke-dasharray=\"6 4\"") + "/>";
|
||||
// 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, "<span class=\"ad-tile-art\">" + img(art, w, h, false, true, shape.empty() ? 1100 : 1600) + "</span><span class=\"ad-tile-over\"><span class=\"ad-tile-k\">" + esc(pg_upper(kicker)) + "</span><strong>" + esc(value) + "</strong><span class=\"ad-tile-d\">" + esc(detail) +
|
||||
"</span></span><span class=\"ad-tile-cap\"><span>" + esc(title) + "</span>" + (amount.empty() ? std::string() : "<strong>" + esc(amount) + "</strong>") + "</span>",
|
||||
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<const char *, 3> 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<int64_t>());
|
||||
out += "<div class=\"ad-tiles wide\">";
|
||||
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<std::string>(), i == 0 ? "Bestellung" : "Monatsbudget", amount,
|
||||
waiting ? "Die Lieferung läuft noch" : "Anklicken zum Ändern", false, "big", amount);
|
||||
rows += "<div class=\"pg-kv\"><span>" + esc(row.at("name").get<std::string>()) + "</span><strong>" + esc(amount) + (i == 0 ? "" : " / Monat") + "</strong></div>";
|
||||
// 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<int64_t>(), 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 += "<div class=\"ad-use\"><div class=\"pg-row\" style=\"justify-content:space-between;\"><span>" + esc(row.at("name").get<std::string>()) + "</span><span class=\"pg-mut\">" +
|
||||
esc(limit > 0 ? std::to_string(int(std::lround(share))) + " % von " + ad_cash(limit) : amount) + "</span></div>" + pg_bar(share, i == 0 ? "soft" : i == 1 ? "accent" : "sage") + "</div>";
|
||||
}
|
||||
out += tile("ad-soon", "ad-spending-international", soon, "investment.scene.international", "Internationale Vermarktung", "Neu", "Noch nicht im Spiel", "Diese Investition folgt", false, "big", "—") + "</div><div class=\"pg-col pg-grow\"><div class=\"pg-panel pg-col\" style=\"" +
|
||||
pg_css("gap:4px;") + "\">" + pg_kicker("Investitionen") + rows + "<div class=\"pg-kv\"><span>Internationale Vermarktung</span><strong class=\"pg-mut\">folgt</strong></div>" +
|
||||
(delivery.empty() ? std::string() : "<span class=\"pg-tag accent\" style=\"align-self:flex-start;margin-top:" + pg(6) + ";\">" + esc(delivery) + "</span>") + "</div><div class=\"pg-panel pg-col\" style=\"" + pg_css("gap:4px;") + "\">" + pg_kicker("Vereinsprognose / Monat") + "<div class=\"pg-kv\"><span>Einnahmen</span><strong>" + esc(ad_cash(view.at("income").get<int64_t>())) +
|
||||
"</strong></div><div class=\"pg-kv\"><span>Ausgaben</span><strong>" + esc(ad_cash(view.at("expenses").get<int64_t>())) + "</strong></div><div class=\"pg-kv\"><span>Saldo</span><strong class=\"" + (view.at("balance").get<int64_t>() >= 0 ? "ad-plus" : "ad-minus") + "\">" +
|
||||
esc((view.at("balance").get<int64_t>() > 0 ? "+ " : "") + ad_cash(view.at("balance").get<int64_t>())) + "</strong></div></div><span class=\"pg-sp\"></span><span class=\"pg-mut ad-help\">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.</span></div>";
|
||||
esc((view.at("balance").get<int64_t>() > 0 ? "+ " : "") + ad_cash(view.at("balance").get<int64_t>())) + "</strong></div></div>";
|
||||
// the note: only what the figures above say, in the manager's own hand
|
||||
const auto monthly = view.at("spending")[1].at("amount").get<int64_t>() + view.at("spending")[2].at("amount").get<int64_t>();
|
||||
const auto expenses = view.at("expenses").get<int64_t>(), merchandise = view.at("spending")[0].at("amount").get<int64_t>();
|
||||
std::vector<std::string> 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<int64_t>(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<int64_t>() < 0) lines.push_back("Achtung: Der Monat schließt im Minus.");
|
||||
lines.push_back("Ausland: kommt noch.");
|
||||
out += "<div class=\"pg-panel pg-col\" style=\"" + pg_css("gap:8px;") + "\">" + pg_kicker("Auslastung der Budgets") + use + "</div><span class=\"pg-sp\"></span><div class=\"ad-memo\"><span class=\"ad-memo-tape\"></span><strong>Merkzettel</strong>";
|
||||
for (const auto &line : lines) out += "<span>" + esc(line) + "</span>";
|
||||
out += "</div></div>";
|
||||
} else {
|
||||
out += "<div class=\"pg-col\" style=\"width:" + pg(ad_ground_w) + ";flex:none;\"><div class=\"ad-ground\" role=\"group\" aria-label=\"Vierzehn Werbebanden\">" +
|
||||
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 += "</div><div class=\"pg-panel ad-forecast\">" + forecast() + "</div></div><div class=\"ad-tiles\">";
|
||||
out += "</div><div class=\"ad-strip\">" + pg_kicker("Vereinsprognose / Monat");
|
||||
for (const auto &[label, key] : std::array<std::pair<const char *, const char *>, 3>{{{"Einnahmen", "income"}, {"Ausgaben", "expenses"}, {"Saldo", "balance"}}}) {
|
||||
const auto value = view.at(key).get<int64_t>();
|
||||
out += "<span class=\"ad-strip-item\"><span class=\"pg-mut\">" + std::string(label) + "</span><strong class=\"" + std::string(std::string(key) == "balance" ? (value >= 0 ? "ad-plus" : "ad-minus") : "") + "\">" +
|
||||
esc((std::string(key) == "balance" && value > 0 ? "+ " : "") + ad_cash(value)) + "</strong></span>";
|
||||
}
|
||||
out += "</div></div><div class=\"ad-tiles\">";
|
||||
for (const auto &[slot, art, title] : std::array<std::tuple<int, const char *, const char *>, 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>() : 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>() : 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") +
|
||||
"<div class=\"pg-panel ad-note wide\"><strong class=\"pg-h\" style=\"font-size:" + pg(18) + ";line-height:" + pg(23) + ";\">Werbung</strong><span class=\"pg-mut\">Der 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.</span>" +
|
||||
"<span class=\"pg-sp\"></span><div class=\"pg-row\" style=\"justify-content:flex-end;\">" + btn(engine_mode_ ? std::string("engine-open") : std::string("open:investments"), "<span>Zu den Investitionen ›</span>", "pg-btn", "id=\"ad-to-investments\" data-id=\"investments\"") + "</div></div></div>";
|
||||
out += tile("ad-soon", "ad-contract-naming", soon, "advertising.scene.arena", "Namensrecht Stadion", "Neu", "Noch nicht im Spiel", "Dieser Vertrag folgt", false, "four") + "</div>";
|
||||
}
|
||||
out += "</div></section>";
|
||||
if (advertising_selected_ < 0 || advertising_selected_ > 15) return out;
|
||||
|
||||
Reference in new issue
Block a user