The manager as a page of the notebook: one picture with three scenes
The scene under the pointer is framed and lit, the others step back, and under the picture stands what the scene does. The picture is the project's own; the page is left by any other marker of the book. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
6020fbc30a
commit
592bc28e9c
12 files changed
+128
-142
No files matched your search
@@ -81,6 +81,16 @@
|
|||||||
0.8634,
|
0.8634,
|
||||||
0.4676
|
0.4676
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"manager.scenes": {
|
||||||
|
"file": "manager-scenes.png",
|
||||||
|
"sha256": "28743ba22d440fda3e186ad6e15061afdcf1a1c3b26e077cfd62a470a4f86857",
|
||||||
|
"crop": [
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
1
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.5 MiB |
@@ -1,37 +1,2 @@
|
|||||||
/* SPDX-License-Identifier: GPL-3.0-only */
|
/* SPDX-License-Identifier: GPL-3.0-only */
|
||||||
.career-hub {position:absolute;left:0;right:0;top:0;bottom:0;}
|
/* The manager is a page of the notebook now: its styles are the mg-* rules in pages.rcss. */
|
||||||
.career-hub>header {position:absolute;left:0;right:0;top:0;height:150dp;display:flex;align-items:center;justify-content:space-between;gap:30dp;}
|
|
||||||
.career-hub h2 {font-size:44dp;margin:0 0 12dp;}
|
|
||||||
.career-hub header p {font-size:28dp;color:var(--muted);margin:0;}
|
|
||||||
.career-hub header nav {display:flex;gap:14dp;}
|
|
||||||
.career-hub header nav button {min-width:210dp;height:76dp;font-size:28dp;}
|
|
||||||
.career-cards {position:absolute;left:0;right:0;top:176dp;bottom:216dp;}
|
|
||||||
.career-card {position:absolute;top:0;width:1292dp;height:723dp;border:3dp var(--border);border-radius:24dp;overflow:hidden;padding:0;background-color:var(--panel);}
|
|
||||||
.career-card>.image-frame {position:absolute;left:0;right:0;top:0;bottom:0;}
|
|
||||||
.career-resign {left:0;}.career-search {right:0;}.career-add {left:0;right:0;top:749dp;width:2612dp;}
|
|
||||||
.career-caption {position:absolute;left:0;right:0;bottom:0;padding:50dp 34dp 28dp;background-color:#0c1723ed;display:flex;align-items:baseline;justify-content:space-between;gap:24dp;color:#f7f9fc;}
|
|
||||||
.career-caption strong {font-size:40dp;}.career-caption small {font-size:28dp;color:#d1dfe9;}
|
|
||||||
.career-hub>footer {position:absolute;left:0;right:0;bottom:0;height:190dp;display:flex;align-items:center;justify-content:space-between;gap:30dp;}
|
|
||||||
.career-hub footer section>span {display:block;font-size:28dp;color:var(--muted);margin-bottom:14dp;}
|
|
||||||
.career-hub footer section>div {display:flex;gap:16dp;}
|
|
||||||
.career-hub footer button {height:82dp;font-size:28dp;min-width:230dp;}
|
|
||||||
.career-hub .selected {background-color:var(--selected);border-color:var(--accent);color:var(--accent);}
|
|
||||||
.career-dialog label {display:block;font-size:32dp;margin-bottom:20dp;}
|
|
||||||
.career-dialog select {width:100%;height:100dp;font-size:32dp;}
|
|
||||||
.career-dialog p {font-size:32dp;line-height:1.5;margin:28dp 0;}
|
|
||||||
|
|
||||||
.career-hub h2,.career-caption strong {font-weight:bold;}
|
|
||||||
.career-hub header nav {max-width:64%;flex-wrap:wrap;}
|
|
||||||
|
|
||||||
/* QA CSS candidate: Gold full-width career confirmation. */
|
|
||||||
.career-dialog {width:2484dp;}
|
|
||||||
.career-dialog>h2 {width:100%;text-align:center;}
|
|
||||||
|
|
||||||
#career-dialog-layer {left:0;right:0;top:0;bottom:0;padding:0;}
|
|
||||||
.career-dialog {display:flex;flex-direction:column;}
|
|
||||||
.career-dialog>h2 {height:48dp;line-height:48dp;margin:0 0 35dp;flex-shrink:0;}
|
|
||||||
.career-dialog>label {height:37dp;line-height:37dp;margin:0 0 26dp;flex-shrink:0;}
|
|
||||||
.career-dialog>select {height:82dp;flex-shrink:0;margin:0;}
|
|
||||||
.career-dialog>p:nth-child(4) {height:48dp;line-height:48dp;margin:58dp 0 32dp;flex-shrink:0;}
|
|
||||||
.career-dialog>footer {height:65dp;flex-shrink:0;margin:45dp 0 0;}
|
|
||||||
.career-dialog>footer button {height:65dp;padding:12dp 24dp;line-height:37dp;}
|
|
||||||
@@ -690,3 +690,18 @@ body.midnight .cp-map-name,body.matchday .cp-map-name {color:#f0ece2;font-effect
|
|||||||
.pg-root .cp-range:disabled sliderbar {background-color:var(--p-s6);}
|
.pg-root .cp-range:disabled sliderbar {background-color:var(--p-s6);}
|
||||||
.pg-root .pg-btn.cp-book {width:100%;height:86dp;font-size:36dp;}
|
.pg-root .pg-btn.cp-book {width:100%;height:86dp;font-size:36dp;}
|
||||||
.cp-note {display:block;text-align:center;font-size:28dp;line-height:36dp;}
|
.cp-note {display:block;text-align:center;font-size:28dp;line-height:36dp;}
|
||||||
|
|
||||||
|
/* --- manager: one picture with three scenes, and under it what the scene under the pointer does --- */
|
||||||
|
.mg-stage {display:flex;flex:1;min-height:0;align-items:center;justify-content:center;}
|
||||||
|
.mg-frame {position:relative;display:block;flex:none;overflow:hidden;clip:always;border-radius:40dp;}
|
||||||
|
.mg-art {position:absolute;left:0;top:0;display:block;}
|
||||||
|
.mg-hot,.mg-hot:disabled,.mg-hot:focus {position:absolute;display:block;padding:0;margin:0;border:9dp transparent;border-radius:0dp;background-color:transparent;decorator:none;opacity:1;transition:background-color border-color 0.12s;}
|
||||||
|
.mg-hot.dim,.mg-hot.dim:disabled {background-color:#2e2b2559;}
|
||||||
|
.mg-hot:hover,.mg-hot:disabled:hover,.mg-hot:focus-visible {border-color:#f6ecd8;background-color:#ffffff24;}
|
||||||
|
.mg-foot {flex:none;height:81dp;gap:14dp;}
|
||||||
|
.mg-side {display:flex;flex:1;min-width:0;gap:11dp;}
|
||||||
|
.mg-side.right {justify-content:flex-end;}
|
||||||
|
.mg-hint {flex:none;max-width:2300dp;height:81dp;line-height:81dp;padding:0 40dp;border-radius:41dp;font-size:34dp;text-align:center;}
|
||||||
|
.mg-hint strong {font-family:Display;font-weight:normal;font-size:36dp;margin-right:12dp;}
|
||||||
|
.mg-owner label {display:block;}
|
||||||
|
.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);}
|
||||||
@@ -107,8 +107,27 @@ bool App::career_event(Rml::Event &event) {
|
|||||||
event.StopImmediatePropagation();
|
event.StopImmediatePropagation();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!career_resign_open_ && !career_game_end_)
|
if (!career_resign_open_ && !career_game_end_) {
|
||||||
|
// what the scene under the pointer (or the one that has the focus) does
|
||||||
|
if (type == "mousemove" || type == "focus" || type == "blur") {
|
||||||
|
std::string scene;
|
||||||
|
if (type != "blur")
|
||||||
|
for (auto *n = event.GetTargetElement(); n && n != doc_; n = n->GetParentNode())
|
||||||
|
if (n->HasAttribute("data-hint")) { scene = n->GetAttribute<Rml::String>("data-hint", ""); break; }
|
||||||
|
if (scene != career_hint_) {
|
||||||
|
career_hint_ = scene;
|
||||||
|
// the scenes the pointer is not on step back
|
||||||
|
for (const auto &other : career_scenes)
|
||||||
|
if (auto *zone = element(other.action)) zone->SetClass("dim", !scene.empty() && scene != other.action);
|
||||||
|
if (auto *hint = element("career-hint")) {
|
||||||
|
hint->SetInnerRML(career_hint_markup(scene));
|
||||||
|
hint->SetProperty("visibility", scene.empty() ? "hidden" : "visible");
|
||||||
|
}
|
||||||
|
dirty_ = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
auto *target = event.GetTargetElement();
|
auto *target = event.GetTargetElement();
|
||||||
bool inside = false;
|
bool inside = false;
|
||||||
for (auto *n = target; n && n != doc_; n = n->GetParentNode())
|
for (auto *n = target; n && n != doc_; n = n->GetParentNode())
|
||||||
|
|||||||
@@ -1,110 +1,74 @@
|
|||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
namespace {
|
||||||
|
// The three scenes of the manager's picture: which action each one is, its name, what it
|
||||||
|
// does, and where it lies on the picture (left, top, width, height in percent).
|
||||||
|
struct CareerScene { const char *action, *title, *text; double left, top, width, height; };
|
||||||
|
constexpr std::array<CareerScene, 3> career_scenes{{
|
||||||
|
{"career-resign", "Aufhören", "Dein Amt abgeben. Der Verein wird danach vom Computer geführt.", 0, 0, 49.3, 52.3},
|
||||||
|
{"career-search", "Vereinssuche", "Bei einem anderen Verein anheuern – noch nicht verfügbar.", 50.1, 0, 49.9, 52.3},
|
||||||
|
{"career-add", "Neuer Spieler", "Einen weiteren menschlichen Mitspieler einrichten: Name, Land, Liga und Verein.", 0, 53.2, 100, 46.8}}};
|
||||||
|
std::string career_hint_markup(const std::string &action) {
|
||||||
|
for (const auto &scene : career_scenes)
|
||||||
|
if (action == scene.action) return "<strong>" + esc(scene.title) + "</strong><span>· " + esc(scene.text) + "</span>";
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
} // namespace
|
||||||
|
// Optionen > Manager: one picture with three scenes. The pointer lights the scene it is on and
|
||||||
|
// darkens the others; under the picture stands what the scene does.
|
||||||
std::string App::render_career() {
|
std::string App::render_career() {
|
||||||
const auto c = engine_mode_?engine_career_context():demo_career_context(snap().state,*snap().world);
|
const auto c = engine_mode_?engine_career_context():demo_career_context(snap().state,*snap().world);
|
||||||
const bool ended = c.at("ended");
|
const bool ended = c.at("ended");
|
||||||
const Json m = engine_mode_?engine_manager_value_.at("active"):manager(snap());
|
const Json m = engine_mode_?engine_manager_value_.at("active"):manager(snap());
|
||||||
std::string body =
|
page_title_ = ended ? "Karriere beendet" : "Manager";
|
||||||
"<section class=\"career-hub\"><header><div><h2>" +
|
page_hint_ = m.value("name", "") + " · " + c.at("current_team").value("name", "") + " · " + (c.at("role") == "national" ? "Nationalmannschaft" : "Vereinsmanager");
|
||||||
esc(ended ? "Karriere beendet" : m.value("name", "")) + "</h2><p>" +
|
const auto off = [&](const std::string &action) {
|
||||||
esc(c.at("current_team").value("name", "")) + " · " +
|
if (action == "career-search") return true;
|
||||||
(c.at("role") == "national" ? "Nationalmannschaft" : "Vereinsmanager") +
|
if (action == "career-resign") return ended || (engine_mode_ && engine_manager_value_.at("can_resign") != true);
|
||||||
"</p></div><nav aria-label=\"Aktiver Manager\">";
|
return ended || (engine_mode_ && engine_manager_value_.at("can_join") != true);
|
||||||
for (const auto &person : c.at("active_managers"))
|
|
||||||
body += btn(
|
|
||||||
"career-manager", esc(person.value("name", "")),
|
|
||||||
person.value("portrait", 0) == m.value("portrait", 0) ? "selected" : "",
|
|
||||||
"id=\"career-manager-" + std::to_string(person.value("portrait", 0)) +
|
|
||||||
"\" data-id=\"" + std::to_string(person.value("portrait", 0)) +
|
|
||||||
"\" " + (engine_mode_?"disabled ":"") + "aria-pressed=\"" +
|
|
||||||
(person.value("portrait", 0) == m.value("portrait", 0) ? "true"
|
|
||||||
: "false") +
|
|
||||||
"\"");
|
|
||||||
body += "</nav></header><div class=\"career-cards\">";
|
|
||||||
const auto card = [&](const std::string &action, const std::string &key,
|
|
||||||
const std::string &title, const std::string ¬e,
|
|
||||||
const std::string &css, bool disabled) {
|
|
||||||
return btn(
|
|
||||||
action,
|
|
||||||
img(key, css == "career-add" ? 2612 : 1292, 724, false, false, 1600) +
|
|
||||||
"<span class=\"career-caption\"><strong>" + title +
|
|
||||||
"</strong><small>" + note + "</small></span>",
|
|
||||||
"career-card " + css,
|
|
||||||
"id=\"" + action + "\" " + (disabled ? "disabled" : ""));
|
|
||||||
};
|
};
|
||||||
body += card("career-resign", "manager.resign", "Aufgeben",
|
// 1448 x 1086 on the page: as tall as the page allows
|
||||||
engine_mode_&&engine_manager_value_.at("can_resign")!=true?"Mehrspieler folgt":"Dein Amt abgeben", "career-resign", ended||(engine_mode_&&engine_manager_value_.at("can_resign")!=true)) +
|
constexpr double frame_h = 1485, frame_w = frame_h * 1448 / 1086;
|
||||||
card("career-search", "manager.search", "Vereinssuche", "Später",
|
std::string body = "<section class=\"pg-page mg-page\"><div class=\"mg-stage\"><div class=\"mg-frame\" style=\"width:" + scalar(frame_w) + "dp;height:" + scalar(frame_h) + "dp;\"><div class=\"mg-art\">" +
|
||||||
"career-search", true) +
|
img("manager.scenes", frame_w, frame_h, false, false, 2048) + "</div>";
|
||||||
card("career-add", "manager.add", "Neuer Spieler",
|
for (const auto &scene : career_scenes)
|
||||||
"Weiteren Menschen einrichten", "career-add", ended||(engine_mode_&&engine_manager_value_.at("can_join")!=true)) +
|
body += "<button data-action=\"" + std::string(scene.action) + "\" class=\"mg-hot" + std::string(!career_hint_.empty() && career_hint_ != scene.action ? " dim" : "") + "\" id=\"" + scene.action + "\" data-hint=\"" + scene.action + "\" aria-label=\"" + esc(std::string(scene.title) + ": " + scene.text) + "\" " +
|
||||||
"</div><footer><section><span>Dein Aufgabenbereich</span><div>";
|
(off(scene.action) ? "disabled=\"disabled\" aria-disabled=\"true\" " : "") + "style=\"left:" + scalar(scene.left) + "%;top:" + scalar(scene.top) + "%;width:" + scalar(scene.width) + "%;height:" + scalar(scene.height) + "%;\"></button>";
|
||||||
for (const auto &role : c.at("available_roles")) {
|
const auto hint = career_hint_markup(career_hint_);
|
||||||
const auto id = role.get<std::string>();
|
body += "</div></div><div class=\"pg-row mg-foot\">";
|
||||||
body += btn("career-role", id == "club" ? "Verein" : "Nationalmannschaft",
|
// the demo lets one change who plays, as what, and on which ground the line-up is shown
|
||||||
c.at("role") == role ? "selected" : "",
|
std::string people, tasks;
|
||||||
"id=\"career-role-" + id + "\" data-id=\"" + id +
|
if (!engine_mode_) {
|
||||||
"\" aria-pressed=\"" +
|
for (const auto &person : c.at("active_managers")) {
|
||||||
(c.at("role") == role ? "true" : "false") + "\" " +
|
const bool on = person.value("portrait", 0) == m.value("portrait", 0);
|
||||||
(ended||engine_mode_ ? "disabled" : ""));
|
people += pg_button("career-manager", esc(person.value("name", "")), on ? "on" : "", "id=\"career-manager-" + std::to_string(person.value("portrait", 0)) + "\" data-id=\"" + std::to_string(person.value("portrait", 0)) + "\" aria-pressed=\"" + (on ? "true" : "false") + "\"");
|
||||||
|
}
|
||||||
|
for (const auto &role : c.at("available_roles")) {
|
||||||
|
const auto id = role.get<std::string>();
|
||||||
|
tasks += pg_button("career-role", id == "club" ? "Verein" : "Nationalmannschaft", c.at("role") == role ? "on" : "", "id=\"career-role-" + id + "\" data-id=\"" + id + "\" aria-pressed=\"" + (c.at("role") == role ? "true" : "false") + "\" " + (ended ? "disabled=\"disabled\"" : ""));
|
||||||
|
}
|
||||||
|
for (const auto *surface : {"outdoor", "indoor"})
|
||||||
|
tasks += pg_button("career-surface", std::string(surface) == "indoor" ? "Halle" : "Rasen", c.at("surface") == surface ? "on" : "", "id=\"career-surface-" + std::string(surface) + "\" data-id=\"" + surface + "\" aria-pressed=\"" +
|
||||||
|
(c.at("surface") == surface ? "true" : "false") + "\" " + (ended || (std::string(surface) == "indoor" && c.at("role") == "national") ? "disabled=\"disabled\"" : ""));
|
||||||
}
|
}
|
||||||
body += "</div></section><section><span>Aufstellung · Vorschau</span><div>";
|
body += "<div class=\"mg-side\">" + people + "</div><div class=\"pg-status mg-hint\" id=\"career-hint\" role=\"status\" style=\"visibility:" + std::string(hint.empty() ? "hidden" : "visible") + ";\">" + hint +
|
||||||
for (const auto *surface : {"outdoor", "indoor"}) {
|
"</div><div class=\"mg-side right\">" + tasks + "</div></div></section>";
|
||||||
if(engine_mode_&&c.at("surface")!=surface)continue;
|
|
||||||
body += btn("career-surface",
|
|
||||||
std::string(surface) == "indoor" ? (engine_mode_?"Halle · Wechselpaare":"Halle · 6 Spieler")
|
|
||||||
: "Rasen · 11 Spieler",
|
|
||||||
c.at("surface") == surface ? "selected" : "",
|
|
||||||
"id=\"career-surface-" + std::string(surface) +
|
|
||||||
"\" data-id=\"" + surface + "\" aria-pressed=\"" +
|
|
||||||
(c.at("surface") == surface ? "true" : "false") + "\" " +
|
|
||||||
(ended || engine_mode_ || (std::string(surface) == "indoor" &&
|
|
||||||
c.at("role") == "national")
|
|
||||||
? "disabled"
|
|
||||||
: ""));
|
|
||||||
}
|
|
||||||
body += "</div></section></footer></section>";
|
|
||||||
if (career_resign_open_ || career_game_end_) {
|
if (career_resign_open_ || career_game_end_) {
|
||||||
body = "<div id=\"career-underlay\" aria-hidden=\"true\">" + body +
|
body = "<div id=\"career-underlay\" aria-hidden=\"true\">" + body + "</div><div id=\"career-dialog-layer\" class=\"pg-ov\"><section class=\"pg-dlg\" role=\"dialog\" aria-modal=\"true\" style=\"width:" + pg(480) + ";\"><div><h2>" +
|
||||||
"</div><div id=\"career-dialog-layer\" "
|
std::string(career_game_end_ ? "Spiel beendet" : "Aufhören?") + "</h2></div>";
|
||||||
"class=\"entry-dialog-layer\"><section class=\"entry-dialog "
|
|
||||||
"career-dialog\" role=\"dialog\" aria-modal=\"true\"><h2>" +
|
|
||||||
std::string(career_game_end_ ? "Spiel beendet"
|
|
||||||
: "Manageramt aufgeben?") +
|
|
||||||
"</h2>";
|
|
||||||
if (career_game_end_)
|
if (career_game_end_)
|
||||||
body += "<p>Der letzte menschliche Mitspieler hat sein Amt abgegeben. "
|
body += "<p>Es ist kein menschlicher Manager mehr im Amt.</p><nav class=\"pg-dlg-act\">" + pg_button("career-game-end", "Zum Hauptmenü", "primary", "id=\"career-game-end\"") + "</nav>";
|
||||||
"Zurück zum Hauptmenü.</p><footer>" +
|
|
||||||
btn("career-game-end", "Zum Hauptmenü", {},
|
|
||||||
"id=\"career-game-end\"") +
|
|
||||||
"</footer>";
|
|
||||||
else {
|
else {
|
||||||
std::vector<std::pair<std::string, std::string>> people;
|
std::vector<std::pair<std::string, std::string>> people_rows;
|
||||||
for (const auto &person : c.at("active_managers")) {
|
for (const auto &person : c.at("active_managers")) {
|
||||||
const auto *club = world_->find("clubs", person.value("club", ""));
|
const auto *club = world_->find("clubs", person.value("club", ""));
|
||||||
people.emplace_back(
|
people_rows.emplace_back(std::to_string(person.value("portrait", 0)),
|
||||||
std::to_string(person.value("portrait", 0)),
|
person.value("name", "") + " · " + ((engine_mode_ ? c.at("role") != "national" : snap().state.at("edits").at("setup").value("league", true)) ? (club ? world_->name(*club) : "") : "Deutschland"));
|
||||||
person.value("name", "") + " · " +
|
|
||||||
((engine_mode_?c.at("role")!="national":snap().state.at("edits").at("setup").value("league", true))
|
|
||||||
? (club ? world_->name(*club) : "")
|
|
||||||
: "Deutschland"));
|
|
||||||
}
|
}
|
||||||
body +=
|
body += "<div class=\"pg-row mg-owner\" style=\"justify-content:space-between;\"><label for=\"career-resign-owner\">Wer gibt sein Amt ab?</label>" + select("career-resign-owner", people_rows, std::to_string(career_resign_portrait_), "career-resign-owner") +
|
||||||
"<label for=\"career-resign-owner\">Wer gibt sein Amt ab?</label>" +
|
"</div><span class=\"pg-mut\" style=\"display:block;\">" +
|
||||||
select("career-resign-owner", people,
|
(people_rows.size() == 1 ? "Der Verein wird danach vom Computer geführt. Du bist der letzte menschliche Manager: Mit deiner Bestätigung ist das Spiel beendet."
|
||||||
std::to_string(career_resign_portrait_),
|
: "Der Verein wird danach vom Computer geführt. Die anderen spielen weiter.") +
|
||||||
"career-resign-owner") +
|
"</span><nav class=\"pg-dlg-act\">" + pg_button("career-resign-cancel", "Abbrechen", "", "id=\"career-resign-cancel\"") + pg_button("career-resign-confirm", "Aufhören", "primary", "id=\"career-resign-confirm\"") + "</nav>";
|
||||||
"<p>" +
|
|
||||||
(people.size() == 1
|
|
||||||
? "Du bist der letzte menschliche Mitspieler. Mit deiner "
|
|
||||||
"Bestätigung endet diese Partie."
|
|
||||||
: "Die anderen Menschen spielen weiter. Die KI übernimmt den "
|
|
||||||
"abgegebenen Verein in dieser Karrierevorschau.") +
|
|
||||||
"</p><footer>" +
|
|
||||||
btn("career-resign-cancel", "Abbrechen", {},
|
|
||||||
"id=\"career-resign-cancel\"") +
|
|
||||||
btn("career-resign-confirm", "Amt aufgeben", {},
|
|
||||||
"id=\"career-resign-confirm\"") +
|
|
||||||
"</footer>";
|
|
||||||
}
|
}
|
||||||
body += "</section></div>";
|
body += "</section></div>";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -479,6 +479,8 @@ void App::dispatch(const std::string &action, Rml::Element *target) {
|
|||||||
if (live_action(action, target)) return;
|
if (live_action(action, target)) return;
|
||||||
if(national_action(action,target))return;
|
if(national_action(action,target))return;
|
||||||
if (career_action(action,target)) return;
|
if (career_action(action,target)) return;
|
||||||
|
// the manager's page is left by any other control of the notebook
|
||||||
|
if (scene_ == "managerhub" && !career_resign_open_ && !career_game_end_ && !action.starts_with("career-")) scene_ = "desktop";
|
||||||
if (entry_action(action, target)) return;
|
if (entry_action(action, target)) return;
|
||||||
if (opening_action(action, target)) return;
|
if (opening_action(action, target)) return;
|
||||||
if (settings_action(action,target)) return;
|
if (settings_action(action,target)) return;
|
||||||
|
|||||||
@@ -297,6 +297,13 @@ void App::engine_event(Rml::Event &event) {
|
|||||||
if (node->GetId() == "native-ticket-layer") return; // owned by the compact control
|
if (node->GetId() == "native-ticket-layer") return; // owned by the compact control
|
||||||
if (ticket_ && ticket_->is_open()) return;
|
if (ticket_ && ticket_->is_open()) return;
|
||||||
if (amount_event(event)) return;
|
if (amount_event(event)) return;
|
||||||
|
// the manager's page is left by any other control of the notebook
|
||||||
|
if(menu_=="newplayer"&&scene_=="managerhub"&&popup_.empty()&&type=="click"&&!engine_busy_&&!career_resign_open_&&!career_game_end_&&engine_manager_value_.is_object()&&engine_manager_value_.value("ended",false)!=true)
|
||||||
|
for(auto *n=target;n&&n!=doc_;n=n->GetParentNode())if(n->HasAttribute("data-action")&&!n->HasAttribute("disabled")) {
|
||||||
|
const auto action=n->GetAttribute<Rml::String>("data-action","");
|
||||||
|
if(!action.starts_with("career-")&&action!="close"){scene_="engine";menu_.clear();}
|
||||||
|
break;
|
||||||
|
}
|
||||||
if(menu_=="newplayer"&&popup_.empty()) {
|
if(menu_=="newplayer"&&popup_.empty()) {
|
||||||
if(engine_busy_){event.StopImmediatePropagation();return;}
|
if(engine_busy_){event.StopImmediatePropagation();return;}
|
||||||
if(scene_=="manager") {
|
if(scene_=="manager") {
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ void App::engine_render() {
|
|||||||
if(menu_=="scorers")out+="<div class=\"fill menu-layer\" style=\"z-index:100;\">"+window("Spielerstatistiken",engine_rankings_value_.is_object()?render_scorers():"<div class=\"fill center\">"+esc(engine_busy_?"Spielerstatistiken werden geladen …":engine_notice_)+"</div>")+"</div>";
|
if(menu_=="scorers")out+="<div class=\"fill menu-layer\" style=\"z-index:100;\">"+window("Spielerstatistiken",engine_rankings_value_.is_object()?render_scorers():"<div class=\"fill center\">"+esc(engine_busy_?"Spielerstatistiken werden geladen …":engine_notice_)+"</div>")+"</div>";
|
||||||
if(menu_=="fairplay")out+="<div class=\"fill menu-layer\" style=\"z-index:100;\">"+window("Fairplay",engine_fairplay_value_.is_object()?render_fairplay():"<div class=\"fill center\">"+esc(engine_busy_?"Fairplay wird geladen …":engine_notice_)+"</div>")+"</div>";
|
if(menu_=="fairplay")out+="<div class=\"fill menu-layer\" style=\"z-index:100;\">"+window("Fairplay",engine_fairplay_value_.is_object()?render_fairplay():"<div class=\"fill center\">"+esc(engine_busy_?"Fairplay wird geladen …":engine_notice_)+"</div>")+"</div>";
|
||||||
if(menu_=="other")out+="<div class=\"fill menu-layer\" style=\"z-index:100;\">"+window("Übrige Spiele",engine_other_value_.is_object()?render_reports("other"):"<div class=\"fill center\">"+esc(engine_busy_?"Wettbewerbe werden geladen …":engine_other_index_.is_object()?"Keine aktiven Wettbewerbe.":engine_notice_)+"</div>")+"</div>";
|
if(menu_=="other")out+="<div class=\"fill menu-layer\" style=\"z-index:100;\">"+window("Übrige Spiele",engine_other_value_.is_object()?render_reports("other"):"<div class=\"fill center\">"+esc(engine_busy_?"Wettbewerbe werden geladen …":engine_other_index_.is_object()?"Keine aktiven Wettbewerbe.":engine_notice_)+"</div>")+"</div>";
|
||||||
if(menu_=="newplayer")out+="<div class=\"fill\" style=\"z-index:100;\">"+(scene_=="manager"?render_manager():render_career())+"</div>";
|
if(menu_=="newplayer")out+="<div class=\"fill"+std::string(scene_=="manager"?"":" menu-layer")+"\" style=\"z-index:100;\">"+(scene_=="manager"?render_manager():render_career())+"</div>";
|
||||||
if(menu_=="settings")out+="<div class=\"fill menu-layer\" style=\"z-index:100;\">"+window("Einstellungen",render_settings())+"</div>";
|
if(menu_=="settings")out+="<div class=\"fill menu-layer\" style=\"z-index:100;\">"+window("Einstellungen",render_settings())+"</div>";
|
||||||
if(menu_=="indoor")out+="<div class=\"fill menu-layer\" style=\"z-index:100;\">"+window("Hallentabellen",render_indoor())+"</div>";
|
if(menu_=="indoor")out+="<div class=\"fill menu-layer\" style=\"z-index:100;\">"+window("Hallentabellen",render_indoor())+"</div>";
|
||||||
if(menu_=="balance")out+="<div class=\"fill menu-layer\" style=\"z-index:100;\">"+window("Bilanz",render_balance())+"</div>";
|
if(menu_=="balance")out+="<div class=\"fill menu-layer\" style=\"z-index:100;\">"+window("Bilanz",render_balance())+"</div>";
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ std::string App::notebook_shell(const std::function<bool(const std::string &)> &
|
|||||||
const auto paper = renderer_.texture("nb-paper", theme_, [&] { return notebook_texture(2, 1054, 650, materials[4], materials[5]); });
|
const auto paper = renderer_.texture("nb-paper", theme_, [&] { return notebook_texture(2, 1054, 650, materials[4], materials[5]); });
|
||||||
const bool light = theme_ == "silver";
|
const bool light = theme_ == "silver";
|
||||||
const double stage = desktop_height(), top = notebook_top();
|
const double stage = desktop_height(), top = notebook_top();
|
||||||
const auto active = notebook_section_of(menu_);
|
const auto active = notebook_section_of(notebook_menu());
|
||||||
const auto open = [&](const std::string &route, const std::string &label, const std::string &css, const std::string &attrs, bool on) {
|
const auto open = [&](const std::string &route, const std::string &label, const std::string &css, const std::string &attrs, bool on) {
|
||||||
return btn(engine_mode_ ? std::string("engine-open") : "open:" + route, label, css, attrs + " data-id=\"" + route + "\"" + (on ? "" : " disabled=\"disabled\""));
|
return btn(engine_mode_ ? std::string("engine-open") : "open:" + route, label, css, attrs + " data-id=\"" + route + "\"" + (on ? "" : " disabled=\"disabled\""));
|
||||||
};
|
};
|
||||||
@@ -166,7 +166,7 @@ std::string App::notebook_shell(const std::function<bool(const std::string &)> &
|
|||||||
const std::string attrs = "id=\"tab-" + std::string(section.id) + "\" aria-pressed=\"" + (here ? "true" : "false") + "\" style=\"top:" + scalar(265.5 + index * 186.0) + "dp;transform:translateX(" +
|
const std::string attrs = "id=\"tab-" + std::string(section.id) + "\" aria-pressed=\"" + (here ? "true" : "false") + "\" style=\"top:" + scalar(265.5 + index * 186.0) + "dp;transform:translateX(" +
|
||||||
(here ? std::string("-27") : std::to_string(rest[index % rest.size()])) + "dp) rotate(" + scalar(turns[index % turns.size()]) + "deg);\"";
|
(here ? std::string("-27") : std::to_string(rest[index % rest.size()])) + "dp) rotate(" + scalar(turns[index % turns.size()]) + "deg);\"";
|
||||||
if (section.routes.empty()) out += btn("close", label, css, attrs);
|
if (section.routes.empty()) out += btn("close", label, css, attrs);
|
||||||
else if (here) out += open(menu_, label, css, attrs, true);
|
else if (here) out += open(notebook_menu(), label, css, attrs, true);
|
||||||
else out += open(first, label, css, attrs, !first.empty());
|
else out += open(first, label, css, attrs, !first.empty());
|
||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
@@ -204,7 +204,7 @@ std::string App::notebook_shell(const std::function<bool(const std::string &)> &
|
|||||||
// the ground is one menu with two pages: the stadium and what stands around it
|
// 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";
|
const bool ground = std::string_view(r) == "stadium" || std::string_view(r) == "periphery";
|
||||||
const bool here = ground ? menu_ == "stadium" && (stadium_view_.value("view", std::string("inside")) == "panorama") == (std::string_view(r) == "periphery")
|
const bool here = ground ? menu_ == "stadium" && (stadium_view_.value("view", std::string("inside")) == "panorama") == (std::string_view(r) == "periphery")
|
||||||
: part && engine_mode_ ? menu_ == "statistics" && statistics_page_ == r : menu_ == r;
|
: part && engine_mode_ ? menu_ == "statistics" && statistics_page_ == r : notebook_menu() == r;
|
||||||
if (here) {
|
if (here) {
|
||||||
kicker = std::string(section.label) + " · " + std::to_string(n + 1) + " / " + std::to_string(section.routes.size());
|
kicker = std::string(section.label) + " · " + std::to_string(n + 1) + " / " + std::to_string(section.routes.size());
|
||||||
heading = notebook_page_label(r);
|
heading = notebook_page_label(r);
|
||||||
@@ -226,7 +226,7 @@ std::string App::notebook_shell(const std::function<bool(const std::string &)> &
|
|||||||
// with a panel of its own, never under bare writing or an older sheet
|
// with a panel of its own, never under bare writing or an older sheet
|
||||||
// (the transfer market keeps it free; on the home page it shows while no card lies on the last two cells of the bottom row)
|
// (the transfer market keeps it free; on the home page it shows while no card lies on the last two cells of the bottom row)
|
||||||
bool stain = menu_ == "transfer" && page_native();
|
bool stain = menu_ == "transfer" && page_native();
|
||||||
if (menu_.empty()) {
|
if (notebook_menu().empty()) {
|
||||||
stain = true;
|
stain = true;
|
||||||
const auto &pages = notebook_pages().at("pages");
|
const auto &pages = notebook_pages().at("pages");
|
||||||
if (home_page_ >= 0 && home_page_ < int(pages.size()))
|
if (home_page_ >= 0 && home_page_ < int(pages.size()))
|
||||||
@@ -278,7 +278,7 @@ Picture App::notebook_art() {
|
|||||||
{"lineup", "bench"}, {"tactics", "bench"}, {"contracts", "locker"}, {"transfer", "press"},
|
{"lineup", "bench"}, {"tactics", "bench"}, {"contracts", "locker"}, {"transfer", "press"},
|
||||||
{"tables", "stand"}, {"league", "stand"}, {"other", "stand"}, {"strengths", "stand"}, {"statistics", "kickoff"},
|
{"tables", "stand"}, {"league", "stand"}, {"other", "stand"}, {"strengths", "stand"}, {"statistics", "kickoff"},
|
||||||
{"scorers", "kickoff"}, {"fairplay", "kickoff"}};
|
{"scorers", "kickoff"}, {"fairplay", "kickoff"}};
|
||||||
const auto found = motifs.find(menu_.empty() ? std::string("statistics") : menu_);
|
const auto found = motifs.find(notebook_menu().empty() ? std::string("statistics") : notebook_menu());
|
||||||
for (const std::string motif : {found == motifs.end() ? std::string("ball") : found->second, std::string("ball")}) {
|
for (const std::string motif : {found == motifs.end() ? std::string("ball") : found->second, std::string("ball")}) {
|
||||||
const auto art = renderer_.image("art.paper-" + motif + ".png", false, 2048);
|
const auto art = renderer_.image("art.paper-" + motif + ".png", false, 2048);
|
||||||
if (!art.token.empty() && art.width > 0 && art.height > 0) return art;
|
if (!art.token.empty() && art.width > 0 && art.height > 0) return art;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
// The menus that are laid out as a page of the notebook. Every other career menu is still a
|
// The menus that are laid out as a page of the notebook. Every other career menu is still a
|
||||||
// sheet of the old format, shown scaled inside the book.
|
// sheet of the old format, shown scaled inside the book.
|
||||||
bool App::page_native() const {
|
bool App::page_native() const {
|
||||||
|
if (scene_ == "managerhub") return true;
|
||||||
static const std::set<std::string> native{"camp", "toto", "settings", "save", "load", "stadium", "statistics", "news", "transfer", "training", "almanac", "tactics", "achievements", "highscore", "balance", "contracts", "environment", "tables", "league", "other", "strengths", "fairplay", "indoor", "scorers"};
|
static const std::set<std::string> native{"camp", "toto", "settings", "save", "load", "stadium", "statistics", "news", "transfer", "training", "almanac", "tactics", "achievements", "highscore", "balance", "contracts", "environment", "tables", "league", "other", "strengths", "fairplay", "indoor", "scorers"};
|
||||||
if (menu_ == "calendar" || menu_ == "postpone" || menu_ == "lineup") return notebook_page() && engine_mode_;
|
if (menu_ == "calendar" || menu_ == "postpone" || menu_ == "lineup") return notebook_page() && engine_mode_;
|
||||||
// a national coach arranges friendlies on the older sheet
|
// a national coach arranges friendlies on the older sheet
|
||||||
|
|||||||
@@ -916,7 +916,9 @@ class App final : public Rml::EventListener {
|
|||||||
// what the page says in the heading of the sheet instead of its plain name, and after it
|
// what the page says in the heading of the sheet instead of its plain name, and after it
|
||||||
std::string page_title_, page_hint_;
|
std::string page_title_, page_hint_;
|
||||||
// a career menu is a page of the notebook, not a window of its own
|
// a career menu is a page of the notebook, not a window of its own
|
||||||
bool notebook_page() const { return (scene_ == "desktop" || scene_ == "engine") && !menu_.empty(); }
|
// the manager's page is a scene of its own; for the book it is the page "newplayer"
|
||||||
|
std::string notebook_menu() const { return scene_ == "managerhub" ? std::string("newplayer") : menu_; }
|
||||||
|
bool notebook_page() const { return (scene_ == "desktop" || scene_ == "engine" || scene_ == "managerhub") && !notebook_menu().empty(); }
|
||||||
bool calendar_month_action(const std::string &, Rml::Element *);
|
bool calendar_month_action(const std::string &, Rml::Element *);
|
||||||
void calendar_open_month(int);
|
void calendar_open_month(int);
|
||||||
Json planning_calendar() const;
|
Json planning_calendar() const;
|
||||||
@@ -1012,6 +1014,7 @@ class App final : public Rml::EventListener {
|
|||||||
bool entry_event(Rml::Event &);
|
bool entry_event(Rml::Event &);
|
||||||
Json entry_snapshot() const;
|
Json entry_snapshot() const;
|
||||||
bool career_resign_open_=false,career_game_end_=false;
|
bool career_resign_open_=false,career_game_end_=false;
|
||||||
|
std::string career_hint_; // the scene of the manager's picture the pointer is on
|
||||||
int career_resign_portrait_=0;
|
int career_resign_portrait_=0;
|
||||||
uint64_t career_resign_revision_=0;
|
uint64_t career_resign_revision_=0;
|
||||||
const DataSource *career_resign_source_=nullptr;
|
const DataSource *career_resign_source_=nullptr;
|
||||||
@@ -1070,7 +1073,7 @@ class App final : public Rml::EventListener {
|
|||||||
if (!wanted) window_shown_ = "\x01";
|
if (!wanted) window_shown_ = "\x01";
|
||||||
// the career's desk hangs from the top edge of a taller screen, so its bar is the
|
// the career's desk hangs from the top edge of a taller screen, so its bar is the
|
||||||
// screen's bar and the spare height shows the stadium below
|
// screen's bar and the spare height shows the stadium below
|
||||||
const bool desk = !wanted && (scene_ == "engine" || scene_ == "desktop");
|
const bool desk = !wanted && (scene_ == "engine" || scene_ == "desktop" || scene_ == "managerhub");
|
||||||
if (wanted == window_zoom_ && desk == desk_top_) return;
|
if (wanted == window_zoom_ && desk == desk_top_) return;
|
||||||
window_zoom_ = wanted;
|
window_zoom_ = wanted;
|
||||||
desk_top_ = desk;
|
desk_top_ = desk;
|
||||||
@@ -1088,7 +1091,7 @@ class App final : public Rml::EventListener {
|
|||||||
canvas_top_ = (ph - 2160 * scale_) / 2;
|
canvas_top_ = (ph - 2160 * scale_) / 2;
|
||||||
if (desk_top_ && canvas_top_ > 0) canvas_top_ = 0;
|
if (desk_top_ && canvas_top_ > 0) canvas_top_ = 0;
|
||||||
// a career's desk is as high as the screen shows of it; menus keep their 16:9 stage
|
// a career's desk is as high as the screen shows of it; menus keep their 16:9 stage
|
||||||
const bool desk_scene = scene_ == "engine" || scene_ == "desktop";
|
const bool desk_scene = scene_ == "engine" || scene_ == "desktop" || scene_ == "managerhub";
|
||||||
const double fitted = std::min(double(pw) / 3840, double(ph) / 2160);
|
const double fitted = std::min(double(pw) / 3840, double(ph) / 2160);
|
||||||
const int stage_height = desk_scene ? std::clamp(int(ph / fitted), 2160, 2880) : 2160;
|
const int stage_height = desk_scene ? std::clamp(int(ph / fitted), 2160, 2880) : 2160;
|
||||||
if (stage_height != desktop_height()) {
|
if (stage_height != desktop_height()) {
|
||||||
@@ -1202,7 +1205,7 @@ class App final : public Rml::EventListener {
|
|||||||
else if (scene_ == "manager")
|
else if (scene_ == "manager")
|
||||||
markup = (adding_manager_?render_desktop():main_menu())+"<div class=\"fill\" style=\"z-index:100;\">"+render_manager()+"</div>";
|
markup = (adding_manager_?render_desktop():main_menu())+"<div class=\"fill\" style=\"z-index:100;\">"+render_manager()+"</div>";
|
||||||
else if (scene_ == "managerhub")
|
else if (scene_ == "managerhub")
|
||||||
markup = render_desktop()+"<div class=\"fill\" style=\"z-index:100;\">"+render_career()+"</div>";
|
markup = render_desktop()+"<div class=\"fill menu-layer\" style=\"z-index:100;\">"+render_career()+"</div>";
|
||||||
else if (scene_ == "opening")
|
else if (scene_ == "opening")
|
||||||
markup = main_menu()+"<div class=\"fill\" style=\"z-index:100;\">"+render_opening()+"</div>";
|
markup = main_menu()+"<div class=\"fill\" style=\"z-index:100;\">"+render_opening()+"</div>";
|
||||||
else if (scene_ == "live")
|
else if (scene_ == "live")
|
||||||
@@ -1224,7 +1227,7 @@ class App final : public Rml::EventListener {
|
|||||||
doc_->QuerySelectorAll(behind, "#entry-manager-underlay button,#entry-manager-underlay input,#entry-manager-underlay select,.window>.titlebar button");
|
doc_->QuerySelectorAll(behind, "#entry-manager-underlay button,#entry-manager-underlay input,#entry-manager-underlay select,.window>.titlebar button");
|
||||||
for (auto *node : behind) node->SetProperty("pointer-events", "none");
|
for (auto *node : behind) node->SetProperty("pointer-events", "none");
|
||||||
}
|
}
|
||||||
if(scene_=="managerhub" || (scene_=="manager"&&adding_manager_)){
|
if(scene_=="manager"&&adding_manager_){
|
||||||
Rml::ElementList background;doc_->QuerySelectorAll(background,".desktop-layer button,.desktop-layer [data-action]");
|
Rml::ElementList background;doc_->QuerySelectorAll(background,".desktop-layer button,.desktop-layer [data-action]");
|
||||||
for(auto *node:background){node->SetProperty("pointer-events","none");node->SetAttribute("tabindex",-1);}
|
for(auto *node:background){node->SetProperty("pointer-events","none");node->SetAttribute("tabindex",-1);}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user