Complete Modern season preparation with persistent draw progress (by Codex)
This commit is contained in:
1 parent
967520190d
commit
e81ecf95f2
27 files changed
+1432
-208
No files matched your search
+33
-44
@@ -11,6 +11,7 @@
|
||||
#include "modern/ui/demo_advertising.hpp"
|
||||
#include "modern/ui/demo_toto.hpp"
|
||||
#include "modern/ui/demo_reports.hpp"
|
||||
#include "modern/ui/demo_opening.hpp"
|
||||
#include "modern/ui/demo_sports.hpp"
|
||||
#include "modern/ui/demo_lineup.hpp"
|
||||
#include "modern/ui/demo_transfer.hpp"
|
||||
@@ -428,10 +429,10 @@ class App final : public Rml::EventListener {
|
||||
bool context_open_ = false, context_dirty_ = false;
|
||||
std::string context_id_;
|
||||
int context_x_ = 0, context_y_ = 0;
|
||||
int opening_page_ = 0, draw_revealed_ = 0;
|
||||
uint64_t opening_due_ = 0;
|
||||
bool opening_io_blocked_ = false;
|
||||
int last_tactic_ = 0;
|
||||
bool draw_playing_ = true;
|
||||
uint64_t draw_at_ = 0;
|
||||
|
||||
#include "modern/ui/settings_state.inc"
|
||||
#include "modern/ui/widgets_state.inc"
|
||||
#include "modern/ui/files_state.inc"
|
||||
@@ -589,6 +590,12 @@ class App final : public Rml::EventListener {
|
||||
return &m;
|
||||
return nullptr;
|
||||
}
|
||||
void bind_world(std::shared_ptr<const Catalog> next) {
|
||||
renderer_.world(std::move(next));
|
||||
files_default_key_.clear();
|
||||
files_default_picture_ = Picture();
|
||||
files_default_pending_ = false;
|
||||
}
|
||||
void load_world(const fs::path &file) {
|
||||
auto next = Catalog::open(file);
|
||||
auto demo = std::make_unique<DemoSource>(next);
|
||||
@@ -599,9 +606,11 @@ class App final : public Rml::EventListener {
|
||||
reset_settings();
|
||||
reset_files();
|
||||
ticket_.reset();
|
||||
renderer_.world(next);
|
||||
bind_world(next);
|
||||
world_ = std::move(next);
|
||||
source_ = std::move(demo);
|
||||
opening_due_ = 0;
|
||||
opening_io_blocked_ = false;
|
||||
lineup_drag_ = Json(); lineup_drag_world_.reset(); lineup_selected_.clear(); lineup_ignore_click_ = false;
|
||||
lineup_pitch_ = true; lineup_data_ = lineup_page_ = 0; lineup_side_ = "formations";
|
||||
transfer_view_ = Json::object(); transfer_draft_ = transfer_search_draft_ = Json();
|
||||
@@ -756,6 +765,16 @@ class App final : public Rml::EventListener {
|
||||
std::string render_newgame();
|
||||
std::string render_manager();
|
||||
std::string render_opening();
|
||||
fs::path opening_progress_path(const Catalog &) const;
|
||||
void opening_write(const Catalog &, const Json &, const Json &);
|
||||
void opening_restore_startup();
|
||||
bool opening_pending() const;
|
||||
bool opening_change(const std::string &);
|
||||
bool opening_action(const std::string &, Rml::Element *);
|
||||
bool opening_event(Rml::Event &);
|
||||
void opening_tick();
|
||||
void handle_event(SDL_Event &);
|
||||
void pump_events();
|
||||
std::string render_menu(const std::string &);
|
||||
void dispatch(const std::string &, Rml::Element *);
|
||||
void change(Rml::Element *);
|
||||
@@ -810,6 +829,11 @@ class App final : public Rml::EventListener {
|
||||
needs_render_ = true;
|
||||
}
|
||||
void render() {
|
||||
if (scene_ == "desktop" && !files_capturing_ && opening_pending()) {
|
||||
scene_ = "opening";
|
||||
menu_.clear();
|
||||
opening_due_ = 0;
|
||||
}
|
||||
news_before_render();
|
||||
fixture_half_width_ = -1.f;
|
||||
almanac_list_width_ = -1.f;
|
||||
@@ -1238,6 +1262,7 @@ public:
|
||||
// A capture/CLI override is visual only and never edits a career.
|
||||
ui_preferences_["theme"]=theme_;
|
||||
}
|
||||
opening_restore_startup();
|
||||
if (scene_ == "manager" && selections_["manager-name"].empty())
|
||||
selections_["manager-name"] = "Alex Berger";
|
||||
doc_->Show();
|
||||
@@ -1278,15 +1303,7 @@ public:
|
||||
}
|
||||
while (!closed_) {
|
||||
front_poll();
|
||||
if (scene_ == "opening" && opening_page_ == 3 && draw_revealed_ < 64 &&
|
||||
draw_playing_ && SDL_GetTicks64() >= draw_at_ &&
|
||||
(SDL_GetWindowFlags(video_.window) & SDL_WINDOW_INPUT_FOCUS)) {
|
||||
++draw_revealed_;
|
||||
draw_at_ = SDL_GetTicks64() + 900;
|
||||
if (draw_revealed_ == 64)
|
||||
opening_page_ = 4;
|
||||
refresh();
|
||||
}
|
||||
opening_tick();
|
||||
if (needs_render_ || dirty_)
|
||||
frame();
|
||||
SDL_Event event;
|
||||
@@ -1294,37 +1311,7 @@ public:
|
||||
int(std::clamp(context_->GetNextUpdateDelay(), 0.0, .2) * 1000);
|
||||
bool got = SDL_WaitEventTimeout(&event, timeout) != 0;
|
||||
while (got) {
|
||||
if (event.type == SDL_QUIT) {
|
||||
if(front_busy_){front_feedback_="Bitte den laufenden Import abwarten.";dirty_=true;}
|
||||
else if (source_ && scene_ != "main" && scene_ != "mods") {
|
||||
quit_closes_app_=true;
|
||||
dispatch("context-quit", nullptr);
|
||||
} else
|
||||
closed_ = true;
|
||||
} else {
|
||||
if (event.type == SDL_WINDOWEVENT) {
|
||||
if(event.window.event==SDL_WINDOWEVENT_FOCUS_LOST)desktop_cancel_drag();
|
||||
resize();
|
||||
}
|
||||
int w, h, pw, ph;
|
||||
SDL_GetWindowSize(video_.window, &w, &h);
|
||||
video_.drawable_size(pw, ph);
|
||||
if (w > 0 && h > 0) {
|
||||
if (event.type == SDL_MOUSEMOTION) {
|
||||
event.motion.x = int(double(event.motion.x) * pw / w);
|
||||
event.motion.y = int(double(event.motion.y) * ph / h);
|
||||
}
|
||||
if (event.type == SDL_MOUSEBUTTONDOWN ||
|
||||
event.type == SDL_MOUSEBUTTONUP) {
|
||||
event.button.x = int(double(event.button.x) * pw / w);
|
||||
event.button.y = int(double(event.button.y) * ph / h);
|
||||
context_->ProcessMouseMove(event.button.x, event.button.y,
|
||||
RmlSDL::GetKeyModifierState());
|
||||
}
|
||||
}
|
||||
RmlSDL::InputEventHandler(context_, video_.window, event);
|
||||
dirty_ = true;
|
||||
}
|
||||
handle_event(event);
|
||||
got = SDL_PollEvent(&event) != 0;
|
||||
}
|
||||
if (context_->GetNextUpdateDelay() <= 0)
|
||||
@@ -1335,6 +1322,8 @@ public:
|
||||
};
|
||||
#include "modern/ui/entry_controls.inc"
|
||||
#include "modern/ui/entry_screens.inc"
|
||||
#include "modern/ui/entry_opening_controls.inc"
|
||||
#include "modern/ui/entry_opening_screens.inc"
|
||||
#include "modern/ui/controls.inc"
|
||||
#include "modern/ui/widgets_screens.inc"
|
||||
#include "modern/ui/widgets_controls.inc"
|
||||
|
||||
Reference in new issue
Block a user