The match day is an open match sheet in front of a stadium that suits the crowd and the weather
The live view follows the new design: match cards with score tiles in the clubs' colours, the ticker and the manager's team on two pages, speed as five buttons, substitutions picked from two lists. The colours are the notebook's, so the skins apply. Twenty-four stadium pictures are chosen by attendance and weather picture. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
abbd4afe70
commit
79b0a75c14
31 files changed
+921
-447
No files matched your search
@@ -274,19 +274,16 @@ void App::live_set_speed(int value) {
|
||||
if (!live_.speed(value)) return;
|
||||
live_feedback_.clear();
|
||||
live_last_tick_ = SDL_GetTicks64();
|
||||
if (auto *node = dynamic_cast<Rml::ElementFormControl *>(element("live-speed"))) {
|
||||
node->SetValue(std::to_string(value)); node->SetAttribute("aria-valuenow", value);
|
||||
node->SetAttribute("aria-valuetext", value ? "Wiedergabe Stufe " + std::to_string(value) : "Pause");
|
||||
}
|
||||
if (auto *node = element("live-speed-value")) node->SetInnerRML(esc(value ? std::to_string(value) + "×" : "Pause"));
|
||||
if (auto *node = element("live-pause")) node->SetInnerRML(live_text(value ? "Pause" : "Abspielen", "control-label"));
|
||||
const auto &frame = live_.fixture().at("frames")[live_.sequence()];
|
||||
const bool recorded = live_.fixture().at("source") == "engine-recording";
|
||||
if (recorded) { if (auto *node = element("live-playback-status")) node->SetInnerRML(""); return; }
|
||||
const std::string phase = live_.finished() ? "Beendet" : frame.at("phase") == "interval" ? "Halbzeit" : value ? (recorded ? "Spiel läuft" : "Aufzeichnung läuft") : (recorded ? "Pausiert" : "Gemeinsam pausiert");
|
||||
if (auto *node = element("live-phase-status")) node->SetInnerRML(esc(phase));
|
||||
if (auto *node = element("live-playback-status")) node->SetInnerRML(esc(phase + " · " + std::to_string(frame.at("minute").get<int>()) + (recorded ? "′" : "′ · keine Spielwertänderung")));
|
||||
dirty_ = true;
|
||||
refresh();
|
||||
}
|
||||
void App::live_follow_match() {
|
||||
for (const auto &owner : live_.fixture().at("owners"))
|
||||
if (owner.at("match_id") == live_selected_match_) {
|
||||
// the manager on the right page already plays in this match: he stays
|
||||
const auto shown = live_owner();
|
||||
if (!shown.is_object() || shown.at("match_id") != live_selected_match_) { live_.owner(owner.at("id").get<std::string>()); live_reset_detail_ = true; }
|
||||
return;
|
||||
}
|
||||
}
|
||||
void App::live_tick() {
|
||||
if (engine_live_busy_) engine_live_poll();
|
||||
@@ -350,11 +347,13 @@ bool App::live_action(const std::string &action, Rml::Element *target) {
|
||||
if (scene_ != "live" || !live_.available()) return true;
|
||||
const auto id = target ? target->GetAttribute<Rml::String>("data-id", "") : "";
|
||||
bool detail_only = false, ticker_only = false;
|
||||
if (!live_dialog_.empty() && action != "live-dialog-cancel" && action != "live-dialog-apply" && action != "live-tactic-cycle") return true;
|
||||
if (!live_dialog_.empty() && action != "live-dialog-cancel" && action != "live-dialog-apply" && action != "live-tactic-cycle" && action != "live-pick-out" && action != "live-pick-in") return true;
|
||||
if (action == "live-back") { live_close(); return true; }
|
||||
if (action == "live-owner-prev" || action == "live-owner-next") {
|
||||
if (!live_.cycle_owner(action == "live-owner-prev" ? -1 : 1)) return true;
|
||||
live_reset_detail_ = detail_only = true;
|
||||
const auto owner = live_owner();
|
||||
if (owner.is_object()) live_selected_match_ = owner.at("match_id").get<std::string>();
|
||||
live_reset_detail_ = live_reset_ticker_ = true;
|
||||
} else if (action == "live-tab") {
|
||||
if (id != "team" && id != "tactics" && id != "opponent" && id != "table" && id != "stats") return true;
|
||||
if (live_tab_ == id) return true;
|
||||
@@ -368,7 +367,7 @@ bool App::live_action(const std::string &action, Rml::Element *target) {
|
||||
live_coverage_ = id; live_reset_ticker_ = true;
|
||||
} else if (action == "live-match") {
|
||||
for (const auto &match : live_.fixture().at("matches")) if (match.at("id") == id) {
|
||||
live_selected_match_ = id; live_reset_ticker_ = true; break;
|
||||
live_selected_match_ = id; live_reset_ticker_ = true; live_follow_match(); break;
|
||||
}
|
||||
} else if (action == "live-match-prev" || action == "live-match-next") {
|
||||
const auto &matches = live_.fixture().at("matches");
|
||||
@@ -383,7 +382,15 @@ bool App::live_action(const std::string &action, Rml::Element *target) {
|
||||
(id == "interval" ? live_halt_interval_ : live_halt_behind_) ^= true;
|
||||
focus_after_render_ = target->GetId();
|
||||
} else if (action == "live-pause") {
|
||||
live_set_speed(live_.speed() ? 0 : 1); return true;
|
||||
focus_after_render_ = "live-pause";
|
||||
live_set_speed(live_.speed() ? 0 : live_resume_speed_ ? live_resume_speed_ : 2); return true;
|
||||
} else if (action == "live-speed-set") {
|
||||
try { const int step = std::stoi(id); if (step) live_resume_speed_ = 0; focus_after_render_ = "live-speed-" + std::to_string(std::clamp(step, 0, 4)); live_set_speed(step); } catch (const std::exception &) {}
|
||||
return true;
|
||||
} else if (action == "live-pick-out" || action == "live-pick-in") {
|
||||
if (live_dialog_ != "lineup") return true;
|
||||
auto &chosen = action == "live-pick-out" ? live_out_ : live_in_;
|
||||
chosen = chosen == id ? std::string() : std::string(id);
|
||||
} else if (action == "live-review" && live_.finished()) {
|
||||
postmatch_open();return true;
|
||||
} else if (action == "live-review-back") {
|
||||
@@ -400,9 +407,6 @@ bool App::live_action(const std::string &action, Rml::Element *target) {
|
||||
live_dialog_ = action == "live-intervene-lineup" ? "lineup" : "tactics";
|
||||
live_resume_speed_ = live_.speed(); live_.speed(0); live_last_tick_ = SDL_GetTicks64();
|
||||
live_out_.clear(); live_in_.clear();
|
||||
const auto rows = live_owner_rows(owner); const size_t count = live_.fixture().at("field_count");
|
||||
if (!rows.empty()) live_out_ = rows[0].at("id");
|
||||
if (rows.size() > count) live_in_ = rows[count].at("id");
|
||||
focus_after_render_ = "live-dialog-cancel";
|
||||
} else if (action == "live-dialog-cancel" || action == "live-dialog-apply") {
|
||||
live_dialog_close(action == "live-dialog-apply"); return true;
|
||||
@@ -478,8 +482,11 @@ bool App::live_event(Rml::Event &event) {
|
||||
}
|
||||
event.StopImmediatePropagation(); return true;
|
||||
}
|
||||
if (live_dialog_.empty() && key == Rml::Input::KI_P && !live_.finished()) {
|
||||
live_set_speed(live_.speed() ? 0 : 1); event.StopImmediatePropagation(); return true;
|
||||
if (live_dialog_.empty() && (key == Rml::Input::KI_P || key == Rml::Input::KI_SPACE) && !live_.finished()) {
|
||||
live_set_speed(live_.speed() ? 0 : 2); event.StopImmediatePropagation(); return true;
|
||||
}
|
||||
if (live_dialog_.empty() && key == Rml::Input::KI_RIGHT && !live_.finished()) {
|
||||
live_action("live-next", nullptr); event.StopImmediatePropagation(); return true;
|
||||
}
|
||||
if (speed_control && (key == Rml::Input::KI_HOME || key == Rml::Input::KI_END || key == Rml::Input::KI_UP || key == Rml::Input::KI_DOWN)) {
|
||||
live_set_speed(key == Rml::Input::KI_HOME ? 0 : key == Rml::Input::KI_END ? 4 : std::clamp(live_.speed() + (key == Rml::Input::KI_UP ? 1 : -1), 0, 4));
|
||||
@@ -488,6 +495,7 @@ bool App::live_event(Rml::Event &event) {
|
||||
}
|
||||
if (type == "click" && live_dialog_.empty()) for (auto *node = target; node && node != doc_; node = node->GetParentNode()) if (node->HasAttribute("data-live-match")) {
|
||||
live_selected_match_ = node->GetAttribute<Rml::String>("data-live-match", "");
|
||||
live_follow_match();
|
||||
if (live_coverage_ == "single") live_reset_ticker_ = true;
|
||||
refresh(); return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user