ItemBase.cs 809 B

123456789101112131415161718192021222324252627282930313233343536
  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 bool IsGet { get; private set; }
  15. public void Init(int id, long count, bool isGet = false)
  16. {
  17. _table = ItemTableRepo.Get(id);
  18. Count = count;
  19. IsGet = isGet;
  20. if (_table == null)
  21. {
  22. Log.Error($"道具表不存在,id:{id}");
  23. }
  24. }
  25. }
  26. }