using AOT.Boot;
using HotUpdate.Gameplay;
using HotUpdate.Net;
using UnityEngine;
namespace HotUpdate
{
///
/// 热更稳定入口(壳通过反射/Assembly.Load 调用,签名勿改)。
///
public static class Entry
{
public static void Start(BootContext ctx)
{
Debug.Log($"[HotUpdate.Entry] Start app={ctx?.AppVersion} res={ctx?.ResVersion}");
var root = new GameObject("HotUpdateRoot");
Object.DontDestroyOnLoad(root);
root.AddComponent().Bind(ctx);
}
}
public sealed class HotUpdateBootstrap : MonoBehaviour
{
BootContext _ctx;
public void Bind(BootContext ctx)
{
_ctx = ctx;
}
void Start()
{
Debug.Log($"[HotUpdate] Bootstrap ready. CDN={_ctx?.CdnRoot}");
var net = gameObject.AddComponent();
net.Bind(_ctx);
var gameplay = gameObject.AddComponent();
gameplay.Bind(_ctx, net);
net.StartGuestSession();
}
}
}