MountData.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. using System;
  2. using System.Collections.Generic;
  3. using XGame.Database;
  4. using XGame.Framework.Data;
  5. namespace FL
  6. {
  7. public class MountData : DataSingleton<MountData>, IDisposable
  8. {
  9. /// <summary>
  10. /// 每个星级(黄|紫|红)最多拥有5个星星数量
  11. /// </summary>
  12. public const int MaxStarNum = 5;
  13. #region 通用坐骑数据
  14. /// <summary>
  15. /// 通用坐骑的星阶对应的zuoqiInfo表的id
  16. /// </summary>
  17. public int UniversalId { get; set; }
  18. /// <summary>
  19. /// 通用坐骑升星进度条
  20. /// </summary>
  21. public int UniversalExp { set; get; }
  22. /// <summary>
  23. /// 坐骑部位驯养经验条
  24. /// </summary>
  25. public int MountPartExp { set; get; }
  26. /// <summary>
  27. /// 通用坐骑部位驯养等级数据
  28. /// </summary>
  29. private Dictionary<int, int> _mountsPartsMap;
  30. public Dictionary<int, int> MountsPartsMap => _mountsPartsMap ??= new Dictionary<int, int>();
  31. #endregion
  32. #region 高级坐骑数据
  33. /// <summary>
  34. /// 启用的高级坐骑的技能的坐骑id
  35. /// </summary>
  36. public int UseSkillMountId { set; get; }
  37. /// <summary>
  38. /// 已解锁的坐骑星级数据
  39. /// key:zuoqiBase.id
  40. /// value:star(星级)
  41. /// </summary>
  42. private Dictionary<int, int> _advancedMountsMap;
  43. public Dictionary<int, int> AdvancedMountsMap => _advancedMountsMap ??= new Dictionary<int, int>();
  44. /// <summary>
  45. /// 高级坐骑是否已解锁状态
  46. /// </summary>
  47. /// <param name="advancedMountId"></param>
  48. /// <returns></returns>
  49. public bool IsUnLock(int advancedMountId)
  50. {
  51. return _advancedMountsMap.ContainsKey(advancedMountId);
  52. }
  53. /// <summary>
  54. /// 获取高级坐骑的星级
  55. /// </summary>
  56. /// <param name="mountId"></param>
  57. public int GetAdvancedMountLv(int mountId)
  58. {
  59. return _advancedMountsMap.ContainsKey(mountId) ? _advancedMountsMap[mountId] : 0;
  60. }
  61. #endregion
  62. public int MountModelId { set; get; } // 当前使用的坐骑外观模型id(通用坐骑用的是zuoqiInfo表格,高级坐骑对应的是zuoqiBase表格)
  63. /// <summary>
  64. /// 获取当前骑乘的坐骑外观
  65. /// </summary>
  66. /// <returns></returns>
  67. public string GetRidingAppearance()
  68. {
  69. if (MountModelId == 0) return string.Empty;
  70. var mountBaseInfo = zuoqiBaseTableRepo.Get(MountModelId);
  71. if (mountBaseInfo != null) return mountBaseInfo.Spine;
  72. var mountInfo = zuoqiInfoTableRepo.Get(MountModelId);
  73. return mountInfo == null ? string.Empty : mountInfo.Spine;
  74. }
  75. void IDisposable.Dispose()
  76. {
  77. }
  78. }
  79. }