Bind native desk and training camps to Modern OBS careers (by Codex)
This commit is contained in:
1 parent
1fb6499b15
commit
85a1fe5a95
19 files changed
+733
-46
No files matched your search
+30
-3
@@ -5,6 +5,7 @@
|
||||
#include "launch/rml_path.hpp"
|
||||
#include "launch/rml_video.hpp"
|
||||
#include "modern/ui/controls.hpp"
|
||||
#include "modern/ui/engine_bridge.hpp"
|
||||
#include "modern/ui/live_match_info.hpp"
|
||||
#include "modern/ui/script_locator.hpp"
|
||||
#include "modern/ui/select_menu.hpp"
|
||||
@@ -454,6 +455,7 @@ class App final : public Rml::EventListener {
|
||||
bool opening_io_blocked_ = false;
|
||||
int last_tactic_ = 0;
|
||||
|
||||
#include "modern/ui/engine_state.inc"
|
||||
#include "modern/ui/settings_state.inc"
|
||||
#include "modern/ui/widgets_state.inc"
|
||||
#include "modern/ui/files_state.inc"
|
||||
@@ -681,6 +683,7 @@ class App final : public Rml::EventListener {
|
||||
std::string main_menu();
|
||||
std::string mods_page();
|
||||
std::string render_desktop();
|
||||
std::string desktop_button(const std::string &, const Json &, const std::string &, bool enabled = true);
|
||||
void init_desktop();
|
||||
std::string widget(const std::string &, const Json &);
|
||||
std::string render_reports(const std::string &);
|
||||
@@ -879,6 +882,7 @@ class App final : public Rml::EventListener {
|
||||
}
|
||||
}
|
||||
void render() {
|
||||
if (engine_mode_) { engine_render(); return; }
|
||||
if (select_menu_) select_menu_->before_render();
|
||||
if (source_ && scene_=="desktop" && snap().state.value("career",Json::object()).value("ended",false)){scene_="main";menu_.clear();}
|
||||
if (scene_ == "desktop" && !files_capturing_ && opening_pending()) {
|
||||
@@ -1094,6 +1098,7 @@ class App final : public Rml::EventListener {
|
||||
return true;
|
||||
}
|
||||
void frame() {
|
||||
if (engine_mode_) { engine_frame(); return; }
|
||||
front_poll();
|
||||
flush_selects();
|
||||
if (ticket_)
|
||||
@@ -1336,9 +1341,10 @@ public:
|
||||
if (theme_ != "midnight" && theme_ != "silver" && theme_ != "matchday")
|
||||
throw editor::Error("Unbekanntes Modern-Theme.");
|
||||
front_external_override_=!config_.world.empty();
|
||||
collect_mods();
|
||||
engine_mode_ = !config_.engine_save.empty();
|
||||
if (!engine_mode_) collect_mods();
|
||||
if(config_.world.empty() && config_.scene=="mods")scene_="mods";
|
||||
if (!config_.world.empty()) {
|
||||
if (!config_.world.empty() && !engine_mode_) {
|
||||
active_mod_.clear();
|
||||
load_world(config_.world);
|
||||
scene_ = config_.scene;
|
||||
@@ -1360,7 +1366,23 @@ public:
|
||||
// A capture/CLI override is visual only and never edits a career.
|
||||
ui_preferences_["theme"]=theme_;
|
||||
}
|
||||
opening_restore_startup();
|
||||
if (engine_mode_) {
|
||||
if (config_.world.empty() || !config_.state.empty()) throw editor::Error("--ui-career benötigt --mod und unterstützt keine UI-Demostände.");
|
||||
scene_ = "engine"; menu_ = config_.scene == "camp" ? "camp" : "";
|
||||
const auto file = config_.world, save = config_.engine_save;
|
||||
engine_start("Spielstand wird geladen …", [file, save] {
|
||||
auto link = EngineBridge::open(file, save);
|
||||
auto catalog = Catalog::open(file);
|
||||
auto bundle = link->snapshot();
|
||||
const auto &meta = bundle.at("desktop").at("meta");
|
||||
std::string data_revision;
|
||||
for (const auto *extension : {"x-diamond-modern", "x-world"})
|
||||
if (catalog->manifest().contains(extension)) data_revision = catalog->manifest().at(extension).value("data_revision", "");
|
||||
if (catalog->manifest().at("id").get<std::string>() != meta.at("worldId").get<std::string>() || data_revision != meta.at("worldRevision").get<std::string>())
|
||||
throw editor::Error("Bildkatalog und Engine verwenden unterschiedliche Weltdaten.");
|
||||
return EngineReply{link, std::move(bundle), Json::object(), std::move(catalog)};
|
||||
});
|
||||
} else opening_restore_startup();
|
||||
if (scene_ == "manager" && selections_["manager-name"].empty())
|
||||
selections_["manager-name"] = "Alex Berger";
|
||||
doc_->Show();
|
||||
@@ -1375,6 +1397,8 @@ public:
|
||||
}
|
||||
}
|
||||
void shutdown() {
|
||||
if (engine_job_.valid()) engine_job_.wait();
|
||||
engine_link_.reset();
|
||||
select_capture_.handler = {};
|
||||
if (doc_)
|
||||
for (const char *event : select_capture_events_)
|
||||
@@ -1407,6 +1431,7 @@ public:
|
||||
}
|
||||
while (!closed_) {
|
||||
front_poll();
|
||||
if (engine_mode_) engine_poll();
|
||||
opening_tick();
|
||||
live_tick();
|
||||
if (needs_render_ || dirty_)
|
||||
@@ -1485,6 +1510,8 @@ public:
|
||||
#include "modern/ui/live_controls.inc"
|
||||
#include "modern/ui/postmatch_screens.inc"
|
||||
#include "modern/ui/postmatch_controls.inc"
|
||||
#include "modern/ui/engine_screens.inc"
|
||||
#include "modern/ui/engine_controls.inc"
|
||||
} // namespace
|
||||
bool is_modern_world(const fs::path &file) {
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user