using System.Collections.Generic; using System.Runtime.Serialization; namespace Uigenx.Protocol { public enum UgxFileKind { [EnumMember(Value = "uxml")] Uxml, [EnumMember(Value = "uss")] Uss, [EnumMember(Value = "tss")] Tss, [EnumMember(Value = "cs")] Cs, [EnumMember(Value = "png")] Png, [EnumMember(Value = "asset")] Asset, [EnumMember(Value = "json")] Json, [EnumMember(Value = "shader")] Shader, [EnumMember(Value = "mat")] Mat, } public enum UgxTextureType { [EnumMember(Value = "Sprite")] Sprite, [EnumMember(Value = "Default")] Default, } public enum UgxSpriteMode { [EnumMember(Value = "Single")] Single, [EnumMember(Value = "Multiple")] Multiple, } public enum UgxFilterMode { [EnumMember(Value = "Point")] Point, [EnumMember(Value = "Bilinear")] Bilinear, [EnumMember(Value = "Trilinear")] Trilinear, } public enum UgxMeshType { [EnumMember(Value = "Tight")] Tight, [EnumMember(Value = "FullRect")] FullRect, } public sealed class UgxTextureImportSettings { public UgxTextureType TextureType { get; set; } = UgxTextureType.Sprite; public UgxSpriteMode SpriteMode { get; set; } = UgxSpriteMode.Single; public float PixelsPerUnit { get; set; } = 100f; public UgxFilterMode FilterMode { get; set; } = UgxFilterMode.Bilinear; /// Left, bottom, right, top, matching Unity's spriteBorder vector. public float[] SpriteBorder { get; set; } public UgxMeshType MeshType { get; set; } = UgxMeshType.FullRect; public bool Mipmaps { get; set; } public bool AlphaIsTransparency { get; set; } = true; public int MaxSize { get; set; } = 2048; } public sealed class UgxBundleFile { /// Path relative to the Unity UI folder. public string Path { get; set; } = string.Empty; public string Sha256 { get; set; } = string.Empty; public UgxFileKind Kind { get; set; } /// Base64 content, omitted when the file was streamed with sync.file first. public string Content { get; set; } public string Guid { get; set; } /// True when the compiler owns the file and rewrites it on every export. public bool Generated { get; set; } = true; } public sealed class UgxBundleAsset { public string Path { get; set; } = string.Empty; public UgxTextureImportSettings Importer { get; set; } = new UgxTextureImportSettings(); } public sealed class UgxBundleMaterial { public string Path { get; set; } = string.Empty; public string Shader { get; set; } = string.Empty; public Dictionary Properties { get; set; } = new Dictionary(); } public sealed class UgxFilterParameter { public string Name { get; set; } = string.Empty; /// `float` or `color`. public string Type { get; set; } = "float"; public object Default { get; set; } } public sealed class UgxBundleFilter { public string Path { get; set; } = string.Empty; public string Shader { get; set; } = string.Empty; public List Parameters { get; set; } = new List(); } public sealed class UgxManifestScreen { public string Key { get; set; } = string.Empty; public string Uxml { get; set; } = string.Empty; public string ClassName { get; set; } = string.Empty; public string Layer { get; set; } = string.Empty; } public sealed class UgxManifestAction { public string Name { get; set; } = string.Empty; public Dictionary Payload { get; set; } = new Dictionary(); } /// /// A PanelSettings asset the editor package creates or updates on import. Unity owns the asset, /// so the export carries the settings rather than a `.asset` file it would have to write itself. /// public sealed class UgxManifestPanel { public string Name { get; set; } = string.Empty; /// Where the asset goes, relative to the UI folder. public string Path { get; set; } = string.Empty; public float SortOrder { get; set; } /// `constant-pixel-size`, `constant-physical-size` or `scale-with-screen-size`. public string ScaleMode { get; set; } = "scale-with-screen-size"; public float Scale { get; set; } = 1f; public float ReferenceDpi { get; set; } = 96f; public float FallbackDpi { get; set; } = 96f; /// Width and height the UI was designed against. public int[] ReferenceResolution { get; set; } = { 1920, 1080 }; /// `width-or-height`, `shrink` or `expand`. public string ScreenMatchMode { get; set; } = "width-or-height"; /// 0 follows the width, 1 follows the height. public float Match { get; set; } = 0.5f; public float ReferenceSpritePixelsPerUnit { get; set; } = 100f; /// Theme stylesheet relative to the UI folder, or empty for the engine's own. public string Theme { get; set; } = string.Empty; } /// /// A FontAsset the editor package bakes on import. The compiler cannot render an SDF atlas, /// only Unity's own text engine can, so the export carries the recipe instead of the artefact. /// public sealed class UgxManifestFont { /// The font file the atlas is rendered from, relative to the UI folder. public string Source { get; set; } = string.Empty; /// Where the generated FontAsset goes, relative to the UI folder. public string Path { get; set; } = string.Empty; public string Guid { get; set; } = string.Empty; public string RenderMode { get; set; } = "SDFAA"; public int SamplingPointSize { get; set; } = 90; public int AtlasSize { get; set; } = 1024; public int Padding { get; set; } = 9; } public sealed class UgxBundleManifest { public List Screens { get; set; } = new List(); public List Actions { get; set; } = new List(); public List Panels { get; set; } = new List(); public List Fonts { get; set; } = new List(); } public sealed class UgxSyncBundle { public string BundleId { get; set; } = string.Empty; public long GeneratedAt { get; set; } public List Files { get; set; } = new List(); public List Assets { get; set; } = new List(); public List Materials { get; set; } = new List(); public List Filters { get; set; } = new List(); public List Deletions { get; set; } = new List(); public UgxBundleManifest Manifest { get; set; } = new UgxBundleManifest(); } public sealed class UgxSyncFileChunk { public string Sha256 { get; set; } = string.Empty; public int Index { get; set; } public int Total { get; set; } public string Chunk { get; set; } = string.Empty; } public sealed class UgxImportedFile { public string Path { get; set; } = string.Empty; public string Guid { get; set; } = string.Empty; } public sealed class UgxSyncResult { public string BundleId { get; set; } = string.Empty; public List Imported { get; set; } = new List(); public List Warnings { get; set; } = new List(); public double DurationMs { get; set; } } public sealed class UgxCompileRequest { public string RequestId { get; set; } = string.Empty; } public sealed class UgxCompileDiagnostic { public string File { get; set; } = string.Empty; public int Line { get; set; } public int Column { get; set; } public string Code { get; set; } = string.Empty; public string Message { get; set; } = string.Empty; } public sealed class UgxCompileResult { public string RequestId { get; set; } public bool Ok { get; set; } public List Errors { get; set; } = new List(); public List Warnings { get; set; } = new List(); public double DurationMs { get; set; } } }