Investments as a page of their own, and the stadium's name as a third contract
Merchandise, press work and fan work move from advertising to a page of their own, with international marketing beside them; advertising gains the naming right of the stadium. The two new places are shown and say that the game does not know them yet. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
e912269a49
commit
7bdf47d7fd
9 files changed
+114
-45
No files matched your search
@@ -101,50 +101,77 @@ std::string App::render_advertising() {
|
||||
const auto terms = [&](const Json &slot) {
|
||||
return std::to_string(slot.value("months", 0)) + (slot.value("months", 0) == 1 ? " Monat" : " Monate") + " · " + ad_cash(slot.value("amount", int64_t(0))) + " / Monat";
|
||||
};
|
||||
std::string out = "<section class=\"pg-page\" id=\"ad-underlay\"><div class=\"pg-row pg-grow\" style=\"align-items:stretch;\"><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);
|
||||
for (int i = 0; i < 14; ++i) {
|
||||
const auto &c = slots[size_t(i)];
|
||||
const auto b = ad_board(i);
|
||||
const bool on = taken[size_t(i)];
|
||||
const auto name = c.at("name").get<std::string>();
|
||||
// the boards at the ends are read from the pitch: their writing stands upright
|
||||
const std::string face = "<span class=\"ad-board-face" + std::string(b.turn > 0 ? " right" : b.turn < 0 ? " left" : "") + "\" style=\"" + (b.turn ? "left:" + pg((b.w - b.h) / 2) + ";top:" + pg((b.h - b.w) / 2) + ";width:" + pg(b.h) + ";height:" + pg(b.w) + ";" : std::string()) +
|
||||
"\"><span class=\"ad-board-no\">BANDE " + std::to_string(i + 1) + "</span><strong class=\"" + (on ? "" : "free") + "\">" + esc(on ? name : "Platz frei") + "</strong></span>";
|
||||
out += btn("ad-contract", face, std::string("ad-board") + (on ? " on" : "") + (advertising_selected_ == i ? " selected" : ""),
|
||||
"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\">" + pg_kicker("Vereinsprognose / Monat") + "<div class=\"pg-row\" style=\"margin-top:" + pg(4) + ";\">";
|
||||
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 += "<div class=\"pg-grow\"><span class=\"pg-mut\" style=\"display:block;\">" + std::string(label) + "</span><strong class=\"pg-h" + std::string(std::string(key) == "balance" ? (value >= 0 ? " ad-plus" : " ad-minus") : "") + "\">" +
|
||||
esc((std::string(key) == "balance" && value > 0 ? "+ " : "") + ad_cash(value)) + "</strong></div>";
|
||||
}
|
||||
out += "</div></div></div><div class=\"ad-tiles\">";
|
||||
// the five pictures: the pointer shows what stands there, a click goes on
|
||||
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) {
|
||||
return btn(action, "<span class=\"ad-tile-art\">" + img(art, 520, 459, false, true, 1100) + "</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></span>",
|
||||
std::string("ad-tile") + (selected ? " selected" : ""), "id=\"" + id + "\" " + attrs + " aria-label=\"" + esc(title + ": " + value + (detail.empty() ? "" : ", " + detail)) + "\"");
|
||||
// The menu has two pages: the contracts with sponsors, and what the club invests itself.
|
||||
const bool investing = advertising_page_ == "investments";
|
||||
page_title_ = investing ? "Investitionen" : "Werbung";
|
||||
const auto forecast = [&] {
|
||||
std::string row = pg_kicker("Vereinsprognose / Monat") + "<div class=\"pg-row\" style=\"margin-top:" + pg(4) + ";\">";
|
||||
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>();
|
||||
row += "<div class=\"pg-grow\"><span class=\"pg-mut\" style=\"display:block;\">" + std::string(label) + "</span><strong class=\"pg-h" + std::string(std::string(key) == "balance" ? (value >= 0 ? " ad-plus" : " ad-minus") : "") + "\">" +
|
||||
esc((std::string(key) == "balance" && value > 0 ? "+ " : "") + ad_cash(value)) + "</strong></div>";
|
||||
}
|
||||
return row + "</div>";
|
||||
};
|
||||
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);
|
||||
}
|
||||
static constexpr std::array<const char *, 3> spending_art{"advertising.scene.merchandise", "advertising.scene.press", "advertising.scene.fans"};
|
||||
// A picture one can click: the pointer shows what stands there today. `shape` is "", "wide"
|
||||
// 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;
|
||||
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)) + "\"");
|
||||
};
|
||||
// what the game does not know yet is shown, and says so
|
||||
const std::string soon = "disabled=\"disabled\" aria-disabled=\"true\"";
|
||||
std::string delivery;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
const auto &row = view.at("spending")[size_t(i)];
|
||||
const int weeks = row.value("delivery_weeks", 0);
|
||||
if (i == 0 && weeks > 0) delivery = "Fanartikel: Die Lieferung läuft noch " + std::to_string(weeks) + (weeks == 1 ? " Woche." : " Wochen.");
|
||||
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",
|
||||
ad_cash(row.at("amount").get<int64_t>()), i == 0 && weeks > 0 ? "Lieferung läuft noch" : "Anklicken zum Ändern", false);
|
||||
if (const int weeks = view.at("spending")[0].value("delivery_weeks", 0); weeks > 0) delivery = "Fanartikel: Die Lieferung läuft noch " + std::to_string(weeks) + (weeks == 1 ? " Woche." : " Wochen.");
|
||||
std::string out = "<section class=\"pg-page\" id=\"ad-underlay\"><div class=\"pg-row pg-grow\" style=\"align-items:stretch;\">";
|
||||
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;
|
||||
out += "<div class=\"ad-tiles wide\">";
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
const auto &row = view.at("spending")[size_t(i)];
|
||||
const bool waiting = i == 0 && !delivery.empty();
|
||||
const auto amount = ad_cash(row.at("amount").get<int64_t>());
|
||||
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>";
|
||||
}
|
||||
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>";
|
||||
} 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);
|
||||
for (int i = 0; i < 14; ++i) {
|
||||
const auto &c = slots[size_t(i)];
|
||||
const auto b = ad_board(i);
|
||||
const bool on = taken[size_t(i)];
|
||||
const auto name = c.at("name").get<std::string>();
|
||||
// the boards at the ends are read from the pitch: their writing stands upright
|
||||
const std::string face = "<span class=\"ad-board-face" + std::string(b.turn > 0 ? " right" : b.turn < 0 ? " left" : "") + "\" style=\"" + (b.turn ? "left:" + pg((b.w - b.h) / 2) + ";top:" + pg((b.h - b.w) / 2) + ";width:" + pg(b.h) + ";height:" + pg(b.w) + ";" : std::string()) +
|
||||
"\"><span class=\"ad-board-no\">BANDE " + std::to_string(i + 1) + "</span><strong class=\"" + (on ? "" : "free") + "\">" + esc(on ? name : "Platz frei") + "</strong></span>";
|
||||
out += btn("ad-contract", face, std::string("ad-board") + (on ? " on" : "") + (advertising_selected_ == i ? " selected" : ""),
|
||||
"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\">";
|
||||
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);
|
||||
}
|
||||
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 += "<div class=\"pg-panel ad-note\"><strong class=\"pg-h\" style=\"font-size:" + pg(18) + ";line-height:" + pg(23) + ";\">Werbung und Vereinsausgaben</strong><span class=\"pg-mut\">Der Mauszeiger auf einem Bild zeigt den aktuellen Stand. Ein Klick auf eine Bande, das Trikot oder die Kamera blättert durch die Angebote; die drei Ausgaben öffnen das Zahlenfeld.</span>" +
|
||||
(delivery.empty() ? std::string() : "<span class=\"pg-tag accent\" style=\"align-self:flex-start;\">" + esc(delivery) + "</span>") + "</div></div></div></section>";
|
||||
out += "</div></section>";
|
||||
if (advertising_selected_ < 0 || advertising_selected_ > 15) return out;
|
||||
// the offers for the chosen place, as a note
|
||||
const auto &choices = engine_mode_ ? slots[size_t(advertising_selected_)].at("choices") : Json::array();
|
||||
|
||||
Reference in new issue
Block a user