The entry into the game on a pad: main menu, new game, managers, clubs, the season's opening
The main menu and everything up to the first day are written on one pad that lies in the middle of a table: the settings of a new game, the managers with their portraits, the clubs of a league, the entrants of the European cups, the cup draw and its overview. Saved games, mods and the sound open on the same pad. The table fills the window at any aspect while the pad stays whole. There is one style of portrait. The main menu asks before it leaves, and the ribbon of the notebook leads back to it. A stage that changes its height while it is drawn is now drawn once more; before, the notebook kept the height of the screen it came from. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
f25abc2e16
commit
048ccbecaa
20 files changed
+637
-812
No files matched your search
+106
-194
@@ -18,93 +18,64 @@ std::string App::front_size(uint64_t bytes) const {
|
||||
return number(int64_t(tenths / 10)) +
|
||||
(tenths % 10 ? "," + std::to_string(tenths % 10) : "") + " MiB";
|
||||
}
|
||||
// A length of the entry's design in dp: the table is drawn 1672 units across.
|
||||
std::string App::es(double units) { return scalar(units * kEntryUnit) + "dp"; }
|
||||
// The table with the pad on it; `over` lies above the pad (a note that asks something).
|
||||
std::string App::entry_stage(const std::string &paper, const std::string &over) {
|
||||
return "<div class=\"es-stage\"><div class=\"es-table\">" + (gui_.contains("entry.table") ? img("entry.table", 3840, 2160, false, true, 2048) : std::string()) +
|
||||
"</div><section class=\"es-paper pg-root\">" + paper + "</section>" + over + "</div>";
|
||||
}
|
||||
// What is written on the pad: a small line, the heading, a rule, the body and the buttons at
|
||||
// its foot. `right` stands beside the heading; without it the paper clip keeps its room.
|
||||
std::string App::entry_sheet(const std::string &kicker, const std::string &title, const std::string &body, const std::string &foot, const std::string &right) {
|
||||
return "<header class=\"es-head\"><div class=\"es-grow\"><span class=\"es-k\">" + esc(pg_upper(kicker)) + "</span><h1 class=\"es-h1\">" + esc(title) + "</h1></div>" +
|
||||
(right.empty() ? std::string("<span class=\"es-clip\"></span>") : right) + "</header><div class=\"es-rule\"></div>" + body + (foot.empty() ? std::string() : "<nav class=\"es-foot\">" + foot + "</nav>");
|
||||
}
|
||||
std::string App::entry_pad(const std::string &kicker, const std::string &title, const std::string &body, const std::string &foot, const std::string &right, const std::string &over) {
|
||||
return entry_stage(entry_sheet(kicker, title, body, foot, right), over);
|
||||
}
|
||||
std::string App::main_menu() {
|
||||
const auto *active = mod(active_mod_);
|
||||
const bool available = active && active->error.empty();
|
||||
std::string out;
|
||||
if (gui_.contains("menu.club-office"))
|
||||
out = "<div class=\"front-office-art\">" +
|
||||
img("menu.club-office", 3840, 2160, false, true, 2048) + "</div>";
|
||||
out += "<div class=\"fill front-office-shade\"></div><div class=\"front-home office-home\"><nav class=\"main-options\" aria-label=\"Hauptmenü\">";
|
||||
std::string rows;
|
||||
const std::array<std::pair<const char *, const char *>, 6> actions{
|
||||
{{"new", "Neues Spiel"},
|
||||
{"load", "Spiel laden"},
|
||||
{"network", "Netzwerk"},
|
||||
{"mods", "Mod"},
|
||||
{"settings", "Einstellungen"},
|
||||
{"exit", "Beenden"}}};
|
||||
{{"new", "Neues Spiel"}, {"load", "Spiel laden"}, {"network", "Netzwerk"}, {"mods", "Mod"}, {"settings", "Einstellungen"}, {"exit", "Beenden"}}};
|
||||
for (const auto &[key, title] : actions) {
|
||||
const bool network = std::string(key) == "network",
|
||||
disabled = scene_ != "main" || !menu_.empty() || network ||
|
||||
(std::string(key) == "new" && !available &&
|
||||
!(front_external_override_ && world_));
|
||||
out += btn(key,
|
||||
"<span>" + std::string(title) + "</span>" +
|
||||
(network ? "<small>Demnächst</small>" : "") +
|
||||
"<span class=\"front-hover-arrow\">›</span>",
|
||||
"front-menu-action",
|
||||
"id=\"front-" + std::string(key) + "\" " +
|
||||
(disabled ? "disabled" : ""));
|
||||
const std::string id = key;
|
||||
const bool network = id == "network",
|
||||
disabled = scene_ != "main" || !menu_.empty() || network || front_quit_ || (id == "new" && !available && !(front_external_override_ && world_));
|
||||
rows += btn(key, "<span>" + std::string(title) + "</span>" + (network ? "<span class=\"es-mb-s\">DEMNÄCHST</span>" : "") + "<span class=\"es-grow\"></span><span class=\"es-mb-a\">›</span>",
|
||||
std::string("es-mb") + (id == "load" || id == "exit" ? " gap" : ""), "id=\"front-" + id + "\" " + (disabled ? "disabled=\"disabled\"" : ""));
|
||||
}
|
||||
const auto label = front_external_override_ && world_ ? world_->title()
|
||||
: available ? active->name
|
||||
: "Keine Mod aktiviert";
|
||||
out +=
|
||||
"</nav><footer class=\"front-footer\"><div class=\"front-active\"><span "
|
||||
"class=\"front-active-dot\"></span><div><small>Aktive Mod</small><strong "
|
||||
"id=\"front-active-name\">" +
|
||||
esc(label) + "</strong></div></div><small class=\"front-version\">v" +
|
||||
std::string(kOpenBmhVersion) + (config_.preview_only ? " · UI-Demo" : " · Entwicklung") + "</small></footer></div>";
|
||||
return out;
|
||||
const auto label = front_external_override_ && world_ ? world_->title() : available ? active->name : "Keine Mod aktiviert";
|
||||
const std::string ask = front_quit_ ? "<div class=\"es-box es-ask\"><strong>Das Spiel wirklich beenden?</strong><div class=\"es-row\" style=\"justify-content:flex-end;margin-top:" + es(10) + ";\">" +
|
||||
pg_button("front-quit-no", "Abbrechen", "sm", "id=\"front-quit-no\"") + pg_button("front-quit-yes", "Beenden", "primary sm", "id=\"front-quit-yes\"") + "</div></div>"
|
||||
: std::string();
|
||||
return entry_stage("<h1 class=\"es-title\">Dreierpack Manager</h1><div class=\"es-gold\"></div><div class=\"es-fill\" style=\"align-items:stretch;gap:" + es(34) + ";\"><nav class=\"es-menu\" aria-label=\"Hauptmenü\">" + rows +
|
||||
"</nav><div class=\"es-side\">" + ask + "<span class=\"es-mut\">Aktive Mod</span><strong id=\"front-active-name\">" + esc(label) + "</strong><span class=\"es-mut\" style=\"margin-top:" + es(8) + ";\">Version " +
|
||||
std::string(kOpenBmhVersion) + (config_.preview_only ? " · UI-Demo" : " · Entwicklung") + "</span></div></div>");
|
||||
}
|
||||
std::string App::front_mod_details() {
|
||||
const auto *entry = front_selected();
|
||||
if (!entry)
|
||||
return "<div class=\"front-mod-empty\"><h2>Noch keine Mods "
|
||||
"installiert</h2><p>Importiere einen Originalordner oder ein "
|
||||
"OpenBMH-Paket.</p></div>";
|
||||
return "<div class=\"es-box es-detail\" style=\"align-items:center;justify-content:center;text-align:center;\"><h2 class=\"es-h\" style=\"font-size:" + es(21) + ";line-height:" + es(26) +
|
||||
";\">Noch keine Mods installiert</h2><span class=\"es-mut\" style=\"display:block;\">Importiere einen Originalordner oder ein OpenBMH-Paket.</span></div>";
|
||||
const bool active = entry->active && !front_external_override_;
|
||||
const auto provenance = entry->description.empty() ? front_source_name(*entry)
|
||||
: entry->description;
|
||||
std::string out =
|
||||
"<div class=\"front-mod-details\"><div class=\"front-mod-cover\">" +
|
||||
img("background", 1360, 360, false, true, 1600) +
|
||||
"<span>Open<span>BMH</span></span></div><header><div><p>" +
|
||||
esc(provenance) + "</p><h2>" + esc(entry->name) +
|
||||
"</h2></div><span class=\"front-mod-status " +
|
||||
(active ? "is-active" : "") + "\">" +
|
||||
(active ? "Aktiv"
|
||||
: entry->valid() ? "Installiert"
|
||||
: "Fehlerhaft") +
|
||||
"</span></header><div class=\"front-mod-metadata\">";
|
||||
const auto provenance = entry->description.empty() ? front_source_name(*entry) : entry->description;
|
||||
std::string out = "<div class=\"es-box es-detail\"><span class=\"es-k\">" + esc(pg_upper(active ? "Aktiv" : entry->valid() ? "Installiert" : "Fehlerhaft")) + "</span><h2 class=\"es-h\" style=\"font-size:" + es(21) + ";line-height:" + es(26) +
|
||||
";\">" + esc(entry->name) + "</h2><span class=\"es-mut\" style=\"display:block;\">" + esc(provenance) + "</span><div>";
|
||||
const std::vector<std::pair<std::string, std::string>> fields = {
|
||||
{"Art", entry->type},
|
||||
{"Herkunft", front_source_name(*entry)},
|
||||
{"Version", entry->version},
|
||||
{"Inhalt", std::to_string(entry->file_count) +
|
||||
(entry->file_count == 1 ? " Datei" : " Dateien") + " · " +
|
||||
front_size(entry->bytes)}};
|
||||
for (const auto &[label, value] : fields)
|
||||
out += "<div><span>" + esc(label) + "</span><strong>" + esc(value) +
|
||||
"</strong></div>";
|
||||
{"Inhalt", std::to_string(entry->file_count) + (entry->file_count == 1 ? " Datei" : " Dateien") + " · " + front_size(entry->bytes)}};
|
||||
for (const auto &[label, value] : fields) out += "<div class=\"es-kv\"><span>" + esc(label) + "</span><strong>" + esc(value) + "</strong></div>";
|
||||
out += "</div>";
|
||||
if (!entry->valid())
|
||||
out += "<p class=\"front-mod-error\">" + esc(entry->error) + "</p>";
|
||||
if (!entry->valid()) out += "<span class=\"es-error\">" + esc(entry->error) + "</span>";
|
||||
const auto *current = mod(active_mod_);
|
||||
out +=
|
||||
"<p class=\"front-mod-activation-note\">" +
|
||||
esc(active ? "Diese Mod ist für das nächste Spiel ausgewählt."
|
||||
: current ? "Aktivieren ersetzt die Auswahl „" + current->name + "“."
|
||||
: "Aktiviere diese Mod für das nächste Spiel.") +
|
||||
"</p>";
|
||||
return out +
|
||||
btn("mod-activate", active ? "Aktiv" : "Aktivieren",
|
||||
"front-mod-activate",
|
||||
"id=\"mod-activate\" " +
|
||||
std::string(active || !entry->valid() || front_busy_
|
||||
? "disabled"
|
||||
: "")) +
|
||||
"</div>";
|
||||
out += "<span class=\"es-grow\"></span><span class=\"es-mut\" style=\"display:block;font-size:" + es(12) + ";\">" +
|
||||
esc(active ? "Diese Mod ist für das nächste Spiel ausgewählt." : current ? "Aktivieren ersetzt die Auswahl „" + current->name + "“." : "Aktiviere diese Mod für das nächste Spiel.") + "</span><div class=\"es-row\">";
|
||||
return out + pg_button("mod-activate", active ? "Aktiv" : "Aktivieren", "primary sm", "id=\"mod-activate\" " + std::string(active || !entry->valid() || front_busy_ ? "disabled=\"disabled\"" : "")) + "</div></div>";
|
||||
}
|
||||
std::string App::front_modal() {
|
||||
if (front_dialog_.empty())
|
||||
@@ -112,150 +83,91 @@ std::string App::front_modal() {
|
||||
std::string heading, body, buttons;
|
||||
if (front_dialog_ == "choice") {
|
||||
heading = "Mod importieren";
|
||||
body = "<p>Wähle einen Originalordner oder einen Export im "
|
||||
"OpenBMH-Format.</p><div class=\"front-import-choices\">";
|
||||
body = "<p>Wähle einen Originalordner oder einen Export im OpenBMH-Format.</p>";
|
||||
const std::array<std::array<const char *, 3>, 3> choices{
|
||||
{{{"original", "BMH / Football Limited",
|
||||
"Originalordner mit BMH.EXE oder FLTD.EXE"}},
|
||||
{{"package", "OpenBMH-Paket",
|
||||
"Weltpaket im neuen Format · .obw oder .zip"}},
|
||||
{{"folder", "OpenBMH-Exportordner",
|
||||
"Entpackte Welt oder Mod-Ordner mit content.obw"}}}};
|
||||
{{{"original", "BMH / Football Limited", "Originalordner mit BMH.EXE oder FLTD.EXE"}},
|
||||
{{"package", "OpenBMH-Paket", "Weltpaket im neuen Format · .obw oder .zip"}},
|
||||
{{"folder", "OpenBMH-Exportordner", "Entpackte Welt oder Mod-Ordner mit content.obw"}}}};
|
||||
for (const auto &c : choices)
|
||||
body += btn(
|
||||
"front-pick",
|
||||
"<strong>" + std::string(c[1]) + "</strong><span>" + c[2] + "</span>",
|
||||
"front-import-choice", "data-id=\"" + std::string(c[0]) + "\"");
|
||||
body += "</div>";
|
||||
buttons = btn("front-dismiss", "Abbrechen");
|
||||
body += btn("front-pick", "<strong>" + std::string(c[1]) + "</strong><span>" + c[2] + "</span>", "es-choice", "data-id=\"" + std::string(c[0]) + "\"");
|
||||
buttons = pg_button("front-dismiss", "Abbrechen");
|
||||
} else if (front_dialog_ == "name" || front_dialog_ == "rename") {
|
||||
const bool importing = front_dialog_ == "name";
|
||||
heading = importing ? "Mod übernehmen" : "Mod umbenennen";
|
||||
body = "<label class=\"front-name-label\"><span>Bezeichnung</span><input "
|
||||
"type=\"text\" id=\"front-mod-name\" value=\"" +
|
||||
esc(front_name_) + "\" maxlength=\"64\"/></label>";
|
||||
body = "<div><span class=\"es-k\">BEZEICHNUNG</span><input type=\"text\" class=\"es-in\" id=\"front-mod-name\" value=\"" + esc(front_name_) + "\" maxlength=\"64\" style=\"margin-top:" + es(3) + ";\"/></div>";
|
||||
if (importing && front_plan_) {
|
||||
const auto &m = front_plan_->metadata;
|
||||
body +=
|
||||
"<p class=\"front-import-summary\">" + esc(m.description) + " · " +
|
||||
esc(m.type) + "<br/>" + std::to_string(m.file_count) +
|
||||
(m.file_count == 1 ? " Datei" : " Dateien") + " · " +
|
||||
front_size(m.bytes) + "</p><p class=\"front-import-note\">" +
|
||||
std::string(m.type == "Classic"
|
||||
? "Der vorhandene OpenBMH-Importer konvertiert die "
|
||||
"Originaldaten in ein eigenständiges Classic-Paket."
|
||||
: "Das geprüfte Weltpaket wird in deine "
|
||||
"Mod-Bibliothek übernommen.") +
|
||||
" Anschließend kannst du die Mod aktivieren.</p>";
|
||||
body += "<p>" + esc(m.description) + " · " + esc(m.type) + " · " + std::to_string(m.file_count) + (m.file_count == 1 ? " Datei" : " Dateien") + " · " + front_size(m.bytes) + "</p><p class=\"es-mut\">" +
|
||||
std::string(m.type == "Classic" ? "Der vorhandene OpenBMH-Importer konvertiert die Originaldaten in ein eigenständiges Classic-Paket."
|
||||
: "Das geprüfte Weltpaket wird in deine Mod-Bibliothek übernommen.") +
|
||||
" Anschließend kannst du die Mod aktivieren.</p>";
|
||||
}
|
||||
body += "<p id=\"front-name-error\" class=\"front-name-error\">" +
|
||||
esc(front_name_error_) + "</p>";
|
||||
buttons = btn("front-dismiss", "Abbrechen") +
|
||||
btn("front-name-confirm",
|
||||
importing ? "Importieren" : "Umbenennen", "primary",
|
||||
"id=\"front-name-confirm\" " +
|
||||
std::string(front_name_error_.empty() ? "" : "disabled"));
|
||||
body += "<span id=\"front-name-error\" class=\"es-error\">" + esc(front_name_error_) + "</span>";
|
||||
buttons = pg_button("front-dismiss", "Abbrechen") +
|
||||
pg_button("front-name-confirm", importing ? "Importieren" : "Umbenennen", "primary", "id=\"front-name-confirm\" " + std::string(front_name_error_.empty() ? "" : "disabled=\"disabled\""));
|
||||
} else if (front_dialog_ == "delete") {
|
||||
heading = "Mod löschen?";
|
||||
body = "<p>„" + esc(front_target_ ? front_target_->name : "") +
|
||||
"“ wirklich aus der lokalen Bibliothek entfernen?</p>";
|
||||
if (front_target_ && front_target_->active)
|
||||
body += "<p class=\"front-import-note\">Danach ist keine Mod aktiviert. "
|
||||
"Wähle eine andere Mod für das nächste neue Spiel.</p>";
|
||||
body += "<p class=\"front-import-note\">Persönliche Spielstände und "
|
||||
"Desktopansichten bleiben erhalten.</p>";
|
||||
buttons = btn("front-dismiss", "Abbrechen") +
|
||||
btn("front-delete-confirm", "Löschen", "primary");
|
||||
body = "<p>„" + esc(front_target_ ? front_target_->name : "") + "“ wirklich aus der lokalen Bibliothek entfernen?</p>";
|
||||
if (front_target_ && front_target_->active) body += "<p class=\"es-mut\">Danach ist keine Mod aktiviert. Wähle eine andere Mod für das nächste neue Spiel.</p>";
|
||||
body += "<p class=\"es-mut\">Persönliche Spielstände bleiben erhalten.</p>";
|
||||
buttons = pg_button("front-dismiss", "Abbrechen") + pg_button("front-delete-confirm", "Löschen", "primary");
|
||||
} else {
|
||||
heading = "Vorgang nicht möglich";
|
||||
body = "<p>" + esc(front_error_) + "</p>";
|
||||
buttons = btn("front-dismiss", "Verstanden");
|
||||
buttons = pg_button("front-dismiss", "Verstanden");
|
||||
}
|
||||
return "<div class=\"front-dialog-layer\"><section class=\"front-dialog\" "
|
||||
"role=\"dialog\" aria-modal=\"true\"><h2>" +
|
||||
esc(heading) + "</h2>" + body + "<footer>" + buttons +
|
||||
"</footer></section></div>";
|
||||
return "<div class=\"es-veil pg-root\"><section class=\"es-dlg\" role=\"dialog\" aria-modal=\"true\"><h2>" + esc(heading) + "</h2>" + body + "<div class=\"es-dlg-act\">" + buttons + "</div></section></div>";
|
||||
}
|
||||
std::string App::mods_page() {
|
||||
std::string rows;
|
||||
for (size_t i = 0; i < front_snapshot_.entries.size(); ++i) {
|
||||
const auto &entry = front_snapshot_.entries[i];
|
||||
const bool active = entry.active && !front_external_override_;
|
||||
rows += btn(
|
||||
"mod-select",
|
||||
"<span class=\"front-mod-copy\"><strong>" + esc(entry.name) +
|
||||
"</strong><small>" +
|
||||
(active
|
||||
? "<span "
|
||||
"class=\"front-mod-active-dot\"></span><span>Aktiv</span>"
|
||||
: "<span>" + esc(entry.valid() ? entry.source : "Fehlerhaft") +
|
||||
"</span>") +
|
||||
"</small></span><span class=\"front-mod-type\">" + esc(entry.type) +
|
||||
"</span>",
|
||||
"front-mod-entry " +
|
||||
std::string(entry.id == selected_mod_ ? "selected" : ""),
|
||||
"id=\"mod-entry-" + std::to_string(i) +
|
||||
"\" role=\"option\" aria-selected=\"" +
|
||||
(entry.id == selected_mod_ ? "true" : "false") + "\" data-id=\"" +
|
||||
esc(entry.id) + "\" " + (front_busy_ ? "disabled" : ""));
|
||||
const bool active = entry.active && !front_external_override_, chosen = entry.id == selected_mod_;
|
||||
rows += btn("mod-select", "<strong>" + esc(entry.name) + "</strong><span>" + esc(active ? "Aktiv" : entry.valid() ? entry.source : "Fehlerhaft") + " · " + esc(entry.type) + "</span>", std::string("es-li") + (chosen ? " sel" : ""),
|
||||
"id=\"mod-entry-" + std::to_string(i) + "\" role=\"option\" aria-selected=\"" + (chosen ? "true" : "false") + "\" data-id=\"" + esc(entry.id) + "\" " + (front_busy_ ? "disabled=\"disabled\"" : ""));
|
||||
}
|
||||
if (rows.empty())
|
||||
rows = "<p class=\"front-mod-empty-list\">Noch keine Mods vorhanden.</p>";
|
||||
const auto tabs =
|
||||
btn("front-tab",
|
||||
"Installiert · " + std::to_string(front_snapshot_.entries.size()),
|
||||
front_tab_ == "installed" ? "active" : "",
|
||||
"id=\"mod-installed\" role=\"tab\" aria-selected=\"" +
|
||||
std::string(front_tab_ == "installed" ? "true" : "false") +
|
||||
"\" data-id=\"installed\" " + (front_busy_ ? "disabled" : "")) +
|
||||
btn("front-tab", "Downloads", front_tab_ == "downloads" ? "active" : "",
|
||||
"id=\"mod-downloads\" role=\"tab\" aria-selected=\"" +
|
||||
std::string(front_tab_ == "downloads" ? "true" : "false") +
|
||||
"\" data-id=\"downloads\" " + (front_busy_ ? "disabled" : ""));
|
||||
const auto pane =
|
||||
front_tab_ == "installed"
|
||||
? "<div class=\"front-mod-layout\"><section "
|
||||
"class=\"front-mod-browser\"><header><span>Mod</span><span>Art</"
|
||||
"span></header><div class=\"front-mod-list\" id=\"mod-list\" "
|
||||
"role=\"listbox\" aria-label=\"Mod auswählen\">" +
|
||||
rows + "</div></section>" + front_mod_details() + "</div>"
|
||||
: "<section class=\"front-mod-downloads\">" +
|
||||
img("icon.download", 180, 180) +
|
||||
"<h2>Neue Welten entdecken</h2><p>Hier findest du später Mods "
|
||||
"aus der zentralen OpenBMH-Datenbank.</p>" +
|
||||
btn("front-noop", "Downloads demnächst", {}, "disabled") +
|
||||
"</section>";
|
||||
const bool selected = front_selected() != nullptr,
|
||||
enabled = !front_busy_ && selected && front_tab_ == "installed";
|
||||
const auto feedback = front_busy_ ? front_feedback_
|
||||
: !front_feedback_.empty() ? front_feedback_
|
||||
: !front_snapshot_.error.empty()
|
||||
? front_snapshot_.error
|
||||
: "Es kann genau eine Mod aktiv sein.";
|
||||
const auto body =
|
||||
"<div class=\"front-mod-content\"><nav class=\"front-mod-tabs\" "
|
||||
"role=\"tablist\">" +
|
||||
tabs + "</nav><div class=\"front-mod-tabpanel\" role=\"tabpanel\">" +
|
||||
pane +
|
||||
"</div><footer class=\"front-mod-actions\"><p id=\"mod-feedback\">" +
|
||||
esc(feedback) + "</p><div>" +
|
||||
btn("front-import", "Importieren", {},
|
||||
"id=\"front-import-button\" " +
|
||||
std::string(front_busy_ ? "disabled" : "")) +
|
||||
btn("mod-rename", "Umbenennen", {},
|
||||
"id=\"mod-rename-button\" " +
|
||||
std::string(enabled ? "" : "disabled")) +
|
||||
btn("mod-remove", "Löschen", {},
|
||||
"id=\"mod-remove-button\" " +
|
||||
std::string(enabled ? "" : "disabled")) +
|
||||
"</div></footer></div>";
|
||||
return main_menu() +
|
||||
"<div class=\"fill front-mod-layer\" style=\"z-index:100;\"><section "
|
||||
"class=\"window front-mod-window\"><header class=\"titlebar\">" +
|
||||
btn("front-home", "<span>×</span>", "close",
|
||||
"id=\"window-close\" aria-label=\"Mod-Verwaltung schließen\" " +
|
||||
std::string(front_busy_ ? "disabled" : "")) +
|
||||
"<h1>Mod</h1></header>" + body + front_modal() + "</section></div>";
|
||||
if (rows.empty()) rows = "<span class=\"es-mut\" style=\"display:block;padding:" + es(8) + " " + es(12) + ";\">Noch keine Mods vorhanden.</span>";
|
||||
const auto tab = [&](const char *id, const std::string &label) {
|
||||
const bool on = front_tab_ == id;
|
||||
return btn("front-tab", "<span>" + label + "</span>", on ? "on" : "", "id=\"mod-" + std::string(id) + "\" role=\"tab\" aria-selected=\"" + (on ? "true" : "false") + "\" data-id=\"" + id + "\" " + (front_busy_ ? "disabled=\"disabled\"" : ""));
|
||||
};
|
||||
const auto tabs = "<nav class=\"pg-tabs\" role=\"tablist\" style=\"margin-right:" + es(60) + ";\">" + tab("installed", "Installiert · " + std::to_string(front_snapshot_.entries.size())) + tab("downloads", "Downloads") + "</nav>";
|
||||
const auto pane = front_tab_ == "installed"
|
||||
? "<div class=\"es-fill\" style=\"gap:" + es(14) + ";align-items:stretch;\"><div class=\"es-list\" id=\"mod-list\" role=\"listbox\" aria-label=\"Mod auswählen\" style=\"width:" + es(270) + ";\">" + rows + "</div>" +
|
||||
front_mod_details() + "</div>"
|
||||
: std::string("<div class=\"es-box es-fill\" style=\"align-items:center;justify-content:center;\"><span class=\"es-mut\">Downloads folgen in einer späteren Version.</span></div>");
|
||||
const bool selected = front_selected() != nullptr, enabled = !front_busy_ && selected && front_tab_ == "installed";
|
||||
const auto feedback = front_busy_ ? front_feedback_ : !front_feedback_.empty() ? front_feedback_ : !front_snapshot_.error.empty() ? front_snapshot_.error : "Es kann genau eine Mod aktiv sein.";
|
||||
const std::string off = "disabled=\"disabled\"";
|
||||
const auto foot = (front_tab_ == "installed" ? pg_button("front-import", "Importieren", "sm", "id=\"front-import-button\" " + (front_busy_ ? off : std::string())) +
|
||||
pg_button("mod-rename", "Umbenennen", "sm", "id=\"mod-rename-button\" " + (enabled ? std::string() : off)) +
|
||||
pg_button("mod-remove", "Löschen", "sm", "id=\"mod-remove-button\" " + (enabled ? std::string() : off))
|
||||
: std::string()) +
|
||||
"<span class=\"es-note\" id=\"mod-feedback\">" + esc(feedback) + "</span>" + pg_button("front-home", "Zurück", "primary", "id=\"window-close\" " + (front_busy_ ? off : std::string()));
|
||||
return entry_pad("Hauptmenü", "Mod", pane, foot, tabs, front_modal());
|
||||
}
|
||||
// Spiel laden from the main menu: the saves on the left, the chosen one on the right.
|
||||
std::string App::render_files_pad() {
|
||||
std::string entries;
|
||||
for (size_t i = 0; i < files_rows_.size(); ++i) {
|
||||
const auto &entry = files_rows_[i];
|
||||
const bool chosen = files_selected_ == entry.id;
|
||||
entries += btn("files-select", "<strong>" + esc(entry.name) + "</strong><span>" + esc(entry.valid() ? "Gespeichert am " + files_when(entry.created) : "Datei kann nicht geöffnet werden") + "</span>", std::string("es-li") + (chosen ? " sel" : ""),
|
||||
"id=\"files-entry-" + std::to_string(i) + "\" role=\"option\" data-id=\"" + esc(entry.id) + "\" data-file-row=\"true\" aria-selected=\"" + (chosen ? "true" : "false") + "\"");
|
||||
}
|
||||
if (entries.empty()) entries = "<span class=\"es-mut\" style=\"display:block;padding:" + es(8) + " " + es(12) + ";\">" + std::string(files_native_ && engine_files_busy_ ? "Spielstände werden geladen …" : "Noch keine Spielstände vorhanden.") + "</span>";
|
||||
std::string details;
|
||||
try { details = files_page_details(false); }
|
||||
catch (const std::exception &e) { details = "<div class=\"pg-empty\"><strong class=\"pg-h\">Datei nicht verfügbar</strong><span style=\"display:block;\">" + esc(e.what()) + "</span></div>"; }
|
||||
const bool selected = files_entry_ && files_entry_->valid();
|
||||
const std::string off = "disabled=\"disabled\"";
|
||||
const auto feedback = files_feedback_.empty() ? std::string("Klick oder Pfeiltasten wählen einen Eintrag.") : files_feedback_;
|
||||
return entry_pad("Hauptmenü", "Spiel laden",
|
||||
"<div class=\"es-fill\" style=\"gap:" + es(14) + ";align-items:stretch;\"><div id=\"files-list\" class=\"es-list\" role=\"listbox\" aria-label=\"Spielstand auswählen\" style=\"width:" + es(290) + ";\">" + entries +
|
||||
"</div><div class=\"es-box es-detail\">" + details + "</div></div>",
|
||||
pg_button("files-import", "Importieren", "sm") + pg_button("files-rename", "Umbenennen", "sm", selected ? std::string() : off) +
|
||||
pg_button("files-delete", "Löschen", "sm", files_entry_ && !files_entry_->token.empty() ? std::string() : off) + "<span class=\"es-note\" id=\"files-feedback\" role=\"status\">" + esc(feedback) + "</span>" +
|
||||
pg_button("files-close", "Abbrechen") + pg_button("files-load", "Laden", "primary", "id=\"files-confirm\" " + (selected ? std::string() : off)));
|
||||
}
|
||||
|
||||
Json App::front_snapshot_view() const {
|
||||
|
||||
Reference in new issue
Block a user