Bind squad and lineup views to confirmed engine player swaps (by Codex)
This commit is contained in:
1 parent
94dc5ecbc4
commit
7d3b3f1101
15 files changed
+340
-36
No files matched your search
@@ -36,6 +36,10 @@ Json App::engine_camp_view() const {
|
||||
return {{"maps", maps}, {"training_camps", camps}};
|
||||
}
|
||||
void App::engine_render() {
|
||||
if (menu_ == "lineup") {
|
||||
if (auto *roster = element("lineup-roster-scroll")) lineup_roster_scroll_ = lineup_reset_scroll_ ? 0.f : roster->GetScrollTop();
|
||||
lineup_reset_scroll_ = false;
|
||||
}
|
||||
doc_->SetClassNames(theme_);
|
||||
std::string out;
|
||||
if (engine_data_.empty()) {
|
||||
@@ -50,6 +54,8 @@ void App::engine_render() {
|
||||
"</small></span></div><div class=\"info-date\">" + esc(meta.at("date").get<std::string>()) + "<small>" +
|
||||
esc(meta.at("season").at("label").get<std::string>()) + "</small></div><div class=\"info-cash\"><small>Guthaben</small><strong id=\"engine-cash\" class=\"" + money_classes(engine_money_minor(desk.at("accounts").at("cash"))) + "\">" +
|
||||
esc(engine_price(desk.at("accounts").at("cash"))) + "</strong></div></div>";
|
||||
bool lineup_available = false;
|
||||
try { (void)engine_lineup_projection(engine_data_); lineup_available = true; } catch (const std::exception &) {}
|
||||
init_desktop();
|
||||
for (const auto &[id, o] : desktop_.at("objects").items()) {
|
||||
if (!o.value("visible", false)) continue;
|
||||
@@ -82,15 +88,20 @@ void App::engine_render() {
|
||||
const auto route = id.substr(4);
|
||||
const bool camp_allowed = desk.at("menuAvailability").at("camps").value("status", "") == "available";
|
||||
const auto commands = meta.at("scope").value("allowedCommands", Json::array());
|
||||
const bool supported = route == "save" || (route == "camp" && engine_fresh_ && camp_allowed && std::find(commands.begin(), commands.end(), Json("camp.book")) != commands.end());
|
||||
const bool supported = (route == "lineup" && lineup_available && engine_fresh_) || route == "save" || (route == "camp" && engine_fresh_ && camp_allowed && std::find(commands.begin(), commands.end(), Json("camp.book")) != commands.end());
|
||||
out += desktop_button(id, o, "engine-open", supported && !engine_busy_);
|
||||
}
|
||||
}
|
||||
out += "</div>";
|
||||
if (menu_ == "lineup") out += "<div class=\"fill\" style=\"z-index:100;\">" + window("Aufstellung", render_lineup()) + "</div>";
|
||||
if (menu_ == "camp") out += "<div class=\"fill\" style=\"z-index:100;\">" + window("Trainingslager", render_camp()) + "</div>";
|
||||
}
|
||||
if (menu_.empty() || engine_data_.empty()) out += "<div class=\"panel\" style=\"position:absolute;left:850dp;bottom:24dp;right:100dp;padding:18dp;font-size:27dp;\" id=\"engine-status\">" + esc(engine_busy_ ? engine_operation_ : engine_notice_) + "</div>";
|
||||
element("canvas")->SetInnerRML(out); ++document_generation_;
|
||||
if (!engine_player_.empty()) {
|
||||
Rml::ElementList underlay; doc_->QuerySelectorAll(underlay, "#lineup-underlay button,#window-close");
|
||||
for (auto *node : underlay) { node->SetAttribute("disabled", true); node->SetProperty("pointer-events", "none"); }
|
||||
}
|
||||
const auto size = context_->GetDimensions();
|
||||
element("background")->SetInnerRML(img("background", size.x / scale_, size.y / scale_, false, true, 2048));
|
||||
element("background")->SetProperty("filter", theme_ == "silver" ? "saturate(0.2) brightness(0.9)" : theme_ == "matchday" ? "saturate(0.13) brightness(0.56)" : "saturate(0.34) brightness(0.70)");
|
||||
|
||||
Reference in new issue
Block a user