diff --git a/assets/modern/art/advertising-arena.png b/assets/modern/art/advertising-arena.png new file mode 100644 index 0000000..bc15223 Binary files /dev/null and b/assets/modern/art/advertising-arena.png differ diff --git a/assets/modern/art/gui-assets.json b/assets/modern/art/gui-assets.json index 103afe8..b146c3a 100644 --- a/assets/modern/art/gui-assets.json +++ b/assets/modern/art/gui-assets.json @@ -141,6 +141,26 @@ 1, 1 ] + }, + "investment.scene.international": { + "file": "investment-international.png", + "sha256": "ec583de4f0ef923c77eadde9331a0139c2948bfbc4480e9945ab8ace2367f2de", + "crop": [ + 0, + 0, + 1, + 1 + ] + }, + "advertising.scene.arena": { + "file": "advertising-arena.png", + "sha256": "79575de80c3a28a2e1dba1153c551e195f31671281731aebbc7997229c1bde12", + "crop": [ + 0, + 0, + 1, + 1 + ] } } } diff --git a/assets/modern/art/investment-international.png b/assets/modern/art/investment-international.png new file mode 100644 index 0000000..922f41a Binary files /dev/null and b/assets/modern/art/investment-international.png differ diff --git a/assets/modern/pages.rcss b/assets/modern/pages.rcss index 2010116..4c5dc9b 100644 --- a/assets/modern/pages.rcss +++ b/assets/modern/pages.rcss @@ -736,3 +736,17 @@ body.midnight .cp-map-name,body.matchday .cp-map-name {color:#f0ece2;font-effect .ad-note {display:flex;flex-direction:column;flex:none;gap:14dp;width:519dp;height:528dp;padding:32dp 34dp;font-size:28dp;line-height:38dp;} .ad-note span {display:block;} .ad-mark {display:block;flex:none;border-radius:36dp;font-family:Display;text-align:center;color:#ffffff;} + +/* the larger pictures: a wide one for the third contract, big ones for the investments */ +.ad-tiles.wide {flex:none;width:1860dp;} +.ad-tile.wide,.ad-tile.wide:hover,.ad-tile.wide:focus,.ad-tile.wide:disabled {width:1056dp;} +.ad-tile.wide .ad-tile-art {width:1056dp;} +.ad-tile.wide .ad-tile-cap,.ad-tile.wide .ad-tile-over {width:1052dp;} +.ad-tile.big,.ad-tile.big:hover,.ad-tile.big:focus,.ad-tile.big:disabled {width:921dp;height:801dp;} +.ad-tile.big .ad-tile-art {width:921dp;height:690dp;} +.ad-tile.big .ad-tile-over {top:490dp;width:917dp;} +.ad-tile.big .ad-tile-cap {top:690dp;display:flex;align-items:center;justify-content:space-between;width:917dp;height:107dp;line-height:54dp;padding:0 40dp;font-size:43dp;} +.ad-tile-cap strong {display:block;font-family:Display;font-weight:normal;font-size:43dp;white-space:nowrap;color:var(--p-a8);} +.ad-tile:disabled,.ad-tile[disabled] {opacity:1;} +.ad-note.wide {width:1056dp;} +.ad-help {display:block;font-size:27dp;line-height:36dp;} diff --git a/src/modern/ui/advertising_screens.inc b/src/modern/ui/advertising_screens.inc index 2393ae4..303d6c1 100644 --- a/src/modern/ui/advertising_screens.inc +++ b/src/modern/ui/advertising_screens.inc @@ -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 = "
" + - 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(); - // the boards at the ends are read from the pitch: their writing stands upright - const std::string face = " 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()) + - "\">BANDE " + std::to_string(i + 1) + "" + esc(on ? name : "Platz frei") + ""; - 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 += "
" + 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 += "
"; - // 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, "" + img(art, 520, 459, false, true, 1100) + "" + esc(pg_upper(kicker)) + "" + esc(value) + "" + esc(detail) + - "" + esc(title) + "", - 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") + "
"; + for (const auto &[label, key] : std::array, 3>{{{"Einnahmen", "income"}, {"Ausgaben", "expenses"}, {"Saldo", "balance"}}}) { + const auto value = view.at(key).get(); + row += "
" + std::string(label) + "= 0 ? " ad-plus" : " ad-minus") : "") + "\">" + + esc((std::string(key) == "balance" && value > 0 ? "+ " : "") + ad_cash(value)) + "
"; + } + return row + "
"; }; - 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); - } - static constexpr std::array 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, "" + 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)) + "\""); + }; + // 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(), i == 0 ? "Bestellung" : "Monatsbudget", - ad_cash(row.at("amount").get()), 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 = "
"; + 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; + out += "
"; + 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()); + 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") + "
"; + } + 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.
"; + } 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); + 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(); + // the boards at the ends are read from the pitch: their writing stands upright + const std::string face = " 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()) + + "\">BANDE " + std::to_string(i + 1) + "" + esc(on ? name : "Platz frei") + ""; + 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 += "
" + forecast() + "
"; + 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); + } + 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 += "
Werbung und VereinsausgabenDer 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." + - (delivery.empty() ? std::string() : "" + esc(delivery) + "") + "
"; + out += ""; 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(); diff --git a/src/modern/ui/controls.inc b/src/modern/ui/controls.inc index 5b3b461..c012a19 100644 --- a/src/modern/ui/controls.inc +++ b/src/modern/ui/controls.inc @@ -702,6 +702,9 @@ void App::dispatch(const std::string &action, Rml::Element *target) { // the surroundings are the second page of the stadium const bool surroundings = route == "periphery"; if (surroundings) route = "stadium"; + // the investments are the second page of advertising + const bool investments = route == "investments"; + if (investments) route = "advertising"; if(source_&&!demo_career_menu_available(snap().state,route)){message(snap().state.at("career").value("ended",false)?"Diese Partie ist beendet. Bitte ein neues Spiel beginnen oder einen Spielstand laden.":"Dieses Vereinsmenü ist für die Nationalmannschaft nicht verfügbar.");return;} if (route == "kickoff") return; @@ -717,6 +720,7 @@ void App::dispatch(const std::string &action, Rml::Element *target) { return; } if (route == "bank") { bank_view_ = "entrance"; bank_hint_.clear(); } + if (route == "advertising") { advertising_page_ = investments ? "investments" : "advertising"; advertising_selected_ = -1; advertising_offer_ = 0; } if (route == "stadium") { if (!stadium_view_.is_object()) stadium_view_ = Json::object(); stadium_view_["view"] = surroundings ? "panorama" : "inside"; stadium_focus_.clear(); } menu_ = route; report_picker_.clear(); diff --git a/src/modern/ui/engine_controls.inc b/src/modern/ui/engine_controls.inc index bd83440..ab697d1 100644 --- a/src/modern/ui/engine_controls.inc +++ b/src/modern/ui/engine_controls.inc @@ -480,7 +480,7 @@ void App::engine_event(Rml::Event &event) { const auto price = engine_ticket_projection(engine_data_); ticket_->open(node, device_ratio_, price.at("min"), price.at("max")); dirty_ = true; } - else if (action == "engine-open" && (id == "environment" || id == "advertising")) { menu_ = id; advertising_selected_ = -1; advertising_offer_ = 0; refresh(); } + else if (action == "engine-open" && (id == "environment" || id == "advertising" || id == "investments")) { menu_ = id == "investments" ? "advertising" : id; advertising_page_ = id == "investments" ? "investments" : "advertising"; advertising_selected_ = -1; advertising_offer_ = 0; refresh(); } else if(action=="engine-open"&&id=="newplayer"){menu_=id;scene_="managerhub";career_resign_open_=career_game_end_=false;engine_manager_context_=engine_data_.at("desktop").at("meta");focus_after_render_="career-add";refresh();} else if(action=="engine-open"&&id=="settings"){reset_settings();menu_=id;refresh();} else if(action=="engine-open"&&id=="indoor"){menu_=id;engine_reports_sync();refresh();} diff --git a/src/modern/ui/notebook.inc b/src/modern/ui/notebook.inc index aa34479..73784c1 100644 --- a/src/modern/ui/notebook.inc +++ b/src/modern/ui/notebook.inc @@ -14,7 +14,7 @@ const std::vector ¬ebook_sections() { {"home", "Hauptseite", {}}, {"team", "Mannschaft", {"lineup", "tactics", "training", "camp", "strengths", "scorers"}}, {"transfers", "Transfers", {"transfer", "contracts"}}, - {"club", "Verein", {"stadium", "periphery", "environment", "advertising"}}, + {"club", "Verein", {"stadium", "periphery", "environment", "advertising", "investments"}}, {"finance", "Finanzen", {"balance", "bank", "toto"}}, {"fixtures", "Spielplan", {"calendar", "league", "tables", "other", "friendlies", "postpone", "indoor"}}, {"records", "Statistik", {"statistics", "stat-trend", "stat-winners", "stat-records", "stat-players", "achievements", "almanac", "fairplay", "highscore"}}, @@ -26,7 +26,7 @@ std::string notebook_page_label(const std::string &route) { static const std::map labels = { {"lineup", "Aufstellung"}, {"tactics", "Taktik"}, {"training", "Training"}, {"camp", "Trainingslager"}, {"strengths", "Stärken"}, {"scorers", "Spielerstatistik"}, {"transfer", "Transfermarkt"}, {"contracts", "Verträge"}, {"stadium", "Stadion"}, {"periphery", "Peripherie"}, {"environment", "Umfeld"}, - {"advertising", "Werbung"}, {"balance", "Bilanz"}, {"bank", "Bank"}, {"toto", "Toto"}, {"calendar", "Kalender"}, {"league", "Ligaspiele"}, + {"advertising", "Werbung"}, {"investments", "Investitionen"}, {"balance", "Bilanz"}, {"bank", "Bank"}, {"toto", "Toto"}, {"calendar", "Kalender"}, {"league", "Ligaspiele"}, {"tables", "Tabellen"}, {"other", "Übrige Spiele"}, {"friendlies", "Testspiele"}, {"postpone", "Verlegen"}, {"indoor", "Halle"}, {"statistics", "Analyse"}, {"stat-trend", "Verlauf"}, {"stat-winners", "Sieger"}, {"stat-records", "Rekorde"}, {"stat-players", "Spieler"}, {"achievements", "Erfolge"}, {"almanac", "Almanach"}, {"fairplay", "Fairplay"}, {"highscore", "Highscore"}, {"news", "Nachrichten"}, {"settings", "Einstellungen"}, {"save", "Speichern"}, {"load", "Laden"}, {"newplayer", "Manager"}}; @@ -203,7 +203,10 @@ std::string App::notebook_shell(const std::function & if (!engine_mode_ && std::string_view(r).starts_with("stat-")) continue; // the ground is one menu with two pages: the stadium and what stands around it const bool ground = std::string_view(r) == "stadium" || std::string_view(r) == "periphery"; + // so is advertising: the sponsors' contracts, and what the club invests itself + const bool commerce = std::string_view(r) == "advertising" || std::string_view(r) == "investments"; const bool here = ground ? menu_ == "stadium" && (stadium_view_.value("view", std::string("inside")) == "panorama") == (std::string_view(r) == "periphery") + : commerce ? menu_ == "advertising" && (advertising_page_ == "investments") == (std::string_view(r) == "investments") : part && engine_mode_ ? menu_ == "statistics" && statistics_page_ == r : notebook_menu() == r; if (here) { kicker = std::string(section.label) + " · " + std::to_string(n + 1) + " / " + std::to_string(section.routes.size()); @@ -213,7 +216,7 @@ std::string App::notebook_shell(const std::function & std::string("nb-sub") + (here ? " active" : ""), "id=\"page-" + std::string(r) + "\" aria-pressed=\"" + (here ? "true" : "false") + "\" style=\"transform:translateY(" + (here ? std::string("-13") : std::to_string(sub_rest[n % sub_rest.size()])) + "dp) rotate(" + scalar(sub_turns[n % sub_turns.size()]) + "deg);\"", - enabled(part ? "statistics" : ground ? "stadium" : r)); + enabled(part ? "statistics" : ground ? "stadium" : commerce ? "advertising" : r)); ++n; } } diff --git a/src/modern/ui/view.cpp b/src/modern/ui/view.cpp index 79ece93..bb55053 100644 --- a/src/modern/ui/view.cpp +++ b/src/modern/ui/view.cpp @@ -485,6 +485,7 @@ class App final : public Rml::EventListener { uint64_t contracts_revision_ = 0; std::shared_ptr contracts_world_; int advertising_selected_ = -1, advertising_offer_ = 0; + std::string advertising_page_ = "advertising"; // or "investments": the second page of the menu uint64_t advertising_revision_ = 0; std::shared_ptr advertising_world_; int toto_column_ = 0;