using XGame.Framework.Serialization; using System; namespace XGame.Framework.Asset.Addressable.Data { [Serializable] public struct AssetInfo : IComparable, ISerializable { /// /// id,资源管理内部使用id标识 /// public long addressableId; /// /// 名字,资源对外的唯一标识 /// public string addressableName; public string assetGUID; //public AddressableAssetType assetType; /// /// Resources下的资源才会赋值 /// public string relativePath; ///// ///// 兼容旧代码,以后要删除 ///// //public string tempPath; public override string ToString() { return $"Asset id:{addressableId} key:{addressableName} guid:{assetGUID} path:{relativePath}"; } public int CompareTo(object obj) { if (obj is AssetInfo compareInfo) { return string.CompareOrdinal(this.addressableName, compareInfo.addressableName); } return -1; } void ISerializable.Serialize(IWriter writer) { writer.Write(addressableId); writer.Write(addressableName); writer.Write(assetGUID); writer.Write(relativePath); } void ISerializable.Deserialize(IReader reader) { addressableId = reader.ReadLong(); addressableName = reader.ReadString(); assetGUID = reader.ReadString(); relativePath = reader.ReadString(); } } }