| | |
| | | PetStone = 2,//灵宠魂石
|
| | | }
|
| | |
|
| | | [XLua.CSharpCallLua]
|
| | | public interface IPetHorseAwaking
|
| | | {
|
| | | event Action onFuncStateUpdate;
|
| | |
| | | string GetPetHorseEffectNode(int id, int skinIndex);
|
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | |
|
| | | public class PetModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
|
| | | {
|
| | | public Dictionary<int, int> _TagPetItem = new Dictionary<int, int>();//关于灵兽魂石
|
| | |
| | | private int PetDanExp = 0;//灵宠丹经验
|
| | | public List<int> ListEffectSkill = new List<int>();
|
| | | PackModel _playerPack;
|
| | | PackModel playerPack
|
| | | {
|
| | | PackModel playerPack {
|
| | | get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PackModel>()); }
|
| | | }
|
| | |
|
| | |
| | | {
|
| | | foreach (var key in CultivateRedPoint.Keys)
|
| | | {
|
| | | CultivateRedPoint[key].state = RedPointState.None;
|
| | | CultivateRedPoint[key].state = RedPointState.None;
|
| | | }
|
| | | if (!FuncOpen.Instance.IsFuncOpen(6))
|
| | | {
|
| | | return;
|
| | | return;
|
| | | }
|
| | | if (_DicPetBack.Count <= 0)
|
| | | {
|
| | | return;
|
| | | return;
|
| | | }
|
| | | int GetPetId = 0;
|
| | | int petLv = 100;
|
| | |
| | | List<int> ListInt = new List<int>();
|
| | | for (int i = 0; i < Sortpet.Count; i++)
|
| | | {
|
| | | int petID = Sortpet[i].ID;
|
| | | int MaxLv = PetInfoConfig.Get(petID).MaxRank;
|
| | | if (_DicPetBack.ContainsKey(petID) && _DicPetBack[petID].PetClass < MaxLv)
|
| | | {
|
| | | int _NeedExp = PetClassCostConfig.GetPetIdAndRank(petID, _DicPetBack[petID].PetClass).UpNeedExp;
|
| | | int NeedExp = _NeedExp - _DicPetBack[petID].petExp;
|
| | | int NeedNumber = Mathf.CeilToInt((float)NeedExp / PetDanExp);
|
| | | if (itemCount >= NeedNumber)
|
| | | {
|
| | | ListInt.Add(petID);
|
| | | }
|
| | | }
|
| | | int petID = Sortpet[i].ID;
|
| | | int MaxLv = PetInfoConfig.Get(petID).MaxRank;
|
| | | if (_DicPetBack.ContainsKey(petID) && _DicPetBack[petID].PetClass < MaxLv)
|
| | | {
|
| | | int _NeedExp = PetClassCostConfig.GetPetIdAndRank(petID, _DicPetBack[petID].PetClass).UpNeedExp;
|
| | | int NeedExp = _NeedExp - _DicPetBack[petID].petExp;
|
| | | int NeedNumber = Mathf.CeilToInt((float)NeedExp / PetDanExp);
|
| | | if (itemCount >= NeedNumber)
|
| | | {
|
| | | ListInt.Add(petID);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | foreach (var key in _DicPetBack.Keys)//因为有成就任务限制所有 第一只坐骑红点逻辑特殊写
|
| | | {
|
| | | if (DicDefaultPet.ContainsKey(key) && DicDefaultPet[key] > _DicPetBack[key].PetClass
|
| | | && itemCount > 0 && CultivateRedPoint.ContainsKey(key))
|
| | | {
|
| | | CultivateRedPoint[key].state = RedPointState.Simple;
|
| | | return;
|
| | | }
|
| | | if (DicDefaultPet.ContainsKey(key) && DicDefaultPet[key] > _DicPetBack[key].PetClass
|
| | | && itemCount > 0 && CultivateRedPoint.ContainsKey(key))
|
| | | {
|
| | | CultivateRedPoint[key].state = RedPointState.Simple;
|
| | | return;
|
| | | }
|
| | | }
|
| | | List<int> IntListSkill = new List<int>();
|
| | | for (int i = 0; i < ListInt.Count; i++)//选择出升级灵宠等级最低且有技能未解锁的且经验最接近
|
| | | {
|
| | | if (_DicPetBack.ContainsKey(ListInt[i]))
|
| | | {
|
| | | var PetConfig = PetInfoConfig.Get(ListInt[i]);
|
| | | if (PetConfig == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | int[] SkillUnLockInt = PetConfig.SkillUnLock;
|
| | | int SkillLvMax = SkillUnLockInt[(SkillUnLockInt.Length - 1)];
|
| | | if (_DicPetBack[(ListInt[i])].PetClass < SkillLvMax)
|
| | | {
|
| | | IntListSkill.Add((ListInt[i]));
|
| | | }
|
| | | }
|
| | | if (_DicPetBack.ContainsKey(ListInt[i]))
|
| | | {
|
| | | var PetConfig = PetInfoConfig.Get(ListInt[i]);
|
| | | if (PetConfig == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | int[] SkillUnLockInt = PetConfig.SkillUnLock;
|
| | | int SkillLvMax = SkillUnLockInt[(SkillUnLockInt.Length - 1)];
|
| | | if (_DicPetBack[(ListInt[i])].PetClass < SkillLvMax)
|
| | | {
|
| | | IntListSkill.Add((ListInt[i]));
|
| | | }
|
| | | }
|
| | | }
|
| | | int SkillPetId = GetRedPointPetID(IntListSkill);
|
| | | if (SkillPetId != 0 && CultivateRedPoint.ContainsKey(SkillPetId))
|
| | | {
|
| | | CultivateRedPoint[SkillPetId].state = RedPointState.Simple;
|
| | | return;
|
| | | CultivateRedPoint[SkillPetId].state = RedPointState.Simple;
|
| | | return;
|
| | | }
|
| | |
|
| | |
|
| | | for (int i = 0; i < ListInt.Count; i++)//选择出等级最低的灵宠
|
| | | {
|
| | | if (_DicPetBack.ContainsKey(ListInt[i]))
|
| | | {
|
| | | if (_DicPetBack[(ListInt[i])].PetClass < petLv)
|
| | | {
|
| | | petLv = _DicPetBack[(ListInt[i])].PetClass;
|
| | | GetPetId = (ListInt[i]);
|
| | | }
|
| | | }
|
| | | if (_DicPetBack.ContainsKey(ListInt[i]))
|
| | | {
|
| | | if (_DicPetBack[(ListInt[i])].PetClass < petLv)
|
| | | {
|
| | | petLv = _DicPetBack[(ListInt[i])].PetClass;
|
| | | GetPetId = (ListInt[i]);
|
| | | }
|
| | | }
|
| | | }
|
| | | if (GetPetId != 0 && CultivateRedPoint.ContainsKey(GetPetId))
|
| | | {
|
| | | CultivateRedPoint[GetPetId].state = RedPointState.Simple;
|
| | | return;
|
| | | CultivateRedPoint[GetPetId].state = RedPointState.Simple;
|
| | | return;
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | return _DicPetBack.ContainsKey(petId);
|
| | | }
|
| | |
|
| | | public int GetPetHorseEffect(int id,int skinIndex)
|
| | | public int GetPetHorseEffect(int id, int skinIndex)
|
| | | {
|
| | | var petHorseAwaking = LuaUtility.Global.Get<IPetHorseAwaking>("PetHorseAwakingModel");
|
| | | return petHorseAwaking.GetPetHorseEffect(id, skinIndex);
|
| | | return ILRuntimeUtility.Instance.ModelInvoke<int>("PetHorseAwakingModel", "GetPetHorseEffect", id, skinIndex);
|
| | | }
|
| | |
|
| | | public string GetPetHorseEffectNode(int id, int skinIndex)
|
| | | {
|
| | | var petHorseAwaking = LuaUtility.Global.Get<IPetHorseAwaking>("PetHorseAwakingModel");
|
| | | return petHorseAwaking.GetPetHorseEffectNode(id, skinIndex);
|
| | | return ILRuntimeUtility.Instance.ModelInvoke<string>("PetHorseAwakingModel", "GetPetHorseEffectNode", id, skinIndex);
|
| | | }
|
| | | }
|
| | | }
|