Port career setup, manager hub and context-aware native UI (by Codex)

This commit is contained in:
Codex authored and Codex committed 2026-10-27 01:57:58 +01:00
1 parent d88bf2872a
commit d085697bb9
37 files changed
+1447 -421

No files matched your search

+7 -6
View File
@@ -16,22 +16,23 @@ void App::init_desktop() {
std::string App::render_desktop() {
init_desktop();
const auto s = snap();
widget_data_ = demo_desktop_widgets(*world_, s.state);
widget_data_=demo_desktop_widgets(*world_,s.state);
const bool national=s.state.at("career").value("role", "club")=="national";
const auto *c = club(s);
std::string out =
"<div class=\"desktop-layer\"><div class=\"info-bar\">" +
btn("desktop-context",
crest(c, 82) + "<span><strong>" + esc(c ? world_->name(*c) : "") +
(national?img("career.national-de",82,82,false,false,256):crest(c,82)) + "<span><strong>" + esc(national?"Deutschland":c ? world_->name(*c) : "") +
"</strong><small>" + esc(manager(s).value("name", "")) +
"</small></span>",
"identity", "id=\"desktop-identity\"") +
"<div class=\"info-date\">" + std::string(widget_data_.at("matchday")==0?"Saisonvorbereitung":std::to_string(widget_data_.at("matchday").get<int>())+". Spieltag") + "<small>" +
esc(widget_data_.at("season").get<std::string>()) +
"</small></div><div class=\"info-cash\"><small>Guthaben</small><strong>" +
cash(s.state.value("cash", int64_t(0))) + "</strong></div></div>";
"</small></div><div class=\"info-cash\"><small>"+std::string(national?"Aufgabenbereich":"Guthaben")+"</small><strong>" +
(national?std::string("Nationalmannschaft"):cash(s.state.value("cash", int64_t(0)))) + "</strong></div></div>";
if(desktop_.value("grid",true))for(int row=0;row<7;++row)for(int col=0;col<15;++col)out+="<span class=\"desktop-grid-dot\" style=\"left:"+std::to_string(64+col*248)+"dp;top:"+std::to_string(224+row*248)+"dp;\"></span>";
for (const auto &[id, o] : desktop_["objects"].items()) {
if (!o.value("visible", false))
if (!o.value("visible", false) || (o.value("widget",false)?!demo_career_widget_available(s.state,id):!demo_career_menu_available(s.state,id.substr(4))))
continue;
const auto style = rect(o.value("x", 0), o.value("y", 0), o.value("w", 224),
o.value("h", 224)) + "z-index:" + std::to_string(o.value("z", 1)) + ";";
@@ -65,7 +66,7 @@ std::string App::render_desktop() {
"style=\"decorator:linear-gradient(140deg," +
top + "," + bottom + ");\">" +
img("button." + route, 146, 146, false, false, 256) +
"</div><span class=\"app-name\">" + esc(route=="transfer"?"Transfer":title(route)) + "</span>" +
"</div><span class=\"app-name\">" + esc(route=="newplayer"?"Manager":route=="transfer"?"Transfer":title(route)) + "</span>" +
(o.value("pinned", true) ? "<div class=\"pin-dot\"></div>" : "") +
"</button>";
}