PlayerData.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. using FL.Network;
  2. using System;
  3. using System.Collections.Generic;
  4. using UnityEditor;
  5. using XGame.Database;
  6. using XGame.Framework;
  7. using XGame.Framework.Data;
  8. namespace FL.Data
  9. {
  10. public class PlayerData : DataSingleton<PlayerData>, IDisposable
  11. {
  12. public int chapterId = 10010101;
  13. public int[] skillIds = new int[] { 10011 };//13521;200705 ,
  14. public long UID { get; set; }
  15. public int ServerId { get; set; } // 所属分区
  16. public string Name { get; set; }
  17. private List<string> _runePlanNamesArray;// 方案名列表
  18. public List<string> RunePlanNamesArray => _runePlanNamesArray ??= new List<string>();
  19. private Attributes _attr;
  20. public Attributes Attr => _attr ??= ObjectPool.Acquire<Attributes>();
  21. private List<int> _jobHistoryList; //职业历史,记录转职的路径
  22. public List<int> JobHistoryList => _jobHistoryList ??= new List<int>();
  23. private Dictionary<int, RunePlan> _runePlanMap; //符文槽位(1-6)镶嵌的符文id(空值表示该槽位还未解锁)
  24. public Dictionary<int, RunePlan> RunePlanMap => _runePlanMap ??= new Dictionary<int, RunePlan>();
  25. public string MapAssetName
  26. {
  27. get
  28. {
  29. var chapter = ChapterTableRepo.Get(chapterId);
  30. var map = MapTableRepo.Get(chapter.Map);
  31. return map.AssetName;
  32. }
  33. }
  34. /// <summary>
  35. /// 角色等级
  36. /// </summary>
  37. public int Level
  38. {
  39. get; set;
  40. }
  41. /// <summary>
  42. /// 当前经验值
  43. /// </summary>
  44. public long Exp
  45. {
  46. get; set;
  47. }
  48. /// <summary>
  49. /// 角色称号
  50. /// </summary>
  51. public string Title
  52. {
  53. get; set;
  54. }
  55. /// <summary>
  56. /// 角色头像
  57. /// </summary>
  58. public string HeadIcon { get; set; }
  59. /// <summary>
  60. /// 微信头像
  61. /// </summary>
  62. public string WXHeadIcon { get; set; }
  63. /// <summary>
  64. /// 累计充值金额
  65. /// </summary>
  66. public int Recharge { get; set; }
  67. /// <summary>
  68. /// 玩家战力
  69. /// </summary>
  70. public long Power { get; set; }
  71. /// <summary>
  72. /// 最好一次登陆时间(豪秒)
  73. /// </summary>
  74. public long LastLoginTime { get; set; }
  75. /// <summary>
  76. /// 当前职业id
  77. /// </summary>
  78. public int JobId { get; set; }
  79. /// <summary>
  80. /// 最近被重置过的职业id
  81. /// </summary>
  82. public int ResetJobId { get; set; }
  83. /// <summary>
  84. /// 当前的觉醒印记方案索引值
  85. /// </summary>
  86. public int CurPlanIndex { set; get; }
  87. /// <summary>
  88. /// (方案)可升级的总点数
  89. /// </summary>
  90. public int AllPoint { get; set; }
  91. void IDisposable.Dispose()
  92. {
  93. if (_attr != null)
  94. {
  95. ObjectPool.Recycle(_attr);
  96. _attr = null;
  97. }
  98. _runePlanMap?.Clear();
  99. _jobHistoryList?.Clear();
  100. _runePlanNamesArray?.Clear();
  101. }
  102. }
  103. }