PlayerData.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System;
  2. using XGame.Database;
  3. using XGame.Framework;
  4. using XGame.Framework.Data;
  5. namespace FL.Data
  6. {
  7. public class PlayerData : DataSingleton<PlayerData>, IDisposable
  8. {
  9. public int chapterId = 10010101;
  10. public int[] skillIds = new int[] { 10011 };//13521;200705 ,
  11. public long UID { get; set; }
  12. public string Name { get; set; }
  13. private Attributes _attr;
  14. public Attributes Attr => _attr ??= ObjectPool.Acquire<Attributes>();
  15. public string MapAssetName
  16. {
  17. get
  18. {
  19. var chapter = ChapterTableRepo.Get(chapterId);
  20. var map = MapTableRepo.Get(chapter.Map);
  21. return map.AssetName;
  22. }
  23. }
  24. /// <summary>
  25. /// 角色等级
  26. /// </summary>
  27. public int Level
  28. {
  29. get; set;
  30. }
  31. /// <summary>
  32. /// 当前经验值
  33. /// </summary>
  34. public long Exp
  35. {
  36. get; set;
  37. }
  38. /// <summary>
  39. /// 角色称号
  40. /// </summary>
  41. public string Title
  42. {
  43. get; set;
  44. }
  45. void IDisposable.Dispose()
  46. {
  47. if (_attr != null)
  48. {
  49. ObjectPool.Recycle(_attr);
  50. _attr = null;
  51. }
  52. }
  53. }
  54. }