local ____exports = __module.env local M__framework_context_game_context = __MODULE__.Import("framework.context.game_context", __module) local GetGameInstanceContext = M__framework_context_game_context.GetGameInstanceContext local M__game_startup = __MODULE__.Import("game.startup", __module) local OpenMiniSettings = M__game_startup.OpenMiniSettings --- PIE / 启动地图玩家入口:绑定 LocalPlayer(0) 的 PlayerController 并打开首期最小设置窗口。 function ____exports.OnBeginPlay(pc) local world = pc:GetWorld() local gi = UE.UGameplayStatics.GetGameInstance(pc) if gi == nil then return end local ctx = GetGameInstanceContext(gi) if ctx == nil then return end if world ~= nil and ctx:GetWorldContext().world ~= world then ctx:OnWorldCleanup(world) end ctx:GetOrCreateLocalPlayer(0, pc) OpenMiniSettings(ctx) end function ____exports.OnEndPlay(pc, _endPlayReason) local gi = UE.UGameplayStatics.GetGameInstance(pc) if gi == nil then return end local ctx = GetGameInstanceContext(gi) if ctx == nil then return end local lp = ctx:GetOrCreateLocalPlayer(0) if lp.playerController == pc then lp.playerController = nil end end function __module.UpdateImports() GetGameInstanceContext = M__framework_context_game_context.GetGameInstanceContext OpenMiniSettings = M__game_startup.OpenMiniSettings end