local ____lualib = require("lualib_bundle") local __TS__New = ____lualib.__TS__New local ____exports = __module.env local M__share_base_logger = __MODULE__.Import("share.base.logger", __module) local Logger = M__share_base_logger.Logger local M__framework_resource_resource_service = __MODULE__.Import("framework.resource.resource_service", __module) local CreateUEResourceService = M__framework_resource_resource_service.CreateUEResourceService local M__framework_storage_local_save = __MODULE__.Import("framework.storage.local_save", __module) local LocalSaveManager = M__framework_storage_local_save.LocalSaveManager local M__framework_storage_storage_backend = __MODULE__.Import("framework.storage.storage_backend", __module) local UEStorageBackend = M__framework_storage_storage_backend.UEStorageBackend local M__framework_ui_ui_delegate_bridge = __MODULE__.Import("framework.ui.ui_delegate_bridge", __module) local CreateUEUIDelegateBridge = M__framework_ui_ui_delegate_bridge.CreateUEUIDelegateBridge local M__framework_ui_ui_manager = __MODULE__.Import("framework.ui.ui_manager", __module) local UIManager = M__framework_ui_ui_manager.UIManager local M__game_setting_mini_settings_window = __MODULE__.Import("game.setting.mini_settings_window", __module) local MiniSettingsWindow = M__game_setting_mini_settings_window.MiniSettingsWindow local M__game_setting_setting_service = __MODULE__.Import("game.setting.setting_service", __module) local SettingService = M__game_setting_setting_service.SettingService local logger = Logger("Startup") --- 装配单个 GameInstanceContext 的全部首期框架服务(支持多 PIE 独立实例化): -- - LocalSaveManager(UE ULuaSaveGame + 跨 World 单调时钟 0.1s 合并写 + 退出 FlushAll) -- - SettingService(首期全局布尔设置键) -- - ResourceService(C++ ULuaResourceSubsystem:PIE Content/ 直读 + 发布包热更挂载扩展) -- - UIDelegateBridge(C++ ULuaUIEventSubsystem) -- - 默认 LocalPlayer(0) 的 UIManager function ____exports.AssembleGameInstanceServices(ctx) local storageBackend = __TS__New(UEStorageBackend) local saveManager = __TS__New(LocalSaveManager, storageBackend, ctx.scheduler) ctx:RegisterService("saveManager", saveManager) ctx:AddShutdownHook(function() saveManager:FlushAll() end) local settingService = __TS__New(SettingService, saveManager) ctx:RegisterService("setting", settingService) local resourceService = CreateUEResourceService(ctx) if resourceService ~= nil then ctx:RegisterService("resource", resourceService) end local uiDelegateBridge = CreateUEUIDelegateBridge(ctx) if uiDelegateBridge ~= nil then ctx:RegisterService("uiDelegateBridge", uiDelegateBridge) end local lp0 = ctx:GetOrCreateLocalPlayer(0) if resourceService ~= nil then lp0:RegisterService( "uiManager", __TS__New(UIManager, ctx, lp0, resourceService) ) end local ____logger_Info_2 = logger.Info local ____ctx_contextId_1 = ctx.contextId local ____temp_0 if resourceService ~= nil then ____temp_0 = resourceService:IsPackagedMode() else ____temp_0 = false end ____logger_Info_2(logger, "Framework services assembled", {contextId = ____ctx_contextId_1, packagedResourceMode = ____temp_0}) end function ____exports.GetPrimaryUIManager(ctx) local lp0 = ctx:GetOrCreateLocalPlayer(0) return lp0:GetService("uiManager") end function ____exports.OpenMiniSettings(ctx, onOpened) local uiMgr = ____exports.GetPrimaryUIManager(ctx) if uiMgr == nil then return nil end return uiMgr:ShowUI(MiniSettingsWindow, nil, onOpened) end function __module.UpdateImports() Logger = M__share_base_logger.Logger CreateUEResourceService = M__framework_resource_resource_service.CreateUEResourceService LocalSaveManager = M__framework_storage_local_save.LocalSaveManager UEStorageBackend = M__framework_storage_storage_backend.UEStorageBackend CreateUEUIDelegateBridge = M__framework_ui_ui_delegate_bridge.CreateUEUIDelegateBridge UIManager = M__framework_ui_ui_manager.UIManager MiniSettingsWindow = M__game_setting_mini_settings_window.MiniSettingsWindow SettingService = M__game_setting_setting_service.SettingService end