Port lineup and transfer market to the native Modern UI (by Codex)
This commit is contained in:
1 parent
ec1d804d08
commit
bf3f910437
33 files changed
+3339
-29
No files matched your search
@@ -131,6 +131,10 @@ void App::drag_event(Rml::Event &event) {
|
||||
}
|
||||
void App::ProcessEvent(Rml::Event &event) try {
|
||||
const auto type = event.GetType();
|
||||
// Native widgets can emit intermediate selected values while their options
|
||||
// are being constructed. Opening a squad menu must stay read-only.
|
||||
if (setting_menu_markup_ && (menu_ == "lineup" || menu_ == "transfer") &&
|
||||
(type == "change" || type == "input")) return;
|
||||
if (type == "keydown")
|
||||
keyboard_navigation_ = true;
|
||||
else if (type == "mousedown")
|
||||
@@ -150,7 +154,16 @@ void App::ProcessEvent(Rml::Event &event) try {
|
||||
if (n->GetId() == "native-ticket-layer")
|
||||
return;
|
||||
if (amount_event(event)) return;
|
||||
if ((menu_ == "lineup" || menu_ == "transfer") && (type == "change" || type == "input")) {
|
||||
if (auto *select = dynamic_cast<Rml::ElementFormControlSelect *>(event.GetTargetElement());
|
||||
select && select->IsSelectBoxVisible()) {
|
||||
pending_selects_.insert(select->GetId());
|
||||
dirty_ = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (popup_.empty() && amount_trigger_event(event)) return;
|
||||
if (popup_.empty() && report_detail_kind_.empty() && (lineup_event(event) || transfer_event(event))) return;
|
||||
if (popup_.empty() && contracts_event(event)) return;
|
||||
if (popup_.empty() && (advertising_event(event) || toto_event(event))) return;
|
||||
if (popup_.empty() && (bank_event(event) || finance_event(event))) return;
|
||||
@@ -396,7 +409,10 @@ void App::ProcessEvent(Rml::Event &event) try {
|
||||
controls[size_t(next)]->GetId().starts_with("report-club-") ||
|
||||
controls[size_t(next)]->GetId().starts_with("friendly-opponent-") ||
|
||||
controls[size_t(next)]->GetId().starts_with("alm-match-") ||
|
||||
controls[size_t(next)]->GetId().starts_with("contract-player-"))
|
||||
controls[size_t(next)]->GetId().starts_with("contract-player-") ||
|
||||
controls[size_t(next)]->GetId().starts_with("lineup-name-") ||
|
||||
controls[size_t(next)]->GetId().starts_with("lineup-detail-") ||
|
||||
controls[size_t(next)]->GetId().starts_with("lineup-bench-"))
|
||||
controls[size_t(next)]->ScrollIntoView(
|
||||
Rml::ScrollIntoViewOptions(Rml::ScrollAlignment::Nearest));
|
||||
event.StopImmediatePropagation();
|
||||
@@ -436,6 +452,7 @@ void App::ProcessEvent(Rml::Event &event) try {
|
||||
void App::dispatch(const std::string &action, Rml::Element *target) {
|
||||
const auto id =
|
||||
target ? target->GetAttribute<Rml::String>("data-id", "") : std::string();
|
||||
if (lineup_action(action, target) || transfer_action(action, target)) return;
|
||||
if (environment_action(action, target) || advertising_action(action, target) || toto_action(action, target)) return;
|
||||
if (amount_action(action, target) || bank_action(action, target) || finance_action(action, target) || contracts_action(action, target)) return;
|
||||
if (almanac_action(action, target) || planning_action(action, target) || indoor_action(action, target)) return;
|
||||
@@ -1049,7 +1066,7 @@ void App::dispatch(const std::string &action, Rml::Element *target) {
|
||||
}
|
||||
static const std::set<std::string> available = {
|
||||
"tables", "strengths", "camp", "settings",
|
||||
"save", "load", "training", "tactics", "calendar", "league", "other", "postpone", "friendlies", "indoor", "almanac", "bank", "balance", "contracts", "environment", "advertising", "toto"};
|
||||
"save", "load", "training", "tactics", "calendar", "league", "other", "postpone", "friendlies", "indoor", "almanac", "bank", "balance", "contracts", "environment", "advertising", "toto", "lineup", "transfer"};
|
||||
if (!available.contains(route)) {
|
||||
message("Diese native Ansicht wird im nächsten Menüpaket übertragen.");
|
||||
return;
|
||||
@@ -1438,6 +1455,8 @@ void App::script() {
|
||||
{"balance_future", balance_future_},
|
||||
{"advertising_view", {{"selected", advertising_selected_}, {"offer", advertising_offer_}}},
|
||||
{"toto_view", {{"column", toto_column_}, {"dialog", toto_dialog_}}},
|
||||
{"lineup_view", {{"pitch", lineup_pitch_}, {"data", lineup_data_}, {"page", lineup_page_}, {"side", lineup_side_}, {"selected", lineup_selected_}, {"drag", lineup_drag_}}},
|
||||
{"transfer_view", transfer_view_}, {"transfer_dialog", transfer_dialog_}, {"transfer_draft", transfer_draft_},
|
||||
{"contracts_view", {{"dialog", contracts_dialog_}, {"player", contracts_player_}, {"tab", contracts_tab_}, {"draft", contract_draft_}}},
|
||||
{"amount_editor", amount_ ? Json{{"title", amount_->request.title}, {"raw", amount_->raw}, {"review", amount_->review}, {"error", amount_error()}} : Json()},
|
||||
{"source_revision", source_ ? Json(snap().revision) : Json()},
|
||||
|
||||
Reference in new issue
Block a user