多轮审查和修复

This commit is contained in:
2026-05-12 15:34:08 +08:00
parent f55d2a57c3
commit ebbbb7332e
805 changed files with 838724 additions and 1905 deletions

View File

@@ -0,0 +1,42 @@
using UnityEngine;
using BaseGames.Core;
namespace BaseGames.Platform
{
/// <summary>
/// 平台服务引导组件(架构 16_SupportingModules §3.1)。
/// 在场景加载最早阶段DefaultExecutionOrder = -200检测平台并向 ServiceLocator 注入实现。
/// ⚠️ 使用 PlatformBootstrap MonoBehaviour + ServiceLocator 模式,非静态 PlatformManager。
/// </summary>
[DefaultExecutionOrder(-200)]
public class PlatformBootstrap : MonoBehaviour
{
private IPlatformService _platform;
private async void Awake()
{
IPlatformService service;
#if UNITY_STANDALONE && STEAMWORKS_NET
service = new SteamPlatformService();
#else
service = new NullPlatformService();
#endif
bool ok = await service.InitializeAsync();
if (!ok)
{
Debug.LogWarning("[PlatformBootstrap] 平台服务初始化失败,退回到 NullPlatformService。");
service = new NullPlatformService();
}
ServiceLocator.Register<IPlatformService>(service);
_platform = service;
Debug.Log($"[PlatformBootstrap] 已注册 {service.GetType().Name}。");
}
private void Update() => _platform?.RunCallbacks();
private void OnApplicationQuit() => _platform?.Shutdown();
}
}