12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- using XGame.Framework.Serialization;
- using System;
- namespace XGame.Framework.Asset.Addressable.Data
- {
- [Serializable]
- public struct AssetInfo : IComparable, ISerializable
- {
- /// <summary>
- /// id,资源管理内部使用id标识
- /// </summary>
- public long addressableId;
- /// <summary>
- /// 名字,资源对外的唯一标识
- /// </summary>
- public string addressableName;
- public string assetGUID;
- //public AddressableAssetType assetType;
- /// <summary>
- /// Resources下的资源才会赋值
- /// </summary>
- public string relativePath;
- ///// <summary>
- ///// 兼容旧代码,以后要删除
- ///// </summary>
- //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();
- }
- }
- }
|