PlayerData.cs 3.8 KB

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