Bind the kickoff of the Modern desk to the engine and show its recording in the ticker
The kickoff button sends session.advance; the engine's recording of the played matchday is shaped for the live ticker (phases, per-match tables, the desk manager's squad). A contract running out on the way asks the manager to extend at the player's demand or to release him. The UI script driver accepts optional clicks, and modern_live_dump writes the engine's recording for inspection. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
9e92d07b03
commit
7c0e66affe
15 files changed
+447
-30
No files matched your search
@@ -24,11 +24,37 @@ bool App::live_open() {
|
||||
focus_after_render_ = "live-next";
|
||||
refresh(); return true;
|
||||
}
|
||||
bool App::engine_live_open(const Json &recording) {
|
||||
const auto fixture = engine_live_fixture(recording, engine_data_);
|
||||
if (!fixture.value("ok", false) || !live_.open(fixture, "")) {
|
||||
engine_notice_ = "Spieltag gespielt · Der Ticker kann diese Aufzeichnung nicht zeigen (" +
|
||||
fixture.value("error", std::string("invalid_live_fixture")) + ").";
|
||||
return false;
|
||||
}
|
||||
try { live_.owner(engine_data_.at("desktop").at("meta").at("scope").at("managerId").get<std::string>()); }
|
||||
catch (const std::exception &) {}
|
||||
live_source_ = nullptr; live_world_ = world_;
|
||||
postmatch_data_=Json::object();postmatch_scrolls_=Json::object();postmatch_playing_=false;
|
||||
live_drafts_ = Json::object(); live_dialog_.clear(); live_dialog_draft_ = Json();
|
||||
live_coverage_ = "all"; live_filter_ = "all"; live_tab_ = "team";
|
||||
live_selected_match_ = fixture.at("matches").front().at("id");
|
||||
for (const auto &owner : fixture.at("owners")) if (owner.at("id") == live_.owner()) live_selected_match_ = owner.at("match_id");
|
||||
live_ticker_scroll_ = live_detail_scroll_ = 0;
|
||||
live_reset_ticker_ = live_reset_detail_ = true;
|
||||
live_feedback_.clear(); live_resume_speed_ = 0;
|
||||
live_review_ = false; live_speed_dragging_ = false;
|
||||
if (scene_ != "live") live_return_scene_ = scene_;
|
||||
scene_ = "live"; menu_.clear();
|
||||
live_.speed(2); live_last_tick_ = SDL_GetTicks64();
|
||||
focus_after_render_ = "live-pause";
|
||||
return true;
|
||||
}
|
||||
void App::live_close() {
|
||||
live_review_=false;postmatch_playing_=false;
|
||||
live_.speed(0); live_dialog_.clear(); live_dialog_draft_ = Json();
|
||||
live_resume_speed_ = 0; live_speed_dragging_ = false;
|
||||
scene_ = "desktop"; menu_.clear(); focus_after_render_ = "object-app-kickoff"; refresh();
|
||||
if (engine_mode_) { scene_ = live_return_scene_; live_.close(); } else scene_ = "desktop";
|
||||
menu_.clear(); focus_after_render_ = "object-app-kickoff"; refresh();
|
||||
}
|
||||
void App::live_set_speed(int value) {
|
||||
if (!live_.speed(value)) return;
|
||||
@@ -43,9 +69,10 @@ void App::live_set_speed(int value) {
|
||||
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 std::string phase = live_.finished() ? "Beendet" : frame.at("phase") == "interval" ? "Halbzeit" : value ? "Aufzeichnung läuft" : "Gemeinsam pausiert";
|
||||
const bool recorded = live_.fixture().at("source") == "engine-recording";
|
||||
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>()) + "′ · keine Spielwertänderung"));
|
||||
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;
|
||||
}
|
||||
void App::live_tick() {
|
||||
@@ -53,9 +80,9 @@ void App::live_tick() {
|
||||
const auto now = SDL_GetTicks64(), elapsed = now - live_last_tick_; live_last_tick_ = now;
|
||||
if(live_review_){postmatch_tick(now);return;}
|
||||
if (!popup_.empty() || !live_dialog_.empty() || live_speed_dragging_ || live_review_) return;
|
||||
const auto current = source_ ? source_->snapshot() : Snapshot();
|
||||
if (!source_ || source_.get() != live_source_ || current.world != live_world_ ||
|
||||
current.revision != live_.fixture().at("source_revision").get<uint64_t>()) {
|
||||
const auto current = source_ && !engine_mode_ ? source_->snapshot() : Snapshot();
|
||||
if (!engine_mode_ && (!source_ || source_.get() != live_source_ || current.world != live_world_ ||
|
||||
current.revision != live_.fixture().at("source_revision").get<uint64_t>())) {
|
||||
live_.speed(0);
|
||||
if (live_feedback_ != "Die Quelle hat sich geändert. Diese Aufzeichnung bleibt pausiert; öffne Anstoß erneut.") { live_feedback_ = "Die Quelle hat sich geändert. Diese Aufzeichnung bleibt pausiert; öffne Anstoß erneut."; needs_render_ = true; }
|
||||
return;
|
||||
@@ -120,11 +147,12 @@ bool App::live_action(const std::string &action, Rml::Element *target) {
|
||||
} else if (action == "live-pause") {
|
||||
live_set_speed(live_.speed() ? 0 : 1); return true;
|
||||
} else if (action == "live-review" && live_.finished()) {
|
||||
postmatch_open();return true;
|
||||
if (live_.fixture().at("source") == "engine-recording") live_close(); else postmatch_open();
|
||||
return true;
|
||||
} else if (action == "live-review-back") {
|
||||
postmatch_action("postmatch-ticker",target);return true;
|
||||
} else if (action == "live-intervene-lineup" || action == "live-intervene-tactics") {
|
||||
if (live_.finished()) return true;
|
||||
if (live_.finished() || live_.fixture().at("source") == "engine-recording") return true;
|
||||
const auto owner = live_owner(); live_dialog_draft_ = live_owner_state(owner);
|
||||
live_dialog_ = action == "live-intervene-lineup" ? "lineup" : "tactics";
|
||||
live_resume_speed_ = live_.speed(); live_.speed(0); live_last_tick_ = SDL_GetTicks64();
|
||||
|
||||
Reference in new issue
Block a user