Add prototype gameplay loop with character/battlefield assets and server game APIs.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
udx
2026-10-20 18:50:00 +08:00
co-authored by Cursor
parent 79369e4473
commit 6c64210331
833 changed files with 998079 additions and 1042 deletions
@@ -77,6 +77,7 @@ namespace AOT.Patch
HttpBase = _settings.HttpBase,
WsUrlTemplate = _settings.WsUrlTemplate,
Notice = version.notice ?? string.Empty,
UiTheme = string.IsNullOrWhiteSpace(version.uiTheme) ? _settings.UiTheme : version.uiTheme,
};
#if UNITY_EDITOR
@@ -152,6 +153,61 @@ namespace AOT.Patch
}
}
// UI Prefabs are AssetBundles in Art; DefaultPackage is the raw hot-update DLL.
// Initialize explicitly listed companion packages before gameplay starts.
var prepared = new System.Collections.Generic.HashSet<string>(StringComparer.Ordinal) { _settings.PackageName };
foreach (var packageName in version.packages ?? Array.Empty<string>())
{
if (string.IsNullOrWhiteSpace(packageName) || !prepared.Add(packageName)) continue;
if (!YooAssets.TryGetPackage(packageName, out var companion))
companion = YooAssets.CreatePackage(packageName);
var companionRoot = cdnRoot.TrimEnd('/');
var slash = companionRoot.LastIndexOf('/');
companionRoot = companionRoot.Substring(0, slash + 1) + packageName;
_view?.SetStatus($"初始化资源包 {packageName}…");
if (companion.InitializeStatus != EOperationStatus.Succeeded)
{
var companionInit = CreateInitializeOperation(companion, playMode, companionRoot);
if (companionInit == null)
{
onDone?.Invoke(null, $"不支持资源包 {packageName} 的 PlayMode: {playMode}");
yield break;
}
yield return companionInit;
if (companionInit.Status != EOperationStatus.Succeeded)
{
onDone?.Invoke(null, $"资源包 {packageName} 初始化失败: {companionInit.Error}");
yield break;
}
}
var companionVersion = companion.RequestPackageVersionAsync();
yield return companionVersion;
if (companionVersion.Status != EOperationStatus.Succeeded)
{
onDone?.Invoke(null, $"资源包 {packageName} 请求版本失败: {companionVersion.Error}");
yield break;
}
var companionManifest = companion.LoadPackageManifestAsync(new LoadPackageManifestOptions(companionVersion.PackageVersion, 60));
yield return companionManifest;
if (companionManifest.Status != EOperationStatus.Succeeded)
{
onDone?.Invoke(null, $"资源包 {packageName} 更新清单失败: {companionManifest.Error}");
yield break;
}
var companionDownload = companion.CreateResourceDownloader(new ResourceDownloaderOptions(10, 3));
if (companionDownload.TotalDownloadCount > 0)
{
_view?.SetStatus($"下载资源包 {packageName}…");
companionDownload.StartDownload();
yield return companionDownload;
if (companionDownload.Status != EOperationStatus.Succeeded)
{
onDone?.Invoke(null, $"资源包 {packageName} 下载失败: {companionDownload.Error}");
yield break;
}
}
}
_view?.SetProgress(0.95f);
_view?.SetStatus("资源就绪");
onDone?.Invoke(ctx, null);
@@ -184,7 +240,7 @@ namespace AOT.Patch
if (playMode == EPlayMode.EditorSimulateMode)
{
#if UNITY_EDITOR
var buildResult = EditorSimulateBuildInvoker.Build(_settings.PackageName, (int)EBundleType.VirtualAssetBundle);
var buildResult = EditorSimulateBuildInvoker.Build(package.PackageName, (int)EBundleType.VirtualAssetBundle);
var options = new EditorSimulateModeOptions
{
EditorFileSystemParameters = FileSystemParameters.CreateDefaultEditorFileSystemParameters(buildResult.PackageRootDirectory)
@@ -13,6 +13,8 @@ namespace AOT.Patch
public string[] packages = { "DefaultPackage" };
public bool forceUpdate;
public string notice = "";
/// <summary>兼容旧版本字段;当前 UI 仅支持 candy,其他主题值回退到 Candy。</summary>
public string uiTheme;
public static VersionInfo FromJson(string json)
{