Initial commit: Client Doc docs Server Tools
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace XWorld.PublishTool
|
||||
{
|
||||
// resolved-spec.json(Editor 侧 JsonUtility 产出,字段名小写)→ GameSpec。
|
||||
// GameSpec 用 public 字段,故必须 IncludeFields;键名大小写不敏感。
|
||||
public static class GameSpecJson
|
||||
{
|
||||
private static readonly JsonSerializerOptions Opts = new JsonSerializerOptions
|
||||
{
|
||||
IncludeFields = true,
|
||||
PropertyNameCaseInsensitive = true,
|
||||
ReadCommentHandling = JsonCommentHandling.Skip,
|
||||
AllowTrailingCommas = true,
|
||||
};
|
||||
|
||||
public static GameSpec Parse(string json)
|
||||
{
|
||||
var s = JsonSerializer.Deserialize<GameSpec>(json, Opts);
|
||||
if (s.Assets == null) s.Assets = new System.Collections.Generic.List<string>();
|
||||
return s;
|
||||
}
|
||||
|
||||
public static GameSpec ParseFile(string path) => Parse(File.ReadAllText(path));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user