Add hot-update boot pipeline, UI bundles/atlas assets, and design docs.
Ignore AIClient/Library and AIClient/HybridCLRData permanently; include HybridCLR/YooAsset project setup and UI tooling. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
using AOT.Boot;
|
||||
using AOT.HotUpdate;
|
||||
using AOT.Patch;
|
||||
using AOT.UI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AOT.Boot
|
||||
{
|
||||
/// <summary>
|
||||
/// 壳层启动入口:版本检查 → 资源补丁 → HybridCLR/热更入口。
|
||||
/// </summary>
|
||||
public sealed class BootDriver : MonoBehaviour
|
||||
{
|
||||
[SerializeField] BootSettings settings = new BootSettings();
|
||||
|
||||
BootPatchView _view;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
Application.targetFrameRate = 60;
|
||||
Screen.sleepTimeout = SleepTimeout.NeverSleep;
|
||||
DontDestroyOnLoad(gameObject);
|
||||
|
||||
if (Screen.orientation != ScreenOrientation.Portrait)
|
||||
Screen.orientation = ScreenOrientation.Portrait;
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
_view = BootPatchView.Create();
|
||||
StartCoroutine(Bootstrap());
|
||||
}
|
||||
|
||||
System.Collections.IEnumerator Bootstrap()
|
||||
{
|
||||
BootContext ctx = null;
|
||||
string error = null;
|
||||
|
||||
var runner = new PatchRunner(this, settings, _view);
|
||||
yield return runner.Run((c, e) =>
|
||||
{
|
||||
ctx = c;
|
||||
error = e;
|
||||
});
|
||||
|
||||
if (!string.IsNullOrEmpty(error) || ctx == null)
|
||||
{
|
||||
_view?.SetError(error ?? "启动失败");
|
||||
Debug.LogError($"[Boot] {error}");
|
||||
yield break;
|
||||
}
|
||||
|
||||
_view?.SetStatus("加载热更代码…");
|
||||
_view?.SetProgress(0.97f);
|
||||
|
||||
string loadError = null;
|
||||
yield return HotUpdateLoader.LoadAndStart(ctx, settings, e => loadError = e);
|
||||
|
||||
if (!string.IsNullOrEmpty(loadError))
|
||||
{
|
||||
_view?.SetError(loadError);
|
||||
Debug.LogError($"[Boot] {loadError}");
|
||||
yield break;
|
||||
}
|
||||
|
||||
_view?.SetProgress(1f);
|
||||
_view?.SetStatus("热更已启动");
|
||||
Debug.Log($"[Boot] OK app={ctx.AppVersion} res={ctx.ResVersion} cdn={ctx.CdnRoot}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user