Bind confirmed bank and ticket actions to real careers (by Codex)

This commit is contained in:
Codex committed 2026-10-28 11:04:11 +01:00
1 parent f75e0f8e49
commit dcf42f2da7
23 files changed
+535 -56

No files matched your search

+34 -2
View File
@@ -12,6 +12,16 @@ void App::engine_poll() {
try {
auto result = engine_job_.get();
validate_engine_desk(result.bundle);
if (result.response.value("messageType", "") == "credit_preview") {
const auto &read = result.response.at("read");
if (read.value("messageType", "") == "error") engine_notice_ = "Kreditvorschau abgewiesen: " + read.value("code", "unknown_error");
else {
(void)engine_credit_projection(result.bundle, read);
engine_credit_ = read; engine_credit_edits_ = result.response.at("edits");
engine_notice_ = "Kreditvorschau berechnet · Noch keine Buchung.";
}
refresh(); return;
}
engine_fresh_ = true;
if (result.catalog) { world_ = std::move(result.catalog); bind_world(world_); }
engine_link_ = std::move(result.connection); engine_data_ = std::move(result.bundle);
@@ -25,6 +35,8 @@ void App::engine_poll() {
} else if (engine_response_.value("messageType", "") == "saved") {
engine_dirty_ = false; engine_notice_ = "Spielstand als neue OBS-Datei gespeichert.";
} else engine_notice_ = "Spielstand geladen · Weitere Menüs werden schrittweise angebunden.";
engine_credit_ = engine_data_.value("credit", Json()); engine_credit_edits_ = Json::array();
engine_ticket_bind();
engine_sports_reset();
const auto &f = engine_data_.at("camps").at("data").at("focus");
engine_focus_ = {{"condition", f.at("condition")}, {"technique", f.at("technique")}, {"play", f.at("play")}};
@@ -37,16 +49,25 @@ void App::engine_frame() {
engine_poll();
if (needs_render_) engine_render();
engine_sports_update();
if (ticket_) ticket_->update();
render_popup(); context_->Update();
if (center_selects(*doc_)) context_->Update();
if (menu_ == "lineup" && lineup_roster_scroll_) {
if (auto *roster = element("lineup-roster-scroll")) roster->SetScrollTop(*lineup_roster_scroll_);
lineup_roster_scroll_.reset();
}
if (popup_.empty() && !focus_after_render_.empty()) {
if (!engine_busy_ && popup_.empty() && !focus_after_render_.empty()) {
if (auto *node = element(focus_after_render_)) node->Focus(keyboard_navigation_);
focus_after_render_.clear();
}
if (amount_select_all_) {
if (auto *input = dynamic_cast<Rml::ElementFormControlInput *>(element("calculator-value"))) input->Select();
amount_select_all_ = false;
}
if (amount_caret_end_) {
if (auto *input = dynamic_cast<Rml::ElementFormControlInput *>(element("calculator-value"))) input->SetSelectionRange(int(input->GetValue().size()), int(input->GetValue().size()));
amount_caret_end_ = false;
}
renderer_.Clear(); renderer_.BeginFrame(); context_->Render(); renderer_.EndFrame(); video_.present(); dirty_ = false;
}
void App::engine_save() {
@@ -72,6 +93,11 @@ void App::engine_event(Rml::Event &event) {
const auto type = event.GetType(); auto *target = event.GetTargetElement();
if (type == "keydown") keyboard_navigation_ = true;
if (type == "mousedown") keyboard_navigation_ = false;
for (auto *node = target; node && node != doc_; node = node->GetParentNode())
if (node->GetId() == "native-ticket-layer") return; // owned by the compact control
if (ticket_ && ticket_->is_open()) return;
if (amount_event(event)) return;
if (!engine_busy_ && bank_event(event)) return;
if (engine_sports_event(event)) return;
Rml::ElementFormControl *range = nullptr;
for (auto *node = target; node && node != doc_; node = node->GetParentNode())
@@ -134,9 +160,15 @@ void App::engine_event(Rml::Event &event) {
if (action == "popup-confirm") { auto callback = std::move(confirm_); popup_.clear(); dirty_ = true; if (callback) callback(); }
return;
}
if (bank_action(action, node)) return;
if (engine_sports_action(action, id, node)) return;
if (engine_lineup_action(action, id, node)) return;
if (action == "close") { menu_.clear(); refresh(); }
else if (action == "engine-ticket" && engine_fresh_) {
const auto price = engine_ticket_projection(engine_data_);
ticket_->open(node, device_ratio_, price.at("min"), price.at("max")); dirty_ = true;
}
else if (action == "engine-open" && id == "bank") { bank_view_ = "entrance"; bank_hint_.clear(); menu_ = "bank"; refresh(); }
else if (action == "engine-open" && id == "save") engine_save();
else if (action == "engine-open" && (id == "training" || id == "tactics")) { engine_sports_reset(); menu_ = id; refresh(); }
else if (action == "engine-open" && id == "lineup") { menu_ = "lineup"; lineup_selected_.clear(); lineup_reset_scroll_ = true; refresh(); }
@@ -157,5 +189,5 @@ void App::engine_event(Rml::Event &event) {
}
Json App::engine_snapshot() const {
return {{"mode", engine_mode_}, {"busy", engine_busy_}, {"dirty", engine_dirty_}, {"fresh", engine_fresh_}, {"bundle", engine_data_},
{"response", engine_response_}, {"training_draft", engine_training_draft_}, {"tactics_draft", engine_tactics_draft_}, {"player_profile", engine_player_}, {"lineup_selected", lineup_selected_}, {"focus", engine_focus_}, {"selected_camp", engine_camp_}, {"notice", engine_notice_}};
{"response", engine_response_}, {"credit_preview", engine_credit_}, {"credit_edits", engine_credit_edits_}, {"training_draft", engine_training_draft_}, {"tactics_draft", engine_tactics_draft_}, {"player_profile", engine_player_}, {"lineup_selected", lineup_selected_}, {"focus", engine_focus_}, {"selected_camp", engine_camp_}, {"notice", engine_notice_}};
}