diff --git a/Art_Atlas/AtlasConfig.json b/Art_Atlas/AtlasConfig.json index 6cc76444..6e9c4d5a 100644 --- a/Art_Atlas/AtlasConfig.json +++ b/Art_Atlas/AtlasConfig.json @@ -1244,13 +1244,6 @@ "Assets/Art_SubModule/Art_Resource/Art_UISprites/collections/DefaultHead/head_pic_circle021.png", "Assets/Art_SubModule/Art_Resource/Art_UISprites/collections/DefaultHead/pet_pic_touxiang_wenhao.png", "Assets/Art_SubModule/Art_Resource/Art_UISprites/collections/DefaultHead/testHead.jpg", - "Assets/Art_SubModule/Art_Resource/Art_UISprites/collections/Emoji/cat_biaoqing_1.png", - "Assets/Art_SubModule/Art_Resource/Art_UISprites/collections/Emoji/cat_biaoqing_10.png", - "Assets/Art_SubModule/Art_Resource/Art_UISprites/collections/Emoji/cat_biaoqing_11.png", - "Assets/Art_SubModule/Art_Resource/Art_UISprites/collections/Emoji/cat_biaoqing_12.png", - "Assets/Art_SubModule/Art_Resource/Art_UISprites/collections/Emoji/cat_biaoqing_13.png", - "Assets/Art_SubModule/Art_Resource/Art_UISprites/collections/Emoji/cat_biaoqing_14.png", - "Assets/Art_SubModule/Art_Resource/Art_UISprites/collections/Emoji/cat_biaoqing_15.png", "Assets/Art_SubModule/Art_Resource/Art_UISprites/collections/Emoji/cat_biaoqing_2.png", "Assets/Art_SubModule/Art_Resource/Art_UISprites/collections/Emoji/cat_biaoqing_3.png", "Assets/Art_SubModule/Art_Resource/Art_UISprites/collections/Emoji/cat_biaoqing_4.png", @@ -1271,7 +1264,14 @@ "Assets/Art_SubModule/Art_Resource/Art_UISprites/collections/Kuang_new/HeadFrame6.png", "Assets/Art_SubModule/Art_Resource/Art_UISprites/collections/Kuang_new/HeadFrame7.png", "Assets/Art_SubModule/Art_Resource/Art_UISprites/collections/Kuang_new/HeadFrame8.png", - "Assets/Art_SubModule/Art_Resource/Art_UISprites/collections/Kuang_new/HeadFrame9.png" + "Assets/Art_SubModule/Art_Resource/Art_UISprites/collections/Kuang_new/HeadFrame9.png", + "Assets/Art_SubModule/Art_Resource/Art_UISprites/collections/Emoji/cat_biaoqing_1.png", + "Assets/Art_SubModule/Art_Resource/Art_UISprites/collections/Emoji/cat_biaoqing_10.png", + "Assets/Art_SubModule/Art_Resource/Art_UISprites/collections/Emoji/cat_biaoqing_11.png", + "Assets/Art_SubModule/Art_Resource/Art_UISprites/collections/Emoji/cat_biaoqing_12.png", + "Assets/Art_SubModule/Art_Resource/Art_UISprites/collections/Emoji/cat_biaoqing_13.png", + "Assets/Art_SubModule/Art_Resource/Art_UISprites/collections/Emoji/cat_biaoqing_14.png", + "Assets/Art_SubModule/Art_Resource/Art_UISprites/collections/Emoji/cat_biaoqing_15.png" ] } ] diff --git a/Art_Atlas/CollectionsAtlas.spriteatlas b/Art_Atlas/CollectionsAtlas.spriteatlas index 0d1186d2..c9f111fa 100644 --- a/Art_Atlas/CollectionsAtlas.spriteatlas +++ b/Art_Atlas/CollectionsAtlas.spriteatlas @@ -84,13 +84,6 @@ SpriteAtlas: - {fileID: 21300000, guid: 7787e68a9a594954eab66eada65544bc, type: 3} - {fileID: 21300000, guid: 8fe333808579ee14da593bd58de26afa, type: 3} - {fileID: 21300000, guid: 897ae7ad3faf7094194cc4c2d0e673fb, type: 3} - - {fileID: 21300000, guid: 007a236b3c02d2b47a0c80b144645476, type: 3} - - {fileID: 21300000, guid: c190524ab8f08a84faa3e8e061b6f3aa, type: 3} - - {fileID: 21300000, guid: cf311b770bd2e874184b23a274abbdf8, type: 3} - - {fileID: 21300000, guid: 167836e070c6f7b48951c5f07ebe04be, type: 3} - - {fileID: 21300000, guid: 794f179e38381db41839678a55d2f0e4, type: 3} - - {fileID: 21300000, guid: 0a66679576e68f445b960e5ae9ec6fef, type: 3} - - {fileID: 21300000, guid: 5023ed957e980824abc4c7eff0184f1f, type: 3} - {fileID: 21300000, guid: 1664818d80a34e24aa8aba3a54c2a8e3, type: 3} - {fileID: 21300000, guid: 909771eb56d643048a53d193c646ecbe, type: 3} - {fileID: 21300000, guid: 6e02e3e067c48d844a4d61695add2af5, type: 3} @@ -112,6 +105,13 @@ SpriteAtlas: - {fileID: 21300000, guid: ce589234df834174e83df4bd05834de1, type: 3} - {fileID: 21300000, guid: 027435436d6075d458ef4c7db0488a7d, type: 3} - {fileID: 21300000, guid: 7b2300d496a26bf4c9aacff3ee169122, type: 3} + - {fileID: 21300000, guid: 007a236b3c02d2b47a0c80b144645476, type: 3} + - {fileID: 21300000, guid: c190524ab8f08a84faa3e8e061b6f3aa, type: 3} + - {fileID: 21300000, guid: cf311b770bd2e874184b23a274abbdf8, type: 3} + - {fileID: 21300000, guid: 167836e070c6f7b48951c5f07ebe04be, type: 3} + - {fileID: 21300000, guid: 794f179e38381db41839678a55d2f0e4, type: 3} + - {fileID: 21300000, guid: 0a66679576e68f445b960e5ae9ec6fef, type: 3} + - {fileID: 21300000, guid: 5023ed957e980824abc4c7eff0184f1f, type: 3} bindAsDefault: 1 isAtlasV2: 0 cachedData: {fileID: 0} diff --git a/Art_Bytes.meta b/Art_Bytes.meta new file mode 100644 index 00000000..be84403d --- /dev/null +++ b/Art_Bytes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5c302f2e95b14184a98997996ac956e9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Art_Bytes/ArtAtlasConfig.bytes b/Art_Bytes/ArtAtlasConfig.bytes new file mode 100644 index 00000000..729a714c Binary files /dev/null and b/Art_Bytes/ArtAtlasConfig.bytes differ diff --git a/Art_Bytes/ArtAtlasConfig.bytes.meta b/Art_Bytes/ArtAtlasConfig.bytes.meta new file mode 100644 index 00000000..4aa917d8 --- /dev/null +++ b/Art_Bytes/ArtAtlasConfig.bytes.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a1d0f95900e059c41a7fd2a89d210c29 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Art_Bytes/ArtResourceConfig.bytes b/Art_Bytes/ArtResourceConfig.bytes new file mode 100644 index 00000000..33ed72c2 Binary files /dev/null and b/Art_Bytes/ArtResourceConfig.bytes differ diff --git a/Art_Bytes/ArtResourceConfig.bytes.meta b/Art_Bytes/ArtResourceConfig.bytes.meta new file mode 100644 index 00000000..c0ac931d --- /dev/null +++ b/Art_Bytes/ArtResourceConfig.bytes.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 03dc4370b4db3d84e81b41d2e6fb491c +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Art_Json/Collections/HeadResource.json b/Art_Json/Collections/HeadResource.json index 86316ddb..d506bb9b 100644 --- a/Art_Json/Collections/HeadResource.json +++ b/Art_Json/Collections/HeadResource.json @@ -209,6 +209,14 @@ "SpritePath": "Assets/Art_SubModule/Art_Resource/Art_UISprites/collections/DefaultHead/testHead.jpg", "SpineAssetPath": "", "SpineAnimName": "" + }, + { + "Id": 1005, + "Name": "新资源项_1005", + "Desc": "", + "SpritePath": "Assets/Art_SubModule/Art_Resource/Art_UISprites/test1.png", + "SpineAssetPath": "", + "SpineAnimName": "" } ] } \ No newline at end of file diff --git a/Art_SO/Collections/HeadResource.asset b/Art_SO/Collections/HeadResource.asset index 14f78c42..14f213ce 100644 --- a/Art_SO/Collections/HeadResource.asset +++ b/Art_SO/Collections/HeadResource.asset @@ -223,3 +223,11 @@ MonoBehaviour: SpineAsset: {fileID: 0} SpineAssetPath: SpineAnimName: + - Id: 1005 + Name: "\u65B0\u8D44\u6E90\u9879_1005" + Desc: + Sprite: {fileID: 21300000, guid: 733315d1cf4a069438e2304ec523f0f5, type: 3} + SpritePath: Assets/Art_SubModule/Art_Resource/Art_UISprites/test1.png + SpineAsset: {fileID: 0} + SpineAssetPath: + SpineAnimName: diff --git a/Art_Scripts/gen-netstd.meta b/Art_Scripts/gen-netstd.meta new file mode 100644 index 00000000..7a125cb0 --- /dev/null +++ b/Art_Scripts/gen-netstd.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bb78523eb2930094391422c0f86ae0b0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Art_Scripts/gen-netstd/Byway.meta b/Art_Scripts/gen-netstd/Byway.meta new file mode 100644 index 00000000..01b4c90c --- /dev/null +++ b/Art_Scripts/gen-netstd/Byway.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 121092cd5b40498489d0e027ac88e1c4 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Art_Scripts/gen-netstd/Byway/Thrift.meta b/Art_Scripts/gen-netstd/Byway/Thrift.meta new file mode 100644 index 00000000..fe234c93 --- /dev/null +++ b/Art_Scripts/gen-netstd/Byway/Thrift.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 05720d8b8644d9741bd3c136b9545de6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Art_Scripts/gen-netstd/Byway/Thrift/Data.meta b/Art_Scripts/gen-netstd/Byway/Thrift/Data.meta new file mode 100644 index 00000000..744fa559 --- /dev/null +++ b/Art_Scripts/gen-netstd/Byway/Thrift/Data.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 135a5856bdff5244bb4f4ca56d1e122a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtAtlasConfig.cs b/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtAtlasConfig.cs new file mode 100644 index 00000000..a8b9cd64 --- /dev/null +++ b/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtAtlasConfig.cs @@ -0,0 +1,290 @@ +/** + * + * Autogenerated by Thrift Compiler (0.22.0) + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.Runtime.Serialization; +using Thrift.Protocol; +using Thrift.Protocol.Entities; +using Thrift.Protocol.Utilities; +using Thrift.Transport; +using Thrift.Transport.Client; + + +#pragma warning disable IDE0079 // remove unnecessary pragmas +#pragma warning disable IDE0017 // object init can be simplified +#pragma warning disable IDE0028 // collection init can be simplified +#pragma warning disable IDE0305 // collection init can be simplified +#pragma warning disable IDE0034 // simplify default expression +#pragma warning disable IDE0066 // use switch expression +#pragma warning disable IDE0090 // simplify new expression +#pragma warning disable IDE0290 // use primary CTOR +#pragma warning disable IDE1006 // parts of the code use IDL spelling +#pragma warning disable CA1822 // empty DeepCopy() methods still non-static +#pragma warning disable IDE0083 // pattern matching "that is not SomeType" requires net5.0 but we still support earlier versions + +namespace Byway.Thrift.Data +{ + + /// + /// 图集配置(Thrift序列化用) + /// + [DataContract(Namespace="")] + public partial class ArtAtlasConfig : TBase + { + private string _generateTime; + + [DataMember(Order = 0)] + public List Atlases { get; set; } + + [DataMember(Order = 0)] + public long Version { get; set; } + + [DataMember(Order = 0)] + public string GenerateTime + { + get + { + return _generateTime; + } + set + { + __isset.generateTime = true; + this._generateTime = value; + } + } + + + [DataMember(Order = 1)] + public Isset __isset; + [DataContract] + public struct Isset + { + [DataMember] + public bool generateTime; + } + + #region XmlSerializer support + + public bool ShouldSerializeGenerateTime() + { + return __isset.generateTime; + } + + #endregion XmlSerializer support + + public ArtAtlasConfig() + { + } + + public ArtAtlasConfig(List @atlases, long @version) : this() + { + this.Atlases = @atlases; + this.Version = @version; + } + + public ArtAtlasConfig DeepCopy() + { + var tmp9 = new ArtAtlasConfig(); + if((Atlases != null)) + { + tmp9.Atlases = this.Atlases.DeepCopy(); + } + tmp9.Version = this.Version; + if((GenerateTime != null) && __isset.generateTime) + { + tmp9.GenerateTime = this.GenerateTime; + } + tmp9.__isset.generateTime = this.__isset.generateTime; + return tmp9; + } + + public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_atlases = false; + bool isset_version = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.List) + { + { + var _list10 = await iprot.ReadListBeginAsync(cancellationToken); + Atlases = new List(_list10.Count); + for(int _i11 = 0; _i11 < _list10.Count; ++_i11) + { + global::Byway.Thrift.Data.ArtAtlasInfo _elem12; + _elem12 = new global::Byway.Thrift.Data.ArtAtlasInfo(); + await _elem12.ReadAsync(iprot, cancellationToken); + Atlases.Add(_elem12); + } + await iprot.ReadListEndAsync(cancellationToken); + } + isset_atlases = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.I64) + { + Version = await iprot.ReadI64Async(cancellationToken); + isset_version = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.String) + { + GenerateTime = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_atlases) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_version) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var tmp13 = new TStruct("ArtAtlasConfig"); + await oprot.WriteStructBeginAsync(tmp13, cancellationToken); + var tmp14 = new TField(); + if((Atlases != null)) + { + tmp14.Name = "atlases"; + tmp14.Type = TType.List; + tmp14.ID = 1; + await oprot.WriteFieldBeginAsync(tmp14, cancellationToken); + await oprot.WriteListBeginAsync(new TList(TType.Struct, Atlases.Count), cancellationToken); + foreach (global::Byway.Thrift.Data.ArtAtlasInfo _iter15 in Atlases) + { + await _iter15.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + tmp14.Name = "version"; + tmp14.Type = TType.I64; + tmp14.ID = 2; + await oprot.WriteFieldBeginAsync(tmp14, cancellationToken); + await oprot.WriteI64Async(Version, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + if((GenerateTime != null) && __isset.generateTime) + { + tmp14.Name = "generateTime"; + tmp14.Type = TType.String; + tmp14.ID = 3; + await oprot.WriteFieldBeginAsync(tmp14, cancellationToken); + await oprot.WriteStringAsync(GenerateTime, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override bool Equals(object that) + { + if (!(that is ArtAtlasConfig other)) return false; + if (ReferenceEquals(this, other)) return true; + return TCollections.Equals(Atlases, other.Atlases) + && global::System.Object.Equals(Version, other.Version) + && ((__isset.generateTime == other.__isset.generateTime) && ((!__isset.generateTime) || (global::System.Object.Equals(GenerateTime, other.GenerateTime)))); + } + + public override int GetHashCode() { + int hashcode = 157; + unchecked { + if((Atlases != null)) + { + hashcode = (hashcode * 397) + TCollections.GetHashCode(Atlases); + } + hashcode = (hashcode * 397) + Version.GetHashCode(); + if((GenerateTime != null) && __isset.generateTime) + { + hashcode = (hashcode * 397) + GenerateTime.GetHashCode(); + } + } + return hashcode; + } + + public override string ToString() + { + var tmp16 = new StringBuilder("ArtAtlasConfig("); + if((Atlases != null)) + { + tmp16.Append(", Atlases: "); + Atlases.ToString(tmp16); + } + tmp16.Append(", Version: "); + Version.ToString(tmp16); + if((GenerateTime != null) && __isset.generateTime) + { + tmp16.Append(", GenerateTime: "); + GenerateTime.ToString(tmp16); + } + tmp16.Append(')'); + return tmp16.ToString(); + } + } + +} diff --git a/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtAtlasConfig.cs.meta b/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtAtlasConfig.cs.meta new file mode 100644 index 00000000..348c1c7a --- /dev/null +++ b/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtAtlasConfig.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d4c1297c76694f44b841b0508a9a86e5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtAtlasInfo.cs b/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtAtlasInfo.cs new file mode 100644 index 00000000..6a83f32b --- /dev/null +++ b/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtAtlasInfo.cs @@ -0,0 +1,233 @@ +/** + * + * Autogenerated by Thrift Compiler (0.22.0) + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.Runtime.Serialization; +using Thrift.Protocol; +using Thrift.Protocol.Entities; +using Thrift.Protocol.Utilities; +using Thrift.Transport; +using Thrift.Transport.Client; + + +#pragma warning disable IDE0079 // remove unnecessary pragmas +#pragma warning disable IDE0017 // object init can be simplified +#pragma warning disable IDE0028 // collection init can be simplified +#pragma warning disable IDE0305 // collection init can be simplified +#pragma warning disable IDE0034 // simplify default expression +#pragma warning disable IDE0066 // use switch expression +#pragma warning disable IDE0090 // simplify new expression +#pragma warning disable IDE0290 // use primary CTOR +#pragma warning disable IDE1006 // parts of the code use IDL spelling +#pragma warning disable CA1822 // empty DeepCopy() methods still non-static +#pragma warning disable IDE0083 // pattern matching "that is not SomeType" requires net5.0 but we still support earlier versions + +namespace Byway.Thrift.Data +{ + + /// + /// 图集信息(Thrift序列化用) + /// + [DataContract(Namespace="")] + public partial class ArtAtlasInfo : TBase + { + + [DataMember(Order = 0)] + public string Name { get; set; } + + [DataMember(Order = 0)] + public List SpritePaths { get; set; } + + public ArtAtlasInfo() + { + } + + public ArtAtlasInfo(string @name, List spritePaths) : this() + { + this.Name = @name; + this.SpritePaths = spritePaths; + } + + public ArtAtlasInfo DeepCopy() + { + var tmp0 = new ArtAtlasInfo(); + if((Name != null)) + { + tmp0.Name = this.Name; + } + if((SpritePaths != null)) + { + tmp0.SpritePaths = this.SpritePaths.DeepCopy(); + } + return tmp0; + } + + public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_name = false; + bool isset_spritePaths = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Name = await iprot.ReadStringAsync(cancellationToken); + isset_name = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.List) + { + { + var _list1 = await iprot.ReadListBeginAsync(cancellationToken); + SpritePaths = new List(_list1.Count); + for(int _i2 = 0; _i2 < _list1.Count; ++_i2) + { + string _elem3; + _elem3 = await iprot.ReadStringAsync(cancellationToken); + SpritePaths.Add(_elem3); + } + await iprot.ReadListEndAsync(cancellationToken); + } + isset_spritePaths = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_name) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_spritePaths) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var tmp4 = new TStruct("ArtAtlasInfo"); + await oprot.WriteStructBeginAsync(tmp4, cancellationToken); + var tmp5 = new TField(); + if((Name != null)) + { + tmp5.Name = "name"; + tmp5.Type = TType.String; + tmp5.ID = 1; + await oprot.WriteFieldBeginAsync(tmp5, cancellationToken); + await oprot.WriteStringAsync(Name, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if((SpritePaths != null)) + { + tmp5.Name = "spritePaths"; + tmp5.Type = TType.List; + tmp5.ID = 2; + await oprot.WriteFieldBeginAsync(tmp5, cancellationToken); + await oprot.WriteListBeginAsync(new TList(TType.String, SpritePaths.Count), cancellationToken); + foreach (string _iter6 in SpritePaths) + { + await oprot.WriteStringAsync(_iter6, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override bool Equals(object that) + { + if (!(that is ArtAtlasInfo other)) return false; + if (ReferenceEquals(this, other)) return true; + return global::System.Object.Equals(Name, other.Name) + && TCollections.Equals(SpritePaths, other.SpritePaths); + } + + public override int GetHashCode() { + int hashcode = 157; + unchecked { + if((Name != null)) + { + hashcode = (hashcode * 397) + Name.GetHashCode(); + } + if((SpritePaths != null)) + { + hashcode = (hashcode * 397) + TCollections.GetHashCode(SpritePaths); + } + } + return hashcode; + } + + public override string ToString() + { + var tmp7 = new StringBuilder("ArtAtlasInfo("); + if((Name != null)) + { + tmp7.Append(", Name: "); + Name.ToString(tmp7); + } + if((SpritePaths != null)) + { + tmp7.Append(", SpritePaths: "); + SpritePaths.ToString(tmp7); + } + tmp7.Append(')'); + return tmp7.ToString(); + } + } + +} diff --git a/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtAtlasInfo.cs.meta b/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtAtlasInfo.cs.meta new file mode 100644 index 00000000..bbaa79c1 --- /dev/null +++ b/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtAtlasInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 45d38a05c0140bc44b5e33c113bfbe7c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtItem.cs b/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtItem.cs new file mode 100644 index 00000000..4c69cdb8 --- /dev/null +++ b/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtItem.cs @@ -0,0 +1,442 @@ +/** + * + * Autogenerated by Thrift Compiler (0.22.0) + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.Runtime.Serialization; +using Thrift.Protocol; +using Thrift.Protocol.Entities; +using Thrift.Protocol.Utilities; +using Thrift.Transport; +using Thrift.Transport.Client; + + +#pragma warning disable IDE0079 // remove unnecessary pragmas +#pragma warning disable IDE0017 // object init can be simplified +#pragma warning disable IDE0028 // collection init can be simplified +#pragma warning disable IDE0305 // collection init can be simplified +#pragma warning disable IDE0034 // simplify default expression +#pragma warning disable IDE0066 // use switch expression +#pragma warning disable IDE0090 // simplify new expression +#pragma warning disable IDE0290 // use primary CTOR +#pragma warning disable IDE1006 // parts of the code use IDL spelling +#pragma warning disable CA1822 // empty DeepCopy() methods still non-static +#pragma warning disable IDE0083 // pattern matching "that is not SomeType" requires net5.0 but we still support earlier versions + +namespace Byway.Thrift.Data +{ + + /// + /// 资源项 + /// + [DataContract(Namespace="")] + public partial class ArtItem : TBase + { + private string _desc; + private string _spritePath; + private string _spineAssetPath; + private string _spineAnimName; + + [DataMember(Order = 0)] + public int Id { get; set; } + + [DataMember(Order = 0)] + public string Name { get; set; } + + [DataMember(Order = 0)] + public string Desc + { + get + { + return _desc; + } + set + { + __isset.@desc = true; + this._desc = value; + } + } + + [DataMember(Order = 0)] + public string SpritePath + { + get + { + return _spritePath; + } + set + { + __isset.spritePath = true; + this._spritePath = value; + } + } + + [DataMember(Order = 0)] + public string SpineAssetPath + { + get + { + return _spineAssetPath; + } + set + { + __isset.spineAssetPath = true; + this._spineAssetPath = value; + } + } + + [DataMember(Order = 0)] + public string SpineAnimName + { + get + { + return _spineAnimName; + } + set + { + __isset.spineAnimName = true; + this._spineAnimName = value; + } + } + + + [DataMember(Order = 1)] + public Isset __isset; + [DataContract] + public struct Isset + { + [DataMember] + public bool @desc; + [DataMember] + public bool spritePath; + [DataMember] + public bool spineAssetPath; + [DataMember] + public bool spineAnimName; + } + + #region XmlSerializer support + + public bool ShouldSerializeDesc() + { + return __isset.@desc; + } + + public bool ShouldSerializeSpritePath() + { + return __isset.spritePath; + } + + public bool ShouldSerializeSpineAssetPath() + { + return __isset.spineAssetPath; + } + + public bool ShouldSerializeSpineAnimName() + { + return __isset.spineAnimName; + } + + #endregion XmlSerializer support + + public ArtItem() + { + } + + public ArtItem(int @id, string @name) : this() + { + this.Id = @id; + this.Name = @name; + } + + public ArtItem DeepCopy() + { + var tmp0 = new ArtItem(); + tmp0.Id = this.Id; + if((Name != null)) + { + tmp0.Name = this.Name; + } + if((Desc != null) && __isset.@desc) + { + tmp0.Desc = this.Desc; + } + tmp0.__isset.@desc = this.__isset.@desc; + if((SpritePath != null) && __isset.spritePath) + { + tmp0.SpritePath = this.SpritePath; + } + tmp0.__isset.spritePath = this.__isset.spritePath; + if((SpineAssetPath != null) && __isset.spineAssetPath) + { + tmp0.SpineAssetPath = this.SpineAssetPath; + } + tmp0.__isset.spineAssetPath = this.__isset.spineAssetPath; + if((SpineAnimName != null) && __isset.spineAnimName) + { + tmp0.SpineAnimName = this.SpineAnimName; + } + tmp0.__isset.spineAnimName = this.__isset.spineAnimName; + return tmp0; + } + + public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_id = false; + bool isset_name = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + Id = await iprot.ReadI32Async(cancellationToken); + isset_id = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.String) + { + Name = await iprot.ReadStringAsync(cancellationToken); + isset_name = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.String) + { + Desc = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.String) + { + SpritePath = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 5: + if (field.Type == TType.String) + { + SpineAssetPath = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 6: + if (field.Type == TType.String) + { + SpineAnimName = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_id) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_name) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var tmp1 = new TStruct("ArtItem"); + await oprot.WriteStructBeginAsync(tmp1, cancellationToken); + var tmp2 = new TField(); + tmp2.Name = "id"; + tmp2.Type = TType.I32; + tmp2.ID = 1; + await oprot.WriteFieldBeginAsync(tmp2, cancellationToken); + await oprot.WriteI32Async(Id, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + if((Name != null)) + { + tmp2.Name = "name"; + tmp2.Type = TType.String; + tmp2.ID = 2; + await oprot.WriteFieldBeginAsync(tmp2, cancellationToken); + await oprot.WriteStringAsync(Name, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if((Desc != null) && __isset.@desc) + { + tmp2.Name = "desc"; + tmp2.Type = TType.String; + tmp2.ID = 3; + await oprot.WriteFieldBeginAsync(tmp2, cancellationToken); + await oprot.WriteStringAsync(Desc, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if((SpritePath != null) && __isset.spritePath) + { + tmp2.Name = "spritePath"; + tmp2.Type = TType.String; + tmp2.ID = 4; + await oprot.WriteFieldBeginAsync(tmp2, cancellationToken); + await oprot.WriteStringAsync(SpritePath, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if((SpineAssetPath != null) && __isset.spineAssetPath) + { + tmp2.Name = "spineAssetPath"; + tmp2.Type = TType.String; + tmp2.ID = 5; + await oprot.WriteFieldBeginAsync(tmp2, cancellationToken); + await oprot.WriteStringAsync(SpineAssetPath, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if((SpineAnimName != null) && __isset.spineAnimName) + { + tmp2.Name = "spineAnimName"; + tmp2.Type = TType.String; + tmp2.ID = 6; + await oprot.WriteFieldBeginAsync(tmp2, cancellationToken); + await oprot.WriteStringAsync(SpineAnimName, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override bool Equals(object that) + { + if (!(that is ArtItem other)) return false; + if (ReferenceEquals(this, other)) return true; + return global::System.Object.Equals(Id, other.Id) + && global::System.Object.Equals(Name, other.Name) + && ((__isset.@desc == other.__isset.@desc) && ((!__isset.@desc) || (global::System.Object.Equals(Desc, other.Desc)))) + && ((__isset.spritePath == other.__isset.spritePath) && ((!__isset.spritePath) || (global::System.Object.Equals(SpritePath, other.SpritePath)))) + && ((__isset.spineAssetPath == other.__isset.spineAssetPath) && ((!__isset.spineAssetPath) || (global::System.Object.Equals(SpineAssetPath, other.SpineAssetPath)))) + && ((__isset.spineAnimName == other.__isset.spineAnimName) && ((!__isset.spineAnimName) || (global::System.Object.Equals(SpineAnimName, other.SpineAnimName)))); + } + + public override int GetHashCode() { + int hashcode = 157; + unchecked { + hashcode = (hashcode * 397) + Id.GetHashCode(); + if((Name != null)) + { + hashcode = (hashcode * 397) + Name.GetHashCode(); + } + if((Desc != null) && __isset.@desc) + { + hashcode = (hashcode * 397) + Desc.GetHashCode(); + } + if((SpritePath != null) && __isset.spritePath) + { + hashcode = (hashcode * 397) + SpritePath.GetHashCode(); + } + if((SpineAssetPath != null) && __isset.spineAssetPath) + { + hashcode = (hashcode * 397) + SpineAssetPath.GetHashCode(); + } + if((SpineAnimName != null) && __isset.spineAnimName) + { + hashcode = (hashcode * 397) + SpineAnimName.GetHashCode(); + } + } + return hashcode; + } + + public override string ToString() + { + var tmp3 = new StringBuilder("ArtItem("); + tmp3.Append(", Id: "); + Id.ToString(tmp3); + if((Name != null)) + { + tmp3.Append(", Name: "); + Name.ToString(tmp3); + } + if((Desc != null) && __isset.@desc) + { + tmp3.Append(", Desc: "); + Desc.ToString(tmp3); + } + if((SpritePath != null) && __isset.spritePath) + { + tmp3.Append(", SpritePath: "); + SpritePath.ToString(tmp3); + } + if((SpineAssetPath != null) && __isset.spineAssetPath) + { + tmp3.Append(", SpineAssetPath: "); + SpineAssetPath.ToString(tmp3); + } + if((SpineAnimName != null) && __isset.spineAnimName) + { + tmp3.Append(", SpineAnimName: "); + SpineAnimName.ToString(tmp3); + } + tmp3.Append(')'); + return tmp3.ToString(); + } + } + +} diff --git a/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtItem.cs.meta b/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtItem.cs.meta new file mode 100644 index 00000000..48a76ec5 --- /dev/null +++ b/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtItem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 64ddf897cd11e7d4b9a3281d0e2796aa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtResourceConfig.Extensions.cs b/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtResourceConfig.Extensions.cs new file mode 100644 index 00000000..a8ed2571 --- /dev/null +++ b/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtResourceConfig.Extensions.cs @@ -0,0 +1,119 @@ +/** + * + * Autogenerated by Thrift Compiler (0.22.0) + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.Runtime.Serialization; +using Thrift.Protocol; + + +#pragma warning disable IDE0079 // remove unnecessary pragmas +#pragma warning disable IDE0017 // object init can be simplified +#pragma warning disable IDE0028 // collection init can be simplified +#pragma warning disable IDE0305 // collection init can be simplified +#pragma warning disable IDE0034 // simplify default expression +#pragma warning disable IDE0066 // use switch expression +#pragma warning disable IDE0090 // simplify new expression +#pragma warning disable IDE0290 // use primary CTOR +#pragma warning disable IDE1006 // parts of the code use IDL spelling +#pragma warning disable CA1822 // empty DeepCopy() methods still non-static +#pragma warning disable IDE0083 // pattern matching "that is not SomeType" requires net5.0 but we still support earlier versions + +namespace Byway.Thrift.Data +{ + public static class ArtResourceConfigExtensions + { + public static bool Equals(this List instance, object that) + { + if (!(that is List other)) return false; + if (ReferenceEquals(instance, other)) return true; + + return TCollections.Equals(instance, other); + } + + + public static int GetHashCode(this List instance) + { + return TCollections.GetHashCode(instance); + } + + + public static List DeepCopy(this List source) + { + if (source == null) + return null; + + var tmp27 = new List(source.Count); + foreach (var elem in source) + tmp27.Add((elem != null) ? elem.DeepCopy() : null); + return tmp27; + } + + + public static bool Equals(this List instance, object that) + { + if (!(that is List other)) return false; + if (ReferenceEquals(instance, other)) return true; + + return TCollections.Equals(instance, other); + } + + + public static int GetHashCode(this List instance) + { + return TCollections.GetHashCode(instance); + } + + + public static List DeepCopy(this List source) + { + if (source == null) + return null; + + var tmp28 = new List(source.Count); + foreach (var elem in source) + tmp28.Add((elem != null) ? elem.DeepCopy() : null); + return tmp28; + } + + + public static bool Equals(this List instance, object that) + { + if (!(that is List other)) return false; + if (ReferenceEquals(instance, other)) return true; + + return TCollections.Equals(instance, other); + } + + + public static int GetHashCode(this List instance) + { + return TCollections.GetHashCode(instance); + } + + + public static List DeepCopy(this List source) + { + if (source == null) + return null; + + var tmp29 = new List(source.Count); + foreach (var elem in source) + tmp29.Add(elem); + return tmp29; + } + + + } +} diff --git a/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtResourceConfig.Extensions.cs.meta b/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtResourceConfig.Extensions.cs.meta new file mode 100644 index 00000000..6796ec63 --- /dev/null +++ b/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtResourceConfig.Extensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3a687987ea5895148b41c2bf914c8ff5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtResourceConfig.cs b/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtResourceConfig.cs new file mode 100644 index 00000000..d9e29ecb --- /dev/null +++ b/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtResourceConfig.cs @@ -0,0 +1,362 @@ +/** + * + * Autogenerated by Thrift Compiler (0.22.0) + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.Runtime.Serialization; +using Thrift.Protocol; +using Thrift.Protocol.Entities; +using Thrift.Protocol.Utilities; +using Thrift.Transport; +using Thrift.Transport.Client; + + +#pragma warning disable IDE0079 // remove unnecessary pragmas +#pragma warning disable IDE0017 // object init can be simplified +#pragma warning disable IDE0028 // collection init can be simplified +#pragma warning disable IDE0305 // collection init can be simplified +#pragma warning disable IDE0034 // simplify default expression +#pragma warning disable IDE0066 // use switch expression +#pragma warning disable IDE0090 // simplify new expression +#pragma warning disable IDE0290 // use primary CTOR +#pragma warning disable IDE1006 // parts of the code use IDL spelling +#pragma warning disable CA1822 // empty DeepCopy() methods still non-static +#pragma warning disable IDE0083 // pattern matching "that is not SomeType" requires net5.0 but we still support earlier versions + +namespace Byway.Thrift.Data +{ + + /// + /// 美术资源总配置 + /// 包含所有表数据 + manifest信息(预加载配置) + /// + [DataContract(Namespace="")] + public partial class ArtResourceConfig : TBase + { + private List _preloadTableIds; + private string _generateTime; + + [DataMember(Order = 0)] + public List Tables { get; set; } + + [DataMember(Order = 0)] + public List PreloadTableIds + { + get + { + return _preloadTableIds; + } + set + { + __isset.preloadTableIds = true; + this._preloadTableIds = value; + } + } + + [DataMember(Order = 0)] + public long Version { get; set; } + + [DataMember(Order = 0)] + public string GenerateTime + { + get + { + return _generateTime; + } + set + { + __isset.generateTime = true; + this._generateTime = value; + } + } + + + [DataMember(Order = 1)] + public Isset __isset; + [DataContract] + public struct Isset + { + [DataMember] + public bool preloadTableIds; + [DataMember] + public bool generateTime; + } + + #region XmlSerializer support + + public bool ShouldSerializePreloadTableIds() + { + return __isset.preloadTableIds; + } + + public bool ShouldSerializeGenerateTime() + { + return __isset.generateTime; + } + + #endregion XmlSerializer support + + public ArtResourceConfig() + { + } + + public ArtResourceConfig(List @tables, long @version) : this() + { + this.Tables = @tables; + this.Version = @version; + } + + public ArtResourceConfig DeepCopy() + { + var tmp14 = new ArtResourceConfig(); + if((Tables != null)) + { + tmp14.Tables = this.Tables.DeepCopy(); + } + if((PreloadTableIds != null) && __isset.preloadTableIds) + { + tmp14.PreloadTableIds = this.PreloadTableIds.DeepCopy(); + } + tmp14.__isset.preloadTableIds = this.__isset.preloadTableIds; + tmp14.Version = this.Version; + if((GenerateTime != null) && __isset.generateTime) + { + tmp14.GenerateTime = this.GenerateTime; + } + tmp14.__isset.generateTime = this.__isset.generateTime; + return tmp14; + } + + public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_tables = false; + bool isset_version = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.List) + { + { + var _list15 = await iprot.ReadListBeginAsync(cancellationToken); + Tables = new List(_list15.Count); + for(int _i16 = 0; _i16 < _list15.Count; ++_i16) + { + global::Byway.Thrift.Data.ArtTable _elem17; + _elem17 = new global::Byway.Thrift.Data.ArtTable(); + await _elem17.ReadAsync(iprot, cancellationToken); + Tables.Add(_elem17); + } + await iprot.ReadListEndAsync(cancellationToken); + } + isset_tables = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.List) + { + { + var _list18 = await iprot.ReadListBeginAsync(cancellationToken); + PreloadTableIds = new List(_list18.Count); + for(int _i19 = 0; _i19 < _list18.Count; ++_i19) + { + int _elem20; + _elem20 = await iprot.ReadI32Async(cancellationToken); + PreloadTableIds.Add(_elem20); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.I64) + { + Version = await iprot.ReadI64Async(cancellationToken); + isset_version = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.String) + { + GenerateTime = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_tables) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_version) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var tmp21 = new TStruct("ArtResourceConfig"); + await oprot.WriteStructBeginAsync(tmp21, cancellationToken); + var tmp22 = new TField(); + if((Tables != null)) + { + tmp22.Name = "tables"; + tmp22.Type = TType.List; + tmp22.ID = 1; + await oprot.WriteFieldBeginAsync(tmp22, cancellationToken); + await oprot.WriteListBeginAsync(new TList(TType.Struct, Tables.Count), cancellationToken); + foreach (global::Byway.Thrift.Data.ArtTable _iter23 in Tables) + { + await _iter23.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if((PreloadTableIds != null) && __isset.preloadTableIds) + { + tmp22.Name = "preloadTableIds"; + tmp22.Type = TType.List; + tmp22.ID = 2; + await oprot.WriteFieldBeginAsync(tmp22, cancellationToken); + await oprot.WriteListBeginAsync(new TList(TType.I32, PreloadTableIds.Count), cancellationToken); + foreach (int _iter24 in PreloadTableIds) + { + await oprot.WriteI32Async(_iter24, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + tmp22.Name = "version"; + tmp22.Type = TType.I64; + tmp22.ID = 3; + await oprot.WriteFieldBeginAsync(tmp22, cancellationToken); + await oprot.WriteI64Async(Version, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + if((GenerateTime != null) && __isset.generateTime) + { + tmp22.Name = "generateTime"; + tmp22.Type = TType.String; + tmp22.ID = 4; + await oprot.WriteFieldBeginAsync(tmp22, cancellationToken); + await oprot.WriteStringAsync(GenerateTime, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override bool Equals(object that) + { + if (!(that is ArtResourceConfig other)) return false; + if (ReferenceEquals(this, other)) return true; + return TCollections.Equals(Tables, other.Tables) + && ((__isset.preloadTableIds == other.__isset.preloadTableIds) && ((!__isset.preloadTableIds) || (TCollections.Equals(PreloadTableIds, other.PreloadTableIds)))) + && global::System.Object.Equals(Version, other.Version) + && ((__isset.generateTime == other.__isset.generateTime) && ((!__isset.generateTime) || (global::System.Object.Equals(GenerateTime, other.GenerateTime)))); + } + + public override int GetHashCode() { + int hashcode = 157; + unchecked { + if((Tables != null)) + { + hashcode = (hashcode * 397) + TCollections.GetHashCode(Tables); + } + if((PreloadTableIds != null) && __isset.preloadTableIds) + { + hashcode = (hashcode * 397) + TCollections.GetHashCode(PreloadTableIds); + } + hashcode = (hashcode * 397) + Version.GetHashCode(); + if((GenerateTime != null) && __isset.generateTime) + { + hashcode = (hashcode * 397) + GenerateTime.GetHashCode(); + } + } + return hashcode; + } + + public override string ToString() + { + var tmp25 = new StringBuilder("ArtResourceConfig("); + if((Tables != null)) + { + tmp25.Append(", Tables: "); + Tables.ToString(tmp25); + } + if((PreloadTableIds != null) && __isset.preloadTableIds) + { + tmp25.Append(", PreloadTableIds: "); + PreloadTableIds.ToString(tmp25); + } + tmp25.Append(", Version: "); + Version.ToString(tmp25); + if((GenerateTime != null) && __isset.generateTime) + { + tmp25.Append(", GenerateTime: "); + GenerateTime.ToString(tmp25); + } + tmp25.Append(')'); + return tmp25.ToString(); + } + } + +} diff --git a/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtResourceConfig.cs.meta b/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtResourceConfig.cs.meta new file mode 100644 index 00000000..67ac30d8 --- /dev/null +++ b/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtResourceConfig.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5dd576b0b43cfec459d8aa0627293ce0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtTable.cs b/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtTable.cs new file mode 100644 index 00000000..7ccd9e1d --- /dev/null +++ b/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtTable.cs @@ -0,0 +1,265 @@ +/** + * + * Autogenerated by Thrift Compiler (0.22.0) + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.Runtime.Serialization; +using Thrift.Protocol; +using Thrift.Protocol.Entities; +using Thrift.Protocol.Utilities; +using Thrift.Transport; +using Thrift.Transport.Client; + + +#pragma warning disable IDE0079 // remove unnecessary pragmas +#pragma warning disable IDE0017 // object init can be simplified +#pragma warning disable IDE0028 // collection init can be simplified +#pragma warning disable IDE0305 // collection init can be simplified +#pragma warning disable IDE0034 // simplify default expression +#pragma warning disable IDE0066 // use switch expression +#pragma warning disable IDE0090 // simplify new expression +#pragma warning disable IDE0290 // use primary CTOR +#pragma warning disable IDE1006 // parts of the code use IDL spelling +#pragma warning disable CA1822 // empty DeepCopy() methods still non-static +#pragma warning disable IDE0083 // pattern matching "that is not SomeType" requires net5.0 but we still support earlier versions + +namespace Byway.Thrift.Data +{ + + /// + /// 资源表 + /// + [DataContract(Namespace="")] + public partial class ArtTable : TBase + { + + [DataMember(Order = 0)] + public int TableId { get; set; } + + [DataMember(Order = 0)] + public string TableName { get; set; } + + [DataMember(Order = 0)] + public List Items { get; set; } + + public ArtTable() + { + } + + public ArtTable(int tableId, string tableName, List @items) : this() + { + this.TableId = tableId; + this.TableName = tableName; + this.Items = @items; + } + + public ArtTable DeepCopy() + { + var tmp5 = new ArtTable(); + tmp5.TableId = this.TableId; + if((TableName != null)) + { + tmp5.TableName = this.TableName; + } + if((Items != null)) + { + tmp5.Items = this.Items.DeepCopy(); + } + return tmp5; + } + + public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_tableId = false; + bool isset_tableName = false; + bool isset_items = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + TableId = await iprot.ReadI32Async(cancellationToken); + isset_tableId = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.String) + { + TableName = await iprot.ReadStringAsync(cancellationToken); + isset_tableName = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.List) + { + { + var _list6 = await iprot.ReadListBeginAsync(cancellationToken); + Items = new List(_list6.Count); + for(int _i7 = 0; _i7 < _list6.Count; ++_i7) + { + global::Byway.Thrift.Data.ArtItem _elem8; + _elem8 = new global::Byway.Thrift.Data.ArtItem(); + await _elem8.ReadAsync(iprot, cancellationToken); + Items.Add(_elem8); + } + await iprot.ReadListEndAsync(cancellationToken); + } + isset_items = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_tableId) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_tableName) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_items) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var tmp9 = new TStruct("ArtTable"); + await oprot.WriteStructBeginAsync(tmp9, cancellationToken); + var tmp10 = new TField(); + tmp10.Name = "tableId"; + tmp10.Type = TType.I32; + tmp10.ID = 1; + await oprot.WriteFieldBeginAsync(tmp10, cancellationToken); + await oprot.WriteI32Async(TableId, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + if((TableName != null)) + { + tmp10.Name = "tableName"; + tmp10.Type = TType.String; + tmp10.ID = 2; + await oprot.WriteFieldBeginAsync(tmp10, cancellationToken); + await oprot.WriteStringAsync(TableName, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if((Items != null)) + { + tmp10.Name = "items"; + tmp10.Type = TType.List; + tmp10.ID = 3; + await oprot.WriteFieldBeginAsync(tmp10, cancellationToken); + await oprot.WriteListBeginAsync(new TList(TType.Struct, Items.Count), cancellationToken); + foreach (global::Byway.Thrift.Data.ArtItem _iter11 in Items) + { + await _iter11.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override bool Equals(object that) + { + if (!(that is ArtTable other)) return false; + if (ReferenceEquals(this, other)) return true; + return global::System.Object.Equals(TableId, other.TableId) + && global::System.Object.Equals(TableName, other.TableName) + && TCollections.Equals(Items, other.Items); + } + + public override int GetHashCode() { + int hashcode = 157; + unchecked { + hashcode = (hashcode * 397) + TableId.GetHashCode(); + if((TableName != null)) + { + hashcode = (hashcode * 397) + TableName.GetHashCode(); + } + if((Items != null)) + { + hashcode = (hashcode * 397) + TCollections.GetHashCode(Items); + } + } + return hashcode; + } + + public override string ToString() + { + var tmp12 = new StringBuilder("ArtTable("); + tmp12.Append(", TableId: "); + TableId.ToString(tmp12); + if((TableName != null)) + { + tmp12.Append(", TableName: "); + TableName.ToString(tmp12); + } + if((Items != null)) + { + tmp12.Append(", Items: "); + Items.ToString(tmp12); + } + tmp12.Append(')'); + return tmp12.ToString(); + } + } + +} diff --git a/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtTable.cs.meta b/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtTable.cs.meta new file mode 100644 index 00000000..340b9254 --- /dev/null +++ b/Art_Scripts/gen-netstd/Byway/Thrift/Data/ArtTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d527a6fcc7860a44983ae072a2f75a9f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Art_Scripts/gen-netstd/Byway/Thrift/Data/AtlasConfig.Extensions.cs b/Art_Scripts/gen-netstd/Byway/Thrift/Data/AtlasConfig.Extensions.cs new file mode 100644 index 00000000..493f13dc --- /dev/null +++ b/Art_Scripts/gen-netstd/Byway/Thrift/Data/AtlasConfig.Extensions.cs @@ -0,0 +1,92 @@ +/** + * + * Autogenerated by Thrift Compiler (0.22.0) + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.Runtime.Serialization; +using Thrift.Protocol; + + +#pragma warning disable IDE0079 // remove unnecessary pragmas +#pragma warning disable IDE0017 // object init can be simplified +#pragma warning disable IDE0028 // collection init can be simplified +#pragma warning disable IDE0305 // collection init can be simplified +#pragma warning disable IDE0034 // simplify default expression +#pragma warning disable IDE0066 // use switch expression +#pragma warning disable IDE0090 // simplify new expression +#pragma warning disable IDE0290 // use primary CTOR +#pragma warning disable IDE1006 // parts of the code use IDL spelling +#pragma warning disable CA1822 // empty DeepCopy() methods still non-static +#pragma warning disable IDE0083 // pattern matching "that is not SomeType" requires net5.0 but we still support earlier versions + +namespace Byway.Thrift.Data +{ + public static class AtlasConfigExtensions + { + public static bool Equals(this List instance, object that) + { + if (!(that is List other)) return false; + if (ReferenceEquals(instance, other)) return true; + + return TCollections.Equals(instance, other); + } + + + public static int GetHashCode(this List instance) + { + return TCollections.GetHashCode(instance); + } + + + public static List DeepCopy(this List source) + { + if (source == null) + return null; + + var tmp18 = new List(source.Count); + foreach (var elem in source) + tmp18.Add((elem != null) ? elem.DeepCopy() : null); + return tmp18; + } + + + public static bool Equals(this List instance, object that) + { + if (!(that is List other)) return false; + if (ReferenceEquals(instance, other)) return true; + + return TCollections.Equals(instance, other); + } + + + public static int GetHashCode(this List instance) + { + return TCollections.GetHashCode(instance); + } + + + public static List DeepCopy(this List source) + { + if (source == null) + return null; + + var tmp19 = new List(source.Count); + foreach (var elem in source) + tmp19.Add((elem != null) ? elem : null); + return tmp19; + } + + + } +} diff --git a/Art_Scripts/gen-netstd/Byway/Thrift/Data/AtlasConfig.Extensions.cs.meta b/Art_Scripts/gen-netstd/Byway/Thrift/Data/AtlasConfig.Extensions.cs.meta new file mode 100644 index 00000000..0c75d1a2 --- /dev/null +++ b/Art_Scripts/gen-netstd/Byway/Thrift/Data/AtlasConfig.Extensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: eb43d0f74ccd367459662968312c8e6b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/Art_Tools/ArtBytesViewer.cs b/Editor/Art_Tools/ArtBytesViewer.cs new file mode 100644 index 00000000..a3d9d4c8 --- /dev/null +++ b/Editor/Art_Tools/ArtBytesViewer.cs @@ -0,0 +1,452 @@ +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Thrift; +using Thrift.Protocol; +using Thrift.Transport; +using Thrift.Transport.Client; +using Byway.Thrift.Data; + +namespace ArtTools +{ + /// + /// 美术资源Bytes文件查看器 + /// 用于查看ArtResourceConfig.bytes和ArtAtlasConfig.bytes的内容 + /// + public class ArtBytesViewer : EditorWindow + { + private enum ViewMode + { + ArtResourceConfig, + AtlasConfig + } + + private ViewMode currentMode = ViewMode.ArtResourceConfig; + private Vector2 scrollPosition; + private Vector2 tableListScrollPosition; + private Vector2 itemListScrollPosition; + + // ArtResourceConfig相关 + private ArtResourceConfig artConfig; + private int selectedTableIndex = -1; + private string tableSearchText = ""; + private string itemSearchText = ""; + + // AtlasConfig相关 + private ArtAtlasConfig atlasConfig; + private int selectedAtlasIndex = -1; + private string atlasSearchText = ""; + + // 文件信息 + private string artConfigPath = "Assets/Art_SubModule/Art_Bytes/ArtResourceConfig.bytes"; + private string atlasConfigPath = "Assets/Art_SubModule/Art_Bytes/ArtAtlasConfig.bytes"; + private FileInfo artConfigFileInfo; + private FileInfo atlasConfigFileInfo; + + [MenuItem("美术工具/Thrift/Bytes查看器")] + public static void ShowWindow() + { + var window = GetWindow("美术资源Bytes查看器"); + window.minSize = new Vector2(800, 600); + window.Show(); + } + + private void OnEnable() + { + LoadBytesFiles(); + } + + private void OnGUI() + { + EditorGUILayout.BeginVertical(); + + // 顶部工具栏 + DrawToolbar(); + + EditorGUILayout.Space(5); + + // 根据模式显示不同内容 + if (currentMode == ViewMode.ArtResourceConfig) + { + DrawArtResourceConfigView(); + } + else + { + DrawAtlasConfigView(); + } + + EditorGUILayout.EndVertical(); + } + + private void DrawToolbar() + { + EditorGUILayout.BeginHorizontal(EditorStyles.toolbar); + + // 模式切换 + if (GUILayout.Toggle(currentMode == ViewMode.ArtResourceConfig, "美术资源配置", EditorStyles.toolbarButton)) + { + if (currentMode != ViewMode.ArtResourceConfig) + { + currentMode = ViewMode.ArtResourceConfig; + selectedTableIndex = -1; + } + } + + if (GUILayout.Toggle(currentMode == ViewMode.AtlasConfig, "图集配置", EditorStyles.toolbarButton)) + { + if (currentMode != ViewMode.AtlasConfig) + { + currentMode = ViewMode.AtlasConfig; + selectedAtlasIndex = -1; + } + } + + GUILayout.FlexibleSpace(); + + // 刷新按钮 + if (GUILayout.Button("🔄 刷新", EditorStyles.toolbarButton, GUILayout.Width(60))) + { + LoadBytesFiles(); + } + + EditorGUILayout.EndHorizontal(); + } + + private void LoadBytesFiles() + { + // 加载ArtResourceConfig + try + { + string fullArtPath = Path.Combine(Application.dataPath, "..", artConfigPath); + if (File.Exists(fullArtPath)) + { + byte[] bytes = File.ReadAllBytes(fullArtPath); + artConfigFileInfo = new FileInfo(fullArtPath); + + using (var transport = new TMemoryBufferTransport(bytes, new TConfiguration())) + { + using (var protocol = new TBinaryProtocol(transport)) + { + artConfig = new ArtResourceConfig(); + artConfig.ReadAsync(protocol, System.Threading.CancellationToken.None).GetAwaiter().GetResult(); + } + } + + Debug.Log($"[ArtBytesViewer] 成功加载 ArtResourceConfig.bytes ({bytes.Length / 1024f:F2} KB, {artConfig.Tables.Count} 个表)"); + } + else + { + Debug.LogWarning($"[ArtBytesViewer] 找不到文件: {fullArtPath}"); + } + } + catch (System.Exception ex) + { + Debug.LogError($"[ArtBytesViewer] 加载ArtResourceConfig失败: {ex.Message}"); + } + + // 加载AtlasConfig + try + { + string fullAtlasPath = Path.Combine(Application.dataPath, "..", atlasConfigPath); + if (File.Exists(fullAtlasPath)) + { + byte[] bytes = File.ReadAllBytes(fullAtlasPath); + atlasConfigFileInfo = new FileInfo(fullAtlasPath); + + using (var transport = new TMemoryBufferTransport(bytes, new TConfiguration())) + { + using (var protocol = new TBinaryProtocol(transport)) + { + atlasConfig = new ArtAtlasConfig(); + atlasConfig.ReadAsync(protocol, System.Threading.CancellationToken.None).GetAwaiter().GetResult(); + } + } + + Debug.Log($"[ArtBytesViewer] 成功加载 ArtAtlasConfig.bytes ({bytes.Length / 1024f:F2} KB, {atlasConfig.Atlases.Count} 个图集)"); + } + else + { + Debug.LogWarning($"[ArtBytesViewer] 找不到文件: {fullAtlasPath}"); + } + } + catch (System.Exception ex) + { + Debug.LogError($"[ArtBytesViewer] 加载AtlasConfig失败: {ex.Message}"); + } + } + + private void DrawArtResourceConfigView() + { + if (artConfig == null) + { + EditorGUILayout.HelpBox("未加载ArtResourceConfig.bytes\n请确保文件存在: " + artConfigPath, MessageType.Warning); + return; + } + + // 文件信息 + EditorGUILayout.BeginVertical(EditorStyles.helpBox); + EditorGUILayout.LabelField("文件信息", EditorStyles.boldLabel); + EditorGUILayout.LabelField($"路径: {artConfigPath}"); + if (artConfigFileInfo != null) + { + EditorGUILayout.LabelField($"大小: {artConfigFileInfo.Length / 1024f:F2} KB"); + EditorGUILayout.LabelField($"修改时间: {artConfigFileInfo.LastWriteTime:yyyy-MM-dd HH:mm:ss}"); + } + EditorGUILayout.LabelField($"表数量: {artConfig.Tables.Count}"); + EditorGUILayout.LabelField($"版本: {artConfig.Version}"); + if (!string.IsNullOrEmpty(artConfig.GenerateTime)) + { + EditorGUILayout.LabelField($"生成时间: {artConfig.GenerateTime}"); + } + if (artConfig.PreloadTableIds != null && artConfig.PreloadTableIds.Count > 0) + { + EditorGUILayout.LabelField($"预加载表: {string.Join(", ", artConfig.PreloadTableIds)}"); + } + EditorGUILayout.EndVertical(); + + EditorGUILayout.Space(5); + + // 两栏布局 + EditorGUILayout.BeginHorizontal(); + + // 左侧:表列表 + EditorGUILayout.BeginVertical(GUILayout.Width(250)); + EditorGUILayout.LabelField("资源表列表", EditorStyles.boldLabel); + + // 搜索框 + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("搜索:", GUILayout.Width(40)); + tableSearchText = EditorGUILayout.TextField(tableSearchText); + EditorGUILayout.EndHorizontal(); + + tableListScrollPosition = EditorGUILayout.BeginScrollView(tableListScrollPosition, EditorStyles.helpBox); + + var filteredTables = artConfig.Tables; + if (!string.IsNullOrEmpty(tableSearchText)) + { + filteredTables = artConfig.Tables.Where(t => + t.TableName.ToLower().Contains(tableSearchText.ToLower()) || + t.TableId.ToString().Contains(tableSearchText) + ).ToList(); + } + + for (int i = 0; i < filteredTables.Count; i++) + { + var table = filteredTables[i]; + bool isSelected = selectedTableIndex == artConfig.Tables.IndexOf(table); + + var style = new GUIStyle(GUI.skin.button); + style.alignment = TextAnchor.MiddleLeft; + if (isSelected) + { + style.normal.background = Texture2D.grayTexture; + } + + if (GUILayout.Button($"[{table.TableId}] {table.TableName} ({table.Items.Count})", style)) + { + selectedTableIndex = artConfig.Tables.IndexOf(table); + } + } + + EditorGUILayout.EndScrollView(); + EditorGUILayout.EndVertical(); + + // 右侧:详细信息 + EditorGUILayout.BeginVertical(); + if (selectedTableIndex >= 0 && selectedTableIndex < artConfig.Tables.Count) + { + var selectedTable = artConfig.Tables[selectedTableIndex]; + + EditorGUILayout.LabelField($"表: {selectedTable.TableName} (ID: {selectedTable.TableId})", EditorStyles.boldLabel); + EditorGUILayout.LabelField($"资源项数量: {selectedTable.Items.Count}"); + + EditorGUILayout.Space(5); + + // 资源项搜索 + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("筛选:", GUILayout.Width(40)); + itemSearchText = EditorGUILayout.TextField(itemSearchText); + EditorGUILayout.EndHorizontal(); + + // 资源项列表 + itemListScrollPosition = EditorGUILayout.BeginScrollView(itemListScrollPosition); + + var filteredItems = selectedTable.Items; + if (!string.IsNullOrEmpty(itemSearchText)) + { + filteredItems = selectedTable.Items.Where(item => + item.Name.ToLower().Contains(itemSearchText.ToLower()) || + item.Id.ToString().Contains(itemSearchText) || + (!string.IsNullOrEmpty(item.Desc) && item.Desc.ToLower().Contains(itemSearchText.ToLower())) + ).ToList(); + } + + // 表头 + EditorGUILayout.BeginHorizontal(EditorStyles.toolbar); + EditorGUILayout.LabelField("ID", EditorStyles.boldLabel, GUILayout.Width(50)); + EditorGUILayout.LabelField("名称", EditorStyles.boldLabel, GUILayout.Width(150)); + EditorGUILayout.LabelField("描述", EditorStyles.boldLabel, GUILayout.Width(200)); + EditorGUILayout.LabelField("Sprite", EditorStyles.boldLabel, GUILayout.Width(80)); + EditorGUILayout.LabelField("Spine", EditorStyles.boldLabel, GUILayout.Width(80)); + EditorGUILayout.EndHorizontal(); + + foreach (var item in filteredItems) + { + EditorGUILayout.BeginVertical(EditorStyles.helpBox); + + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField(item.Id.ToString(), GUILayout.Width(50)); + EditorGUILayout.LabelField(item.Name, GUILayout.Width(150)); + EditorGUILayout.LabelField(item.Desc ?? "", GUILayout.Width(200)); + EditorGUILayout.LabelField(string.IsNullOrEmpty(item.SpritePath) ? "-" : "✓", GUILayout.Width(80)); + EditorGUILayout.LabelField(string.IsNullOrEmpty(item.SpineAssetPath) ? "-" : "✓", GUILayout.Width(80)); + EditorGUILayout.EndHorizontal(); + + // 详细路径信息 + if (!string.IsNullOrEmpty(item.SpritePath)) + { + EditorGUI.indentLevel++; + EditorGUILayout.LabelField("Sprite路径:", item.SpritePath, EditorStyles.wordWrappedLabel); + EditorGUI.indentLevel--; + } + + if (!string.IsNullOrEmpty(item.SpineAssetPath)) + { + EditorGUI.indentLevel++; + EditorGUILayout.LabelField("Spine路径:", item.SpineAssetPath, EditorStyles.wordWrappedLabel); + if (!string.IsNullOrEmpty(item.SpineAnimName)) + { + EditorGUILayout.LabelField("动画名:", item.SpineAnimName); + } + EditorGUI.indentLevel--; + } + + EditorGUILayout.EndVertical(); + } + + EditorGUILayout.EndScrollView(); + + EditorGUILayout.LabelField($"显示: {filteredItems.Count} / {selectedTable.Items.Count} 项"); + } + else + { + EditorGUILayout.HelpBox("请在左侧选择一个资源表", MessageType.Info); + } + + EditorGUILayout.EndVertical(); + + EditorGUILayout.EndHorizontal(); + } + + private void DrawAtlasConfigView() + { + if (atlasConfig == null) + { + EditorGUILayout.HelpBox("未加载ArtAtlasConfig.bytes\n请确保文件存在: " + atlasConfigPath, MessageType.Warning); + return; + } + + // 文件信息 + EditorGUILayout.BeginVertical(EditorStyles.helpBox); + EditorGUILayout.LabelField("文件信息", EditorStyles.boldLabel); + EditorGUILayout.LabelField($"路径: {atlasConfigPath}"); + if (atlasConfigFileInfo != null) + { + EditorGUILayout.LabelField($"大小: {atlasConfigFileInfo.Length / 1024f:F2} KB"); + EditorGUILayout.LabelField($"修改时间: {atlasConfigFileInfo.LastWriteTime:yyyy-MM-dd HH:mm:ss}"); + } + EditorGUILayout.LabelField($"图集数量: {atlasConfig.Atlases.Count}"); + EditorGUILayout.LabelField($"版本: {atlasConfig.Version}"); + if (!string.IsNullOrEmpty(atlasConfig.GenerateTime)) + { + EditorGUILayout.LabelField($"生成时间: {atlasConfig.GenerateTime}"); + } + EditorGUILayout.EndVertical(); + + EditorGUILayout.Space(5); + + // 两栏布局 + EditorGUILayout.BeginHorizontal(); + + // 左侧:图集列表 + EditorGUILayout.BeginVertical(GUILayout.Width(250)); + EditorGUILayout.LabelField("图集列表", EditorStyles.boldLabel); + + // 搜索框 + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("搜索:", GUILayout.Width(40)); + atlasSearchText = EditorGUILayout.TextField(atlasSearchText); + EditorGUILayout.EndHorizontal(); + + tableListScrollPosition = EditorGUILayout.BeginScrollView(tableListScrollPosition, EditorStyles.helpBox); + + var filteredAtlases = atlasConfig.Atlases; + if (!string.IsNullOrEmpty(atlasSearchText)) + { + filteredAtlases = atlasConfig.Atlases.Where(a => + a.Name.ToLower().Contains(atlasSearchText.ToLower()) + ).ToList(); + } + + for (int i = 0; i < filteredAtlases.Count; i++) + { + var atlas = filteredAtlases[i]; + bool isSelected = selectedAtlasIndex == atlasConfig.Atlases.IndexOf(atlas); + + var style = new GUIStyle(GUI.skin.button); + style.alignment = TextAnchor.MiddleLeft; + if (isSelected) + { + style.normal.background = Texture2D.grayTexture; + } + + if (GUILayout.Button($"{atlas.Name} ({atlas.SpritePaths.Count})", style)) + { + selectedAtlasIndex = atlasConfig.Atlases.IndexOf(atlas); + } + } + + EditorGUILayout.EndScrollView(); + EditorGUILayout.EndVertical(); + + // 右侧:详细信息 + EditorGUILayout.BeginVertical(); + if (selectedAtlasIndex >= 0 && selectedAtlasIndex < atlasConfig.Atlases.Count) + { + var selectedAtlas = atlasConfig.Atlases[selectedAtlasIndex]; + + EditorGUILayout.LabelField($"图集: {selectedAtlas.Name}", EditorStyles.boldLabel); + EditorGUILayout.LabelField($"Sprite数量: {selectedAtlas.SpritePaths.Count}"); + + EditorGUILayout.Space(5); + + // Sprite路径列表 + itemListScrollPosition = EditorGUILayout.BeginScrollView(itemListScrollPosition); + + EditorGUILayout.LabelField("包含的Sprite路径:", EditorStyles.boldLabel); + + int index = 1; + foreach (var spritePath in selectedAtlas.SpritePaths) + { + EditorGUILayout.BeginHorizontal(EditorStyles.helpBox); + EditorGUILayout.LabelField(index.ToString(), GUILayout.Width(30)); + EditorGUILayout.LabelField(spritePath, EditorStyles.wordWrappedLabel); + EditorGUILayout.EndHorizontal(); + index++; + } + + EditorGUILayout.EndScrollView(); + } + else + { + EditorGUILayout.HelpBox("请在左侧选择一个图集", MessageType.Info); + } + + EditorGUILayout.EndVertical(); + + EditorGUILayout.EndHorizontal(); + } + } +} diff --git a/Editor/Art_Tools/ArtBytesViewer.cs.meta b/Editor/Art_Tools/ArtBytesViewer.cs.meta new file mode 100644 index 00000000..8e9d2a75 --- /dev/null +++ b/Editor/Art_Tools/ArtBytesViewer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 511cdd52699ebbf4881364398fd09de6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/Art_Tools/ArtResourceConfigEditor.cs b/Editor/Art_Tools/ArtResourceConfigEditor.cs index cbdd1d28..991200ee 100644 --- a/Editor/Art_Tools/ArtResourceConfigEditor.cs +++ b/Editor/Art_Tools/ArtResourceConfigEditor.cs @@ -6,6 +6,10 @@ using System.IO; using ArtResource; using Spine.Unity; using UnityEngine.U2D; +using Thrift; +using Thrift.Protocol; +using Thrift.Transport; +using Thrift.Transport.Client; namespace EditorArt_Tools { @@ -17,6 +21,7 @@ namespace EditorArt_Tools { private const string SO_ROOT_PATH = "Assets/Art_SubModule/Art_SO"; private const string JSON_ROOT_PATH = "Assets/Art_SubModule/Art_Json"; + private const string BYTES_ROOT_PATH = "Assets/Art_SubModule/Art_Bytes"; // ===== 数据 ===== private List allTables = new List(); @@ -1256,8 +1261,14 @@ namespace EditorArt_Tools // 同步JSON SyncToJson(selectedTable); + // 同步Thrift Bytes(新增) + SyncToThriftBytes(selectedTable); + // 更新manifest文件 UpdateManifest(); + + // 生成合并的Bytes文件 + GenerateMergedThriftBytes(); hasUnsavedChanges = false; @@ -1417,6 +1428,241 @@ namespace EditorArt_Tools } } + /// + /// 将单个表同步到Thrift Bytes格式(单表文件,暂不使用) + /// + private void SyncToThriftBytes(ArtTableSO table) + { + // 注意:这个方法生成单表bytes,但我们实际使用的是GenerateMergedThriftBytes() + // 保留此方法以防将来需要单表加载 + Debug.Log($"[ArtResourceConfigEditor] 跳过单表Bytes生成: {table.TableName}(使用合并模式)"); + } + + /// + /// 生成合并的Thrift Bytes文件(所有表合并) + /// 参考 ConfigManager 的加载方式 + /// + private void GenerateMergedThriftBytes() + { + try + { + var startTime = System.Diagnostics.Stopwatch.StartNew(); + + // 确保输出目录存在 + if (!Directory.Exists(BYTES_ROOT_PATH)) + { + Directory.CreateDirectory(BYTES_ROOT_PATH); + } + + string outputPath = Path.Combine(BYTES_ROOT_PATH, "ArtResourceConfig.bytes"); + + // 加载所有SO表 + string[] allSOGuids = AssetDatabase.FindAssets("t:ArtTableSO", new[] { SO_ROOT_PATH }); + List allSOTables = new List(); + + foreach (string guid in allSOGuids) + { + string path = AssetDatabase.GUIDToAssetPath(guid); + ArtTableSO table = AssetDatabase.LoadAssetAtPath(path); + if (table != null) + { + allSOTables.Add(table); + } + } + + // 创建Thrift数据结构 + var thriftConfig = new Byway.Thrift.Data.ArtResourceConfig + { + Tables = new List(), + Version = System.DateTimeOffset.UtcNow.ToUnixTimeSeconds(), + GenerateTime = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + }; + + // 转换所有表 + foreach (var soTable in allSOTables) + { + var thriftTable = new Byway.Thrift.Data.ArtTable + { + TableId = soTable.TableId, + TableName = soTable.TableName, + Items = new List() + }; + + foreach (var soItem in soTable.Items) + { + var thriftItem = new Byway.Thrift.Data.ArtItem + { + Id = soItem.Id, + Name = soItem.Name ?? "", + Desc = soItem.Desc ?? "", + SpritePath = soItem.Sprite != null ? AssetDatabase.GetAssetPath(soItem.Sprite) : "", + SpineAssetPath = soItem.SpineAsset != null ? AssetDatabase.GetAssetPath(soItem.SpineAsset) : "", + SpineAnimName = soItem.SpineAnimName ?? "" + }; + + thriftTable.Items.Add(thriftItem); + } + + thriftConfig.Tables.Add(thriftTable); + } + + // 加载预加载配置(从manifest读取) + const string MANIFEST_PATH = "Assets/Art_SubModule/Art_Json/art_table_manifest.json"; + if (File.Exists(MANIFEST_PATH)) + { + string manifestJson = File.ReadAllText(MANIFEST_PATH); + var manifest = JsonUtility.FromJson(manifestJson); + if (manifest != null && manifest.preloadTableIds != null) + { + thriftConfig.PreloadTableIds = manifest.preloadTableIds.ToList(); + } + } + + // 序列化到bytes + byte[] bytesData; + using (var memoryStream = new MemoryStream()) + { + using (var transport = new TStreamTransport(null, memoryStream, new TConfiguration())) + { + using (var protocol = new TBinaryProtocol(transport)) + { + thriftConfig.WriteAsync(protocol, System.Threading.CancellationToken.None).GetAwaiter().GetResult(); + } + } + bytesData = memoryStream.ToArray(); + } + + // 写入文件 + File.WriteAllBytes(outputPath, bytesData); + AssetDatabase.ImportAsset(outputPath); + + startTime.Stop(); + + Debug.Log($"[ArtResourceConfigEditor] ✅ Thrift Bytes生成成功!\n" + + $" 路径: {outputPath}\n" + + $" 表数量: {thriftConfig.Tables.Count}\n" + + $" 文件大小: {bytesData.Length / 1024f:F2} KB\n" + + $" 耗时: {startTime.ElapsedMilliseconds} ms"); + } + catch (System.Exception ex) + { + Debug.LogError($"[ArtResourceConfigEditor] ❌ 生成Thrift Bytes失败: {ex.Message}\n{ex.StackTrace}"); + } + } + + /// + /// 静态版本:生成合并的Thrift Bytes文件(供外部工具调用) + /// + public static void GenerateMergedThriftBytesStatic() + { + try + { + var startTime = System.Diagnostics.Stopwatch.StartNew(); + + // 确保输出目录存在 + const string BYTES_ROOT_PATH = "Assets/Art_SubModule/Art_Bytes"; + if (!Directory.Exists(BYTES_ROOT_PATH)) + { + Directory.CreateDirectory(BYTES_ROOT_PATH); + } + + string outputPath = Path.Combine(BYTES_ROOT_PATH, "ArtResourceConfig.bytes"); + + // 加载所有SO表 + const string SO_ROOT_PATH = "Assets/Art_SubModule/Art_SO"; + string[] allSOGuids = AssetDatabase.FindAssets("t:ArtTableSO", new[] { SO_ROOT_PATH }); + List allSOTables = new List(); + + foreach (string guid in allSOGuids) + { + string path = AssetDatabase.GUIDToAssetPath(guid); + ArtTableSO table = AssetDatabase.LoadAssetAtPath(path); + if (table != null) + { + allSOTables.Add(table); + } + } + + // 创建Thrift数据结构 + var thriftConfig = new Byway.Thrift.Data.ArtResourceConfig + { + Tables = new List(), + Version = System.DateTimeOffset.UtcNow.ToUnixTimeSeconds(), + GenerateTime = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + }; + + // 转换所有表 + foreach (var soTable in allSOTables) + { + var thriftTable = new Byway.Thrift.Data.ArtTable + { + TableId = soTable.TableId, + TableName = soTable.TableName, + Items = new List() + }; + + foreach (var soItem in soTable.Items) + { + var thriftItem = new Byway.Thrift.Data.ArtItem + { + Id = soItem.Id, + Name = soItem.Name ?? "", + Desc = soItem.Desc ?? "", + SpritePath = soItem.Sprite != null ? AssetDatabase.GetAssetPath(soItem.Sprite) : "", + SpineAssetPath = soItem.SpineAsset != null ? AssetDatabase.GetAssetPath(soItem.SpineAsset) : "", + SpineAnimName = soItem.SpineAnimName ?? "" + }; + + thriftTable.Items.Add(thriftItem); + } + + thriftConfig.Tables.Add(thriftTable); + } + + // 加载预加载配置(从manifest读取) + const string MANIFEST_PATH = "Assets/Art_SubModule/Art_Json/art_table_manifest.json"; + if (File.Exists(MANIFEST_PATH)) + { + string manifestJson = File.ReadAllText(MANIFEST_PATH); + var manifest = JsonUtility.FromJson(manifestJson); + if (manifest != null && manifest.preloadTableIds != null) + { + thriftConfig.PreloadTableIds = manifest.preloadTableIds.ToList(); + } + } + + // 序列化到bytes + byte[] bytesData; + using (var memoryStream = new MemoryStream()) + { + using (var transport = new TStreamTransport(null, memoryStream, new TConfiguration())) + { + using (var protocol = new TBinaryProtocol(transport)) + { + thriftConfig.WriteAsync(protocol, System.Threading.CancellationToken.None).GetAwaiter().GetResult(); + } + } + bytesData = memoryStream.ToArray(); + } + + // 写入文件 + File.WriteAllBytes(outputPath, bytesData); + AssetDatabase.ImportAsset(outputPath); + + startTime.Stop(); + + Debug.Log($"[ArtResourceConfigEditor] ✅ Thrift Bytes生成成功!\n" + + $" 路径: {outputPath}\n" + + $" 表数量: {thriftConfig.Tables.Count}\n" + + $" 文件大小: {bytesData.Length / 1024f:F2} KB\n" + + $" 耗时: {startTime.ElapsedMilliseconds} ms"); + } + catch (System.Exception ex) + { + Debug.LogError($"[ArtResourceConfigEditor] ❌ 生成Thrift Bytes失败: {ex.Message}\n{ex.StackTrace}"); + } + } + [System.Serializable] public class ArtTableManifest { diff --git a/Editor/Art_Tools/ArtResourcePathFiller.cs b/Editor/Art_Tools/ArtResourcePathFiller.cs index f163a66f..7ce67664 100644 --- a/Editor/Art_Tools/ArtResourcePathFiller.cs +++ b/Editor/Art_Tools/ArtResourcePathFiller.cs @@ -85,6 +85,9 @@ namespace ArtTools // 同步到JSON SyncToJson(table); + + // 注意:不在这里生成Bytes,因为单个表更新会频繁触发 + // 批量操作完成后统一生成Bytes } } @@ -133,6 +136,37 @@ namespace ArtTools } } + /// + /// 生成合并的Thrift Bytes文件(调用ArtResourceConfigEditor的方法) + /// + public static void GenerateMergedThriftBytes() + { + try + { + // 通过反射调用ArtResourceConfigEditor的GenerateMergedThriftBytes方法 + // 因为那是一个实例方法,我们需要找到编辑器窗口实例或使用静态版本 + var editorType = System.Type.GetType("ArtTools.ArtResourceConfigEditor,Assembly-CSharp-Editor"); + if (editorType != null) + { + var method = editorType.GetMethod("GenerateMergedThriftBytesStatic", + System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static); + + if (method != null) + { + method.Invoke(null, null); + } + else + { + Debug.LogWarning("[ArtResourcePathFiller] 未找到GenerateMergedThriftBytesStatic方法,请手动运行【美术工具/Thrift/批量生成所有Bytes文件】"); + } + } + } + catch (System.Exception ex) + { + Debug.LogError($"[ArtResourcePathFiller] 生成Thrift Bytes失败: {ex.Message}"); + } + } + /// /// 手动批量更新所有ArtTableSO的资源路径 /// @@ -176,11 +210,16 @@ namespace ArtTools // 保存所有修改 AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); + + // 生成合并的Thrift Bytes文件 + EditorUtility.DisplayProgressBar("生成Thrift Bytes", "正在生成配置文件...", 0.9f); + GenerateMergedThriftBytes(); + EditorUtility.ClearProgressBar(); - Debug.Log($"[ArtResourcePathFiller] ✓ 批量更新完成: 处理了 {updatedCount} 个ArtTableSO,已同步JSON配置"); + Debug.Log($"[ArtResourcePathFiller] ✓ 批量更新完成: 处理了 {updatedCount} 个ArtTableSO,已同步JSON配置和Thrift Bytes"); EditorUtility.DisplayDialog( "更新完成", - $"已更新 {updatedCount} 个美术资源表的路径信息\n并同步更新了JSON配置文件\n\n现在可以在Runtime模式下正常加载资源了", + $"已更新 {updatedCount} 个美术资源表的路径信息\n并同步更新了JSON配置文件和Thrift Bytes\n\n现在可以在Runtime模式下正常加载资源了", "确定" ); } @@ -309,7 +348,11 @@ namespace ArtTools ArtResourcePathFiller.FillResourcePaths(table); EditorUtility.SetDirty(table); AssetDatabase.SaveAssets(); - EditorUtility.DisplayDialog("更新完成", $"已更新 {table.TableName} 的资源路径", "确定"); + + // 重新生成合并的Thrift Bytes + ArtResourcePathFiller.GenerateMergedThriftBytes(); + + EditorUtility.DisplayDialog("更新完成", $"已更新 {table.TableName} 的资源路径\n并重新生成了Thrift Bytes配置", "确定"); } EditorGUILayout.Space(5); diff --git a/Editor/Art_Tools/ArtResourceThriftMenu.cs b/Editor/Art_Tools/ArtResourceThriftMenu.cs new file mode 100644 index 00000000..c189dfc1 --- /dev/null +++ b/Editor/Art_Tools/ArtResourceThriftMenu.cs @@ -0,0 +1,187 @@ +using UnityEditor; +using UnityEngine; + +namespace EditorArt_Tools +{ + /// + /// 美术资源Thrift工具菜单 + /// + public class ArtResourceThriftMenu + { + [MenuItem("美术工具/Thrift/批量生成所有Bytes文件", priority = 100)] + public static void GenerateAllBytesFiles() + { + if (!EditorUtility.DisplayDialog("生成Bytes文件", + "此操作将:\n" + + "1. 扫描所有SO表,生成 ArtResourceConfig.bytes\n" + + "2. 读取图集配置,生成 ArtAtlasConfig.bytes\n\n" + + "确定继续?", + "确定", "取消")) + { + return; + } + + var startTime = System.Diagnostics.Stopwatch.StartNew(); + + try + { + // 强制保存所有资源 + AssetDatabase.SaveAssets(); + + // 生成ArtResourceConfig.bytes + Debug.Log("========== 开始生成 ArtResourceConfig.bytes =========="); + GenerateArtResourceConfigBytes(); + + // 生成ArtAtlasConfig.bytes + Debug.Log("========== 开始生成 ArtAtlasConfig.bytes =========="); + GenerateAtlasConfigBytes(); + + // 刷新资源 + AssetDatabase.Refresh(); + + startTime.Stop(); + + string message = $"✅ 所有Bytes文件生成完成!\n\n" + + $"总耗时: {startTime.ElapsedMilliseconds} ms\n\n" + + $"生成文件:\n" + + $"• Assets/Art_SubModule/Art_Bytes/ArtResourceConfig.bytes\n" + + $"• Assets/Art_SubModule/Art_Bytes/ArtAtlasConfig.bytes"; + + Debug.Log($"[ArtResourceThriftMenu] {message}"); + EditorUtility.DisplayDialog("生成完成", message, "确定"); + } + catch (System.Exception ex) + { + startTime.Stop(); + string errorMsg = $"❌ 生成失败: {ex.Message}\n\n{ex.StackTrace}"; + Debug.LogError($"[ArtResourceThriftMenu] {errorMsg}"); + EditorUtility.DisplayDialog("生成失败", errorMsg, "确定"); + } + } + + private static void GenerateArtResourceConfigBytes() + { + // 直接调用ArtResourceConfigEditor的静态方法(需要添加) + // 或者模拟其逻辑 + var editor = EditorWindow.GetWindow(); + if (editor != null) + { + // 通过反射调用私有方法 + var method = typeof(ArtResourceConfigEditor).GetMethod("GenerateMergedThriftBytes", + System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); + if (method != null) + { + method.Invoke(editor, null); + } + editor.Close(); + } + } + + private static void GenerateAtlasConfigBytes() + { + // 直接调用AtlasBuilderEditor的静态方法(需要添加) + var editor = EditorWindow.GetWindow(); + if (editor != null) + { + // 通过反射调用私有方法 + var method = typeof(ArtTools.AtlasBuilderEditor).GetMethod("SaveConfigToThriftBytes", + System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); + if (method != null) + { + method.Invoke(editor, null); + } + editor.Close(); + } + } + + [MenuItem("美术工具/Thrift/测试加载Bytes文件", priority = 101)] + public static void TestLoadBytesFiles() + { + Debug.Log("========== 测试加载Bytes文件 =========="); + + // 测试ArtResourceConfig + TestLoadArtResourceConfig(); + + // 测试AtlasConfig + TestLoadAtlasConfig(); + + EditorUtility.DisplayDialog("测试完成", "请查看Console日志", "确定"); + } + + private static void TestLoadArtResourceConfig() + { + const string path = "Assets/Art_SubModule/Art_Bytes/ArtResourceConfig.bytes"; + + var textAsset = AssetDatabase.LoadAssetAtPath(path); + if (textAsset == null) + { + Debug.LogError($"❌ 文件不存在: {path}"); + return; + } + + try + { + var config = new Byway.Thrift.Data.ArtResourceConfig(); + using (var transport = new Thrift.Transport.Client.TMemoryBufferTransport(textAsset.bytes, new Thrift.TConfiguration())) + { + using (var protocol = new Thrift.Protocol.TBinaryProtocol(transport)) + { + config.ReadAsync(protocol, System.Threading.CancellationToken.None).GetAwaiter().GetResult(); + } + } + + Debug.Log($"✅ ArtResourceConfig.bytes 加载成功!\n" + + $" 表数量: {config.Tables.Count}\n" + + $" 版本: {config.Version}\n" + + $" 生成时间: {config.GenerateTime}"); + + foreach (var table in config.Tables) + { + Debug.Log($" 表: {table.TableName} (ID: {table.TableId}, Items: {table.Items.Count})"); + } + } + catch (System.Exception ex) + { + Debug.LogError($"❌ 加载失败: {ex.Message}\n{ex.StackTrace}"); + } + } + + private static void TestLoadAtlasConfig() + { + const string path = "Assets/Art_SubModule/Art_Bytes/ArtAtlasConfig.bytes"; + + var textAsset = AssetDatabase.LoadAssetAtPath(path); + if (textAsset == null) + { + Debug.LogError($"❌ 文件不存在: {path}"); + return; + } + + try + { + var config = new Byway.Thrift.Data.ArtAtlasConfig(); + using (var transport = new Thrift.Transport.Client.TMemoryBufferTransport(textAsset.bytes, new Thrift.TConfiguration())) + { + using (var protocol = new Thrift.Protocol.TBinaryProtocol(transport)) + { + config.ReadAsync(protocol, System.Threading.CancellationToken.None).GetAwaiter().GetResult(); + } + } + + Debug.Log($"✅ ArtAtlasConfig.bytes 加载成功!\n" + + $" 图集数量: {config.Atlases.Count}\n" + + $" 版本: {config.Version}\n" + + $" 生成时间: {config.GenerateTime}"); + + foreach (var atlas in config.Atlases) + { + Debug.Log($" 图集: {atlas.Name} (Sprites: {atlas.SpritePaths.Count})"); + } + } + catch (System.Exception ex) + { + Debug.LogError($"❌ 加载失败: {ex.Message}\n{ex.StackTrace}"); + } + } + } +} diff --git a/Editor/Art_Tools/ArtResourceThriftMenu.cs.meta b/Editor/Art_Tools/ArtResourceThriftMenu.cs.meta new file mode 100644 index 00000000..dccd44fb --- /dev/null +++ b/Editor/Art_Tools/ArtResourceThriftMenu.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 08c567c656adf4648b0fb5064600b46d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: