ItemBase.cs 713 B

123456789101112131415161718192021222324252627282930313233
  1. using XGame;
  2. using XGame.Database;
  3. namespace FL.Data.Items
  4. {
  5. public class ItemBase : IItemBase
  6. {
  7. private ItemTable _table;
  8. public int TableId => _table?.Id ?? 0;
  9. public int ItemType => _table?.Type ?? 0;
  10. public EQualityLevel Quality => _table?.Quality ?? 0;
  11. public string Name => _table?.Name;
  12. public string Icon => _table?.Icon;
  13. public long Count { get; private set; }
  14. public void Init(int id, long count)
  15. {
  16. _table = ItemTableRepo.Get(id);
  17. Count = count;
  18. if (_table == null)
  19. {
  20. Log.Error($"道具表不存在,id:{id}");
  21. }
  22. }
  23. }
  24. }