PlayerData.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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[] skillIds = new int[] { 10011 };//13521;200705 ,
  35. public long UID { get; set; }
  36. public int ServerId { get; set; } // 所属分区
  37. public string Name { get; set; }
  38. private List<string> _runePlanNamesArray;// 方案名列表
  39. public List<string> RunePlanNamesArray => _runePlanNamesArray ??= new List<string>();
  40. private Attributes _attr;
  41. public Attributes Attr => _attr ??= ObjectPool.Acquire<Attributes>();
  42. private List<int> _jobHistoryList; //职业历史,记录转职的路径
  43. public List<int> JobHistoryList => _jobHistoryList ??= new List<int>();
  44. private Dictionary<int, RunePlan> _runePlanMap; //符文槽位(1-6)镶嵌的符文id(空值表示该槽位还未解锁)
  45. public Dictionary<int, RunePlan> RunePlanMap => _runePlanMap ??= new Dictionary<int, RunePlan>();
  46. /// <summary>
  47. /// 角色等级
  48. /// </summary>
  49. public int Level
  50. {
  51. get; set;
  52. }
  53. /// <summary>
  54. /// 当前经验值
  55. /// </summary>
  56. public long Exp
  57. {
  58. get; set;
  59. }
  60. /// <summary>
  61. /// 角色称号
  62. /// </summary>
  63. public string Title
  64. {
  65. get; set;
  66. }
  67. /// <summary>
  68. /// 角色头像
  69. /// </summary>
  70. public string HeadIcon { get; set; }
  71. /// <summary>
  72. /// 微信头像
  73. /// </summary>
  74. public string WXHeadIcon { get; set; }
  75. /// <summary>
  76. /// 累计充值金额
  77. /// </summary>
  78. public int Recharge { get; set; }
  79. /// <summary>
  80. /// 玩家战力
  81. /// </summary>
  82. public long Power { get; set; }
  83. /// <summary>
  84. /// 最好一次登陆时间(豪秒)
  85. /// </summary>
  86. public long LastLoginTime { get; set; }
  87. /// <summary>
  88. /// 当前职业id
  89. /// </summary>
  90. public int JobId { get; set; }
  91. /// <summary>
  92. /// 最近被重置过的职业id
  93. /// </summary>
  94. public int ResetJobId { get; set; }
  95. /// <summary>
  96. /// 当前的觉醒印记方案索引值
  97. /// </summary>
  98. public int CurPlanIndex { set; get; }
  99. /// <summary>
  100. /// (方案)可升级的总点数
  101. /// </summary>
  102. public int AllPoint { get; set; }
  103. /// <summary>
  104. /// 获取角色的转职次数
  105. /// </summary>
  106. /// <returns></returns>
  107. public int GetTransfersCount()
  108. {
  109. // 需要扣除初始职业
  110. return JobHistoryList.Count - 1;
  111. }
  112. void IDisposable.Dispose()
  113. {
  114. if (_attr != null)
  115. {
  116. ObjectPool.Recycle(_attr);
  117. _attr = null;
  118. }
  119. _runePlanMap?.Clear();
  120. _jobHistoryList?.Clear();
  121. _runePlanNamesArray?.Clear();
  122. }
  123. }
  124. }