Files
AIGame/AIClient/Assets/AOT/Scripts/Boot/BootContext.cs
T
udxandCursor b7a0bbcb89 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>
2026-09-21 16:02:58 +08:00

35 lines
1.2 KiB
C#

using YooAsset;
namespace AOT.Boot
{
/// <summary>
/// 壳层传给热更入口的运行时上下文。
/// </summary>
public sealed class BootContext
{
public string AppVersion;
public string ResVersion;
public string CdnRoot;
public string PackageName;
public ResourcePackage Package;
public string WsUrlTemplate;
public string BuildWsUrl(string pid, string token = null)
{
if (string.IsNullOrEmpty(WsUrlTemplate))
{
if (string.IsNullOrEmpty(token))
return $"wss://game.xworld.ren/ws?pid={pid}";
return $"wss://game.xworld.ren/ws?pid={pid}&token={UnityEngine.Networking.UnityWebRequest.EscapeURL(token)}";
}
var url = WsUrlTemplate.Replace("{pid}", pid ?? string.Empty);
if (url.Contains("{token}"))
url = url.Replace("{token}", UnityEngine.Networking.UnityWebRequest.EscapeURL(token ?? string.Empty));
else if (!string.IsNullOrEmpty(token))
url += (url.Contains("?") ? "&" : "?") + "token=" + UnityEngine.Networking.UnityWebRequest.EscapeURL(token);
return url;
}
}
}