Connect Almanac UI to revision-bound career history (by Codex)
This commit is contained in:
1 parent
4b6c18f654
commit
959154c3c0
18 files changed
+405
-44
No files matched your search
@@ -12,6 +12,7 @@ void App::engine_poll() {
|
||||
try {
|
||||
auto result = engine_job_.get();
|
||||
validate_engine_desk(result.bundle);
|
||||
if(result.response.value("messageType","")=="almanac_preview"){engine_almanac_poll(result);refresh();return;}
|
||||
if (result.response.value("messageType", "") == "friendly_preview") {
|
||||
const auto &read = result.response.at("read");
|
||||
if (read.value("messageType", "") == "error") {
|
||||
@@ -52,6 +53,7 @@ void App::engine_poll() {
|
||||
} else engine_notice_ = "Spielstand geladen · Weitere Menüs werden schrittweise angebunden.";
|
||||
if (engine_response_.value("messageType", "") == "command_result") { advertising_selected_ = -1; advertising_offer_ = 0; }
|
||||
engine_credit_ = engine_data_.value("credit", Json()); engine_credit_edits_ = Json::array();
|
||||
engine_almanac_sync();
|
||||
engine_ticket_bind();
|
||||
engine_contracts_poll();
|
||||
engine_calendar_sync();
|
||||
@@ -71,6 +73,7 @@ void App::engine_frame() {
|
||||
engine_sports_update();
|
||||
if (ticket_) ticket_->update();
|
||||
render_popup(); context_->Update();
|
||||
if(almanac_layout_update())context_->Update();
|
||||
if (rendered && menu_ == "friendlies") if (auto *list = element("friendly-opponents")) list->SetScrollTop(engine_friendly_scroll_);
|
||||
if (menu_ == "contracts" && engine_contract_scroll_) {
|
||||
if (auto *roster = element("contracts-roster-scroll")) roster->SetScrollTop(*engine_contract_scroll_);
|
||||
@@ -82,7 +85,13 @@ void App::engine_frame() {
|
||||
lineup_roster_scroll_.reset();
|
||||
}
|
||||
if (!engine_busy_ && popup_.empty() && !focus_after_render_.empty()) {
|
||||
if (auto *node = element(focus_after_render_)) node->Focus(keyboard_navigation_);
|
||||
if (auto *node = element(focus_after_render_)) {
|
||||
node->Focus(keyboard_navigation_);
|
||||
if(menu_=="almanac"&&node->GetId().starts_with("alm-match-")) {
|
||||
node->ScrollIntoView(Rml::ScrollIntoViewOptions(Rml::ScrollAlignment::Nearest));
|
||||
if(auto *list=element("alm-day-list"))list->SetScrollLeft(0);
|
||||
}
|
||||
}
|
||||
focus_after_render_.clear();
|
||||
}
|
||||
if (amount_select_all_) {
|
||||
@@ -126,7 +135,7 @@ void App::engine_event(Rml::Event &event) {
|
||||
if (!engine_busy_ && advertising_event(event)) return;
|
||||
if (!engine_busy_ && popup_.empty() && contracts_event(event)) return;
|
||||
if (!engine_busy_ && popup_.empty() && engine_friendly_event(event)) return;
|
||||
if (!engine_busy_ && planning_dialog_.empty() && popup_.empty() && menu_ == "friendlies" && report_picker_event(event)) return;
|
||||
if (!engine_busy_ && planning_dialog_.empty() && popup_.empty() && (menu_ == "friendlies" || menu_ == "almanac") && report_picker_event(event)) return;
|
||||
if (engine_sports_event(event)) return;
|
||||
Rml::ElementFormControl *range = nullptr;
|
||||
for (auto *node = target; node && node != doc_; node = node->GetParentNode())
|
||||
@@ -151,8 +160,10 @@ void App::engine_event(Rml::Event &event) {
|
||||
}
|
||||
}
|
||||
if (type == "keydown" && event.GetParameter<int>("key_identifier", 0) == Rml::Input::KI_ESCAPE) {
|
||||
if (menu_ == "almanac" && engine_busy_) { event.StopImmediatePropagation(); return; }
|
||||
if (!popup_.empty()) { popup_.clear(); confirm_ = {}; dirty_ = true; }
|
||||
else if (!engine_busy_ && !engine_player_.empty()) { focus_after_render_ = "lineup-detail-" + engine_player_ + "-0"; engine_player_.clear(); refresh(); }
|
||||
else if (!engine_busy_ && menu_ == "almanac") engine_almanac_action("alm-back",nullptr);
|
||||
else if (!engine_busy_ && !menu_.empty()) { if (menu_ == "training" || menu_ == "tactics") engine_sports_reset(); menu_.clear(); refresh(); }
|
||||
else engine_quit();
|
||||
event.StopImmediatePropagation(); return;
|
||||
@@ -165,7 +176,12 @@ void App::engine_event(Rml::Event &event) {
|
||||
if (!controls.empty()) {
|
||||
const auto found = std::find(controls.begin(), controls.end(), context_->GetFocusElement());
|
||||
const int index = found == controls.end() ? -1 : int(found - controls.begin());
|
||||
controls[size_t((index + int(controls.size()) + (event.GetParameter<int>("shift_key", 0) ? -1 : 1)) % int(controls.size()))]->Focus(true);
|
||||
auto *next=controls[size_t((index + int(controls.size()) + (event.GetParameter<int>("shift_key", 0) ? -1 : 1)) % int(controls.size()))];
|
||||
next->Focus(true);
|
||||
if(menu_=="almanac"&&next->GetId().starts_with("alm-match-")) {
|
||||
next->ScrollIntoView(Rml::ScrollIntoViewOptions(Rml::ScrollAlignment::Nearest));
|
||||
if(auto *list=element("alm-day-list"))list->SetScrollLeft(0);
|
||||
}
|
||||
}
|
||||
event.StopImmediatePropagation(); return;
|
||||
}
|
||||
@@ -189,8 +205,9 @@ 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 (almanac_action(action,node)) return;
|
||||
if (engine_friendly_action(action, node)) return;
|
||||
if (menu_ == "friendlies" && report_picker_action(action,node)) return;
|
||||
if ((menu_ == "friendlies" || menu_ == "almanac") && report_picker_action(action,node)) return;
|
||||
if (engine_calendar_action(action, node)) return;
|
||||
if (contracts_action(action, node)) return;
|
||||
if (environment_action(action, node)) return;
|
||||
@@ -204,6 +221,7 @@ void App::engine_event(Rml::Event &event) {
|
||||
ticket_->open(node, device_ratio_, price.at("min"), price.at("max")); dirty_ = true;
|
||||
}
|
||||
else if (action == "engine-open" && (id == "environment" || id == "advertising")) { menu_ = id; advertising_selected_ = -1; advertising_offer_ = 0; refresh(); }
|
||||
else if (action == "engine-open" && id == "almanac") { menu_=id;engine_almanac_sync();engine_almanac_load({{"kind","index"}}); }
|
||||
else if (action == "engine-open" && id == "friendlies") { menu_ = id; planning_dialog_.clear(); engine_friendly_sync(); refresh(); }
|
||||
else if (action == "engine-open" && (id == "calendar" || id == "postpone")) { menu_ = id; engine_move_id_.clear(); engine_calendar_sync(); refresh(); }
|
||||
else if (action == "engine-open" && id == "contracts") { menu_ = id; engine_contracts_clear(false); contracts_player_.clear(); engine_contract_scroll_ = 0.f; refresh(); }
|
||||
@@ -228,5 +246,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_}, {"friendly_quote", engine_friendly_read_}, {"friendly_league", engine_friendly_league_}, {"friendly_opponent", engine_friendly_opponent_}, {"friendly_date", engine_friendly_date_}, {"friendly_home", engine_friendly_home_}, {"friendly_stage", engine_friendly_stage_}, {"friendly_month", engine_friendly_month_}, {"calendar_day", engine_calendar_day_}, {"move_id", engine_move_id_}, {"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_}};
|
||||
{"response", engine_response_}, {"almanac_cache",engine_almanac_cache_}, {"almanac_context",engine_almanac_context_}, {"friendly_quote", engine_friendly_read_}, {"friendly_league", engine_friendly_league_}, {"friendly_opponent", engine_friendly_opponent_}, {"friendly_date", engine_friendly_date_}, {"friendly_home", engine_friendly_home_}, {"friendly_stage", engine_friendly_stage_}, {"friendly_month", engine_friendly_month_}, {"calendar_day", engine_calendar_day_}, {"move_id", engine_move_id_}, {"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_}};
|
||||
}
|
||||
Reference in new issue
Block a user