using System.Collections.Generic; using System.Text.Json; namespace XWorld.PublishTool { public sealed class GameSpec { public string GameId; public int Version; public int MinFrameworkVersion; public int PlayerCount; public int TickRateHz; public string ServerAssembly; public string ServerEntryType; public string CoreDll; public string ClientDll; public string ClientEntryType; public string CodeAb; // 代码 AB 文件名(统一 AB:DLL .bytes 打进它) public List Assets = new List(); // 资源 AB 完整文件名列表 } public static class GameJsonWriter { private static readonly JsonSerializerOptions Opts = new JsonSerializerOptions { WriteIndented = true }; public static string WriteServer(GameSpec s) => JsonSerializer.Serialize(new { gameId = s.GameId, version = s.Version, serverAssembly = s.ServerAssembly, serverEntryType = s.ServerEntryType, minFrameworkVersion = s.MinFrameworkVersion, playerCount = s.PlayerCount, tickRateHz = s.TickRateHz }, Opts); public static string WriteClient(GameSpec s) => JsonSerializer.Serialize(new { gameId = s.GameId, version = s.Version, clientEntryType = s.ClientEntryType, coreDll = s.CoreDll, clientDll = s.ClientDll, minFrameworkVersion = s.MinFrameworkVersion, codeAb = s.CodeAb, assets = s.Assets }, Opts); } }