123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- using System;
- using System.Collections.Generic;
- using XGame.Database;
- using XGame.Framework.Data;
- namespace FL
- {
- public class MountData : DataSingleton<MountData>, IDisposable
- {
- /// <summary>
- /// 每个星级(黄|紫|红)最多拥有5个星星数量
- /// </summary>
- public const int MaxStarNum = 5;
- #region 通用坐骑数据
- /// <summary>
- /// 通用坐骑的星阶对应的zuoqiInfo表的id
- /// </summary>
- public int UniversalId { get; set; }
- /// <summary>
- /// 通用坐骑升星进度条
- /// </summary>
- public int UniversalExp { set; get; }
- /// <summary>
- /// 坐骑部位驯养经验条
- /// </summary>
- public int MountPartExp { set; get; }
- /// <summary>
- /// 通用坐骑部位驯养等级数据
- /// </summary>
- private Dictionary<int, int> _mountsPartsMap;
- public Dictionary<int, int> MountsPartsMap => _mountsPartsMap ??= new Dictionary<int, int>();
- #endregion
- #region 高级坐骑数据
- /// <summary>
- /// 启用的高级坐骑的技能的坐骑id
- /// </summary>
- public int UseSkillMountId { set; get; }
- /// <summary>
- /// 已解锁的坐骑星级数据
- /// key:zuoqiBase.id
- /// value:star(星级)
- /// </summary>
- private Dictionary<int, int> _advancedMountsMap;
- public Dictionary<int, int> AdvancedMountsMap => _advancedMountsMap ??= new Dictionary<int, int>();
- /// <summary>
- /// 高级坐骑是否已解锁状态
- /// </summary>
- /// <param name="advancedMountId"></param>
- /// <returns></returns>
- public bool IsUnLock(int advancedMountId)
- {
- return _advancedMountsMap.ContainsKey(advancedMountId);
- }
- /// <summary>
- /// 获取高级坐骑的星级
- /// </summary>
- /// <param name="mountId"></param>
- public int GetAdvancedMountLv(int mountId)
- {
- return _advancedMountsMap.ContainsKey(mountId) ? _advancedMountsMap[mountId] : 0;
- }
- #endregion
- public int MountModelId { set; get; } // 当前使用的坐骑外观模型id(通用坐骑用的是zuoqiInfo表格,高级坐骑对应的是zuoqiBase表格)
- /// <summary>
- /// 获取当前骑乘的坐骑外观
- /// </summary>
- /// <param name="bUnlockHighest">是否需要返回通用已解锁的最高阶坐骑外观</param>
- /// <returns></returns>
- public string GetRidingAppearance()
- {
- if (MountModelId == 0) return string.Empty;
- var mountBaseInfo = zuoqiBaseTableRepo.Get(MountModelId);
- if (mountBaseInfo != null) return mountBaseInfo.Spine;
- var mountInfo = zuoqiInfoTableRepo.Get(MountModelId);
- return mountInfo == null ? string.Empty : mountInfo.Spine;
- }
- void IDisposable.Dispose()
- {
- }
- }
- }
|