EquipAttr.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System;
  2. using XGame.Database;
  3. using XGame.Framework;
  4. namespace FL.Data.Items
  5. {
  6. public class EquipAttr : IDisposable
  7. {
  8. private Attributes _attributes;
  9. public Attributes Attributes => _attributes ??= ObjectPool.Acquire<Attributes>();
  10. /// <summary>
  11. /// 装备唯一id
  12. /// </summary>
  13. public int Id { get; private set; }
  14. public EquipmentTable Table { get; private set; }
  15. /// <summary>
  16. /// 装备表格id
  17. /// </summary>
  18. public int TableId => Table.Id;
  19. public EItemType ItemType => EItemType.Equip;
  20. /// <summary>
  21. /// 装备部位
  22. /// </summary>
  23. public EEquipType EquipType => Table.Part;
  24. public EQualityLevel Quality => Table.Quality;
  25. public string Name => Table.Name;
  26. public int Level { get; set; }
  27. /// <summary>
  28. /// 装备属性转化的战斗力
  29. /// </summary>
  30. public long FightingPower { get; set; }
  31. public string Count { get; set; }
  32. public string Description { get; set; }
  33. public string Icon { get; set; }
  34. public void Init(EquipmentTable table, int id)
  35. {
  36. Table = table;
  37. Id = id;
  38. Icon = ItemTableRepo.Get(table.Id).Icon;
  39. }
  40. public void Dispose()
  41. {
  42. if (_attributes != null)
  43. {
  44. ObjectPool.Recycle(_attributes);
  45. }
  46. }
  47. }
  48. }