少年修仙传客户端代码仓库
client_linchunjie
2019-04-04 a51aad2ddcf0cb2ffc8e77cac145f6f5d70ffc6b
3335 灵宠坐骑技能整合
2个文件已删除
12个文件已修改
2544 ■■■■ 已修改文件
Core/GameEngine/Model/TelPartialConfig/tagChinSkillConfig.cs 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/ServerPack/HA3_Function/HA315_tagMCDailyActionCnt.cs 70 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Lua/Gen/PetBackpackWrap.cs 239 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Lua/Gen/PetBackpackWrap.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Lua/Gen/XLuaGenAutoRegister.cs 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Mount/MountModel.cs 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Mount/MountPanelAssignment.cs 118 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Pet/PetAttributeMethods.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Pet/PetModel.cs 1779 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Pet/SkillButtonPet.cs 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/RoleParticulars/ViewHorseDetailWin.cs 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/RoleParticulars/ViewHorseSkillCell.cs 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/RoleParticulars/ViewPetDetailWin.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/RoleParticulars/ViewPetSkillCell.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/TelPartialConfig/tagChinSkillConfig.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using Snxxz.UI;
using System.Collections.Generic;
using System.Threading;
public partial class SkillConfig
@@ -128,5 +129,52 @@
        return 0;
    }
    public static SkillEffectValue GetSkillEffectValue(SkillConfig config)
    {
        if (config == null)
        {
            return default(SkillEffectValue);
        }
        return new SkillEffectValue()
        {
            effect1 = config.Effect1,
            effect2 = config.Effect2,
            effect3 = config.Effect3,
            effect4 = config.Effect4,
            effect5 = config.Effect5,
            effect6 = config.Effect6,
        };
    }
}
public struct SkillEffectValue
{
    public int effect1;
    public int effect2;
    public int effect3;
    public int effect4;
    public int effect5;
    public int effect6;
    const int INTERVAL = 1000000;
    public override bool Equals(object obj)
    {
        var compare = (SkillEffectValue)obj;
        return compare.effect1 == effect1 &&
            compare.effect2 == effect2 &&
            compare.effect3 == effect3 &&
            compare.effect4 == effect4 &&
            compare.effect5 == effect5 &&
            compare.effect6 == effect6;
    }
    public override int GetHashCode()
    {
        var value = INTERVAL + effect1 + INTERVAL * 2 + effect2
            + INTERVAL * 3 + effect3 + INTERVAL * 4 + effect4
            + INTERVAL * 5 + effect5 + INTERVAL * 6 + effect6;
        return value.GetHashCode();
    }
}
Core/NetworkPackage/ServerPack/HA3_Function/HA315_tagMCDailyActionCnt.cs
@@ -1,36 +1,36 @@
using UnityEngine;
using System.Collections;
// A3 15 日常活动次数通知 #tagMCDailyActionCnt
public class HA315_tagMCDailyActionCnt : GameNetPackBasic
{
    public byte Count;    // 个数
    public tagMCDailyActionInfo[] ActionInfo = null;    // 活动信息
    public HA315_tagMCDailyActionCnt()
    {
        _cmd = (ushort)0xA315;
    }
    public override void ReadFromBytes(byte[] vBytes)
    {
        TransBytes(out Count, vBytes, NetDataType.BYTE);
        ActionInfo = new tagMCDailyActionInfo[Count];
        for (int i = 0; i < Count; i++)
        {
            ActionInfo[i] = new tagMCDailyActionInfo();
            TransBytes(out ActionInfo[i].ActionID, vBytes, NetDataType.DWORD);
            TransBytes(out ActionInfo[i].DayFinishCnt, vBytes, NetDataType.WORD);
            TransBytes(out ActionInfo[i].WeekFinishCnt, vBytes, NetDataType.DWORD);
        }
    }
    public struct tagMCDailyActionInfo
    {
        public uint ActionID;        // ID
        public ushort DayFinishCnt;        // 今日已完成次数
        public uint WeekFinishCnt;        // 本周已完成次数
    }
using UnityEngine;
using System.Collections;
// A3 15 日常活动次数通知 #tagMCDailyActionCnt
public class HA315_tagMCDailyActionCnt : GameNetPackBasic
{
    public byte Count;    // 个数
    public tagMCDailyActionInfo[] ActionInfo = null;    // 活动信息
    public HA315_tagMCDailyActionCnt()
    {
        _cmd = (ushort)0xA315;
    }
    public override void ReadFromBytes(byte[] vBytes)
    {
        TransBytes(out Count, vBytes, NetDataType.BYTE);
        ActionInfo = new tagMCDailyActionInfo[Count];
        for (int i = 0; i < Count; i++)
        {
            ActionInfo[i] = new tagMCDailyActionInfo();
            TransBytes(out ActionInfo[i].ActionID, vBytes, NetDataType.DWORD);
            TransBytes(out ActionInfo[i].DayFinishCnt, vBytes, NetDataType.WORD);
            TransBytes(out ActionInfo[i].WeekFinishCnt, vBytes, NetDataType.DWORD);
        }
    }
    public struct tagMCDailyActionInfo
    {
        public uint ActionID;        // ID
        public ushort DayFinishCnt;        // 今日已完成次数
        public uint WeekFinishCnt;        // 本周已完成次数
    }
}
Lua/Gen/PetBackpackWrap.cs
File was deleted
Lua/Gen/PetBackpackWrap.cs.meta
File was deleted
Lua/Gen/XLuaGenAutoRegister.cs
@@ -1278,9 +1278,6 @@
        static void wrapInit8(LuaEnv luaenv, ObjectTranslator translator)
        {
        
            translator.DelayWrapLoader(typeof(PetBackpack), PetBackpackWrap.__Register);
            translator.DelayWrapLoader(typeof(PetReinforceModel), PetReinforceModelWrap.__Register);
        
        
System/Mount/MountModel.cs
@@ -62,6 +62,12 @@
    public static Action<int, bool> MultipleEvent;
    public static event Action PlayerLoginOKData;
    private Dictionary<int, int> DicDefaultMount = new Dictionary<int, int>();
    Dictionary<SkillEffectValue, int> integrationSkills = new Dictionary<SkillEffectValue, int>();
    Dictionary<SkillEffectValue, List<int>> integrationHorseSkills = new Dictionary<SkillEffectValue, List<int>>();
    Dictionary<int, SkillEffectValue> horseSkillEffectValues = new Dictionary<int, SkillEffectValue>();
    Dictionary<int, int> horseSkills = new Dictionary<int, int>();
    public override void Init()
    {
        ToAddSorting();
@@ -80,6 +86,39 @@
        DicDefaultMount = ConfigParse.GetDic<int, int>(MountRedDotstr);
        string HorseUpItem = FuncConfigConfig.Get("HorseUpItem").Numerical2;
        HorseDanExp = int.Parse(HorseUpItem);
        var funcConfig = FuncConfigConfig.Get("PetHorseSkillIntegration");
        var intArray = ConfigParse.GetMultipleStr<int>(funcConfig.Numerical2);
        for (int i = 0; i < intArray.Length; i++)
        {
            var skillConfig = SkillConfig.Get(intArray[i]);
            if (skillConfig != null)
            {
                var effectValue = SkillConfig.GetSkillEffectValue(skillConfig);
                integrationSkills.Add(effectValue, intArray[i]);
            }
        }
        var _horseSkills = GetMountSkillAndItem.Keys;
        foreach (var skillId in _horseSkills)
        {
            var skillConfig = SkillConfig.Get(skillId);
            var effectValue = SkillConfig.GetSkillEffectValue(skillConfig);
            if (integrationSkills.ContainsKey(effectValue))
            {
                List<int> skills = null;
                if (!integrationHorseSkills.TryGetValue(effectValue, out skills))
                {
                    skills = new List<int>();
                    integrationHorseSkills.Add(effectValue, skills);
                }
                skills.Add(skillId);
            }
            horseSkills.Add(skillId, GetMountSkillAndItem[skillId].HorseID);
            horseSkillEffectValues.Add(skillId, effectValue);
        }
    }
    public override void UnInit()
@@ -752,6 +791,66 @@
            }
        }
        return mountAttrDict;
    }
    #endregion
    #region 技能整合
    public bool TryGetIntegrationSkill(SkillEffectValue effect, out int skillId)
    {
        return integrationSkills.TryGetValue(effect, out skillId);
    }
    public bool TryGetHorseSkills(SkillEffectValue effect, out List<int> skills)
    {
        return integrationHorseSkills.TryGetValue(effect, out skills);
    }
    public bool IsSkillUnlock(int skillId)
    {
        var config = SkillConfig.Get(skillId);
        if (config == null)
        {
            return false;
        }
        var effect = SkillConfig.GetSkillEffectValue(config);
        if (integrationHorseSkills.ContainsKey(effect)
            && !integrationHorseSkills[effect].Contains(skillId))
        {
            var skills = integrationHorseSkills[effect];
            foreach (var id in skills)
            {
                if (IsSkillUnlock(id))
                {
                    return true;
                }
            }
        }
        else
        {
            if (GetMountSkillAndItem.ContainsKey(skillId))
            {
                var horseId = GetMountSkillAndItem[skillId].HorseID;
                if (_DicHorse.ContainsKey(horseId))
                {
                    var horseInfo = _DicHorse[horseId];
                    if (horseInfo.Lv >= GetSkillUnlockLevel(skillId))
                    {
                        return true;
                    }
                }
            }
        }
        return false;
    }
    public int GetSkillUnlockLevel(int skillId)
    {
        if (GetMountSkillAndItem.ContainsKey(skillId))
        {
            return GetMountSkillAndItem[skillId].HorseLV;
        }
        return 0;
    }
    #endregion
}
System/Mount/MountPanelAssignment.cs
@@ -28,6 +28,7 @@
        [SerializeField] UIEffect m_Uieffect3;//经验条特效
        [SerializeField] Transform GroupSkill;
        [SerializeField] FunctionUnlockFlyObjectTarget[] flyObjectTargets;
        [SerializeField] GameObject m_YiJieSuo;//解锁面板
        [SerializeField] GameObject m_BottomOperate;//关于经验条
@@ -89,7 +90,6 @@
            MountModel.Event_MountHA301U += OnMountHA301Update;
            allPetSkillCtrl.OnRefreshCell += RefreshAllMountSkillCell;
            FlySkillIconWin.FlySkillID += FlySkillID;
            CreateAllMountSkill();
        }
        private void OnDisable()
@@ -97,7 +97,6 @@
            mount_ID = 0;
            MountModel.Event_MountHA301U -= OnMountHA301Update;
            allPetSkillCtrl.OnRefreshCell -= RefreshAllMountSkillCell;
            FlySkillIconWin.FlySkillID -= FlySkillID;
            m_MountRawImg.gameObject.SetActive(false);
        }
@@ -127,22 +126,6 @@
                var animator = UI3DModelExhibition.Instance.NpcModelHorse.GetComponent<Animator>();
                animator.Play(GAStaticDefine.State_Dance);
            }
        }
        private void FlySkillID(int skillID)
        {
            int Index = 0;
            Index = GetAllMountSkill.FindIndex((x) =>
            {
                return x.SkillID == skillID;
            });
            if (Index == -1)
            {
                Index = 0;
            }
            int line = Index / 3;
            allPetSkillCtrl.JumpIndex(line);
            allPetSkillCtrl.JumpIndex(-50, 0, EnhancedScroller.TweenType.immediate);
        }
        private void OnMountHA301Update(int _HorseID)
@@ -479,6 +462,13 @@
                    {
                        mountSkill.SetModel(MountSkills[i].SkillID, MountSkills[i].HorseLV, false, HorseID, SkillType.MountSkill);
                    }
                    if (i < flyObjectTargets.Length)
                    {
                        var flyObjectTarget = flyObjectTargets[i];
                        flyObjectTarget.IdList = new int[] { MountSkills[i].SkillID };
                        flyObjectTarget.Z_UnLockType = FunctionUnlockType.Skill;
                        FunctionUnlockFlyObjectTargetCenter.Register(FunctionUnlockType.Skill, new int[] { MountSkills[i].SkillID }, flyObjectTarget);
                    }
                }
                else
                {
@@ -487,51 +477,84 @@
            }
        }
        List<HorseSkillClass> GetAllMountSkill = new List<HorseSkillClass>();
        List<int> displayTotalSkills = new List<int>();
        private void CreateAllMountSkill()//所有坐骑技能
        {
            GetAllMountSkill.Clear();
            foreach (int key in mountModel.GetMountSkillAndItem.Keys)
            displayTotalSkills.Clear();
            var skills = mountModel.GetMountSkillAndItem.Keys;
            foreach (var id in skills)
            {
                GetAllMountSkill.Add(mountModel.GetMountSkillAndItem[key]);
                var config = SkillConfig.Get(id);
                var skillId = 0;
                var effect = SkillConfig.GetSkillEffectValue(config);
                if (mountModel.TryGetIntegrationSkill(effect, out skillId))
                {
                    if (!displayTotalSkills.Contains(skillId))
                    {
                        displayTotalSkills.Add(skillId);
                    }
                    continue;
                }
                displayTotalSkills.Add(id);
            }
            ToAddSorting();
            allPetSkillCtrl.Refresh();
            int line = GetAllMountSkill.Count / 3;
            int remain = GetAllMountSkill.Count % 3;
            if (remain > 0)
            {
                line += 1;
            }
            int line = Mathf.CeilToInt((float)displayTotalSkills.Count / 3);
            for (int i = 0; i < line; i++)
            {
                allPetSkillCtrl.AddCell(ScrollerDataType.Header, i);
            }
            allPetSkillCtrl.Restart();
        }
        void ToAddSorting()
        {
            GetAllMountSkill.Sort(Compare);
            displayTotalSkills.Sort(Compare);
        }
        int Compare(HorseSkillClass x, HorseSkillClass y)
        int Compare(int lhs, int rhs)
        {
            bool havex = IsDeblocking(x.SkillID);
            bool havey = IsDeblocking(y.SkillID);
            if (havex.CompareTo(havey) != 0)
            var lhs_unlock = mountModel.IsSkillUnlock(lhs);
            var rhs_unlock = mountModel.IsSkillUnlock(rhs);
            if (lhs_unlock != rhs_unlock)
            {
                return -havex.CompareTo(havey);
            }
            if (x.HorseID.CompareTo(y.HorseID) != 0)
            {
                return x.HorseID.CompareTo(y.HorseID);
                return -lhs_unlock.CompareTo(rhs_unlock);
            }
            if (x.HorseLV.CompareTo(y.HorseLV) != 0)
            var lhs_config = SkillConfig.Get(lhs);
            var rhs_config = SkillConfig.Get(rhs);
            var lhs_Id = 0;
            var rhs_Id = 0;
            var lhs_effect = SkillConfig.GetSkillEffectValue(lhs_config);
            var rhs_effect = SkillConfig.GetSkillEffectValue(rhs_config);
            var lhs_integration = mountModel.TryGetIntegrationSkill(lhs_effect, out lhs_Id);
            var rhs_integration = mountModel.TryGetIntegrationSkill(rhs_effect, out rhs_Id);
            if (lhs_integration != rhs_integration)
            {
                return x.HorseLV.CompareTo(y.HorseLV);
                return -lhs_integration.CompareTo(rhs_integration);
            }
            return 1;
            if (lhs_integration && rhs_integration)
            {
                return lhs_config.Effect1.CompareTo(rhs_config.Effect1);
            }
            var lhs_horseInfo = mountModel.GetMountSkillAndItem[lhs];
            var rhs_horseInfo = mountModel.GetMountSkillAndItem[rhs];
            if (lhs_horseInfo.HorseID != rhs_horseInfo.HorseID)
            {
                return lhs_horseInfo.HorseID.CompareTo(rhs_horseInfo.HorseID);
            }
            if (lhs_horseInfo.HorseLV.CompareTo(rhs_horseInfo.HorseLV) != 0)
            {
                return lhs_horseInfo.HorseLV.CompareTo(rhs_horseInfo.HorseLV);
            }
            return 0;
        }
        private bool IsDeblocking(int SkillID)//是否解锁
@@ -554,22 +577,19 @@
                return false;
            }
        }
        private void RefreshAllMountSkillCell(ScrollerDataType type, CellView cell)
        {
            int length = cell.transform.childCount;
            for (int i = 0; i < length; i++)
            {
                int cellCnt = cell.index * 3 + (i + 1);
                int index = cell.index * 3 + i;
                SkillButtonPet skillButton = cell.transform.GetChild(i).GetComponent<SkillButtonPet>();
                FunctionUnlockFlyObjectTarget functionUnlockFlyObjectTarget = cell.transform.GetChild(i).GetComponent<FunctionUnlockFlyObjectTarget>();
                if (cellCnt <= GetAllMountSkill.Count)
                if (index < displayTotalSkills.Count)
                {
                    skillButton.gameObject.SetActive(true);
                    HorseSkillClass horseSkillClass = GetAllMountSkill[cellCnt - 1];
                    skillButton.SetModel(horseSkillClass.SkillID, horseSkillClass.HorseLV, IsDeblocking(horseSkillClass.SkillID), horseSkillClass.HorseID, SkillType.MountSkill, true);
                    functionUnlockFlyObjectTarget.IdList = new int[] { horseSkillClass.SkillID };
                    functionUnlockFlyObjectTarget.Z_UnLockType = FunctionUnlockType.Skill;
                    FunctionUnlockFlyObjectTargetCenter.Register(FunctionUnlockType.Skill, new int[] { horseSkillClass.SkillID }, functionUnlockFlyObjectTarget);
                    var skillId = displayTotalSkills[index];
                    skillButton.SetModel(skillId, 0, mountModel.IsSkillUnlock(skillId), 0, SkillType.MountSkill, true);
                }
                else
                {
System/Pet/PetAttributeMethods.cs
@@ -210,7 +210,8 @@
            {
                var config = SkillConfig.Get(id);
                var skillId = 0;
                if (petmodel.TryGetIntegrationSkill(config.Effect1, out skillId))
                var effect = SkillConfig.GetSkillEffectValue(config);
                if (petmodel.TryGetIntegrationSkill(effect, out skillId))
                {
                    if (!displayTotalSkills.Contains(skillId))
                    {
@@ -668,8 +669,10 @@
            var rhs_config = SkillConfig.Get(rhs);
            var lhs_Id = 0;
            var rhs_Id = 0;
            var lhs_integration = petmodel.TryGetIntegrationSkill(lhs_config.Effect1, out lhs_Id);
            var rhs_integration = petmodel.TryGetIntegrationSkill(rhs_config.Effect1, out rhs_Id);
            var lhs_effect = SkillConfig.GetSkillEffectValue(lhs_config);
            var rhs_effect = SkillConfig.GetSkillEffectValue(rhs_config);
            var lhs_integration = petmodel.TryGetIntegrationSkill(lhs_effect, out lhs_Id);
            var rhs_integration = petmodel.TryGetIntegrationSkill(rhs_effect, out rhs_Id);
            if (lhs_integration != rhs_integration)
            {
                return -lhs_integration.CompareTo(rhs_integration);
System/Pet/PetModel.cs
@@ -1,908 +1,919 @@
using Snxxz.UI;
using System;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using UnityEngine;
[XLua.LuaCallCSharp]
public class PetBackpack//宠物背包
{
    public int PetClass;//宠物阶级
    public int PetStatus;//宠物当前状态 1为出战 0未出战
    public int ItemPlace;//宠物位置索引
    public int[] PetSkill;//宠物当前学习的技能
    public int petExp; //宠物当前经验
}
public enum PetEnum
{
    PetDan = 0,//灵宠丹
    PetDebris = 1,//灵宠碎片
    PetStone = 2,//灵宠魂石
}
public class PetModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
{
    public Dictionary<int, int> _TagPetItem = new Dictionary<int, int>();//关于灵兽魂石
    public Dictionary<int, PetBackpack> _DicPetBack = new Dictionary<int, PetBackpack>();//宠物背包列表
    public Dictionary<int, int> _PetSkillAcquire = new Dictionary<int, int>();//灵宠已获得的技能(同类技能只存最高等级)1.技能TypeID,2.技能ID
    public delegate void Delegate_HB701(HB701_tagMCPetLV info);
    public delegate void Delegate_Ha339(HA339_tagMCAttrFruitEatCntList info);
    public static event Delegate_Ha339 Event_Ha339;//灵兽魂石
    public delegate void Delegate_H0704();
    public static event Delegate_H0704 Event_H0704Add;//灵宠添加(进阶)
    public static Action<int> Event_H0704Update;//灵宠刷新
    public delegate void SpiritPetPlay(int _toPlay = 0);//宠物是否出战
    public static event SpiritPetPlay Event_SpiritPetPlay;
    public int PetNow = 0;//用来保存出战的灵宠
    public bool Wait = true;//(使用灵宠丹)等待回包
    public Dictionary<int, Redpoint> DeblockingRedPoint = new Dictionary<int, Redpoint>();//解锁按钮红点(灵宠红点子级)
    public Dictionary<int, Redpoint> PetRedpoint = new Dictionary<int, Redpoint>();//灵宠列表
    public Dictionary<int, Redpoint> CultivateRedPoint = new Dictionary<int, Redpoint>();//灵宠培养按钮红点
    private List<PetInfoConfig> Sortpet = new List<PetInfoConfig>();//用于红点排序
    public int MinAtkNunber = 0;//灵宠最小攻击力
    public int MaxAtkNunber = 0;//灵宠最大攻击力
    public int PetStoneItemId = 0;//用来记录坐骑魂石的ID
    public bool IsOk = false;
    private int PetDanExp = 0;//灵宠丹经验
    public List<int> ListEffectSkill = new List<int>();
    PackModel _playerPack;
    PackModel playerPack
    {
        get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PackModel>()); }
    }
    public Dictionary<int, string> petLvNameDict { get; private set; }
    public int curPetId { get; set; }
    public int petUpgradeToolId { get; set; }
    public event Action PlayerLoginOkData;
    private Dictionary<int, int> DicDefaultPet = new Dictionary<int, int>();
    List<PetInfoConfig> allPetConfigs = new List<PetInfoConfig>();
    Dictionary<int, int> integrationSkills = new Dictionary<int, int>();
    Dictionary<int, List<int>> integrationPetSkills = new Dictionary<int, List<int>>();
    Dictionary<int, int> petSkills = new Dictionary<int, int>();
    public override void Init()
    {
        ToAddSorting();
        playerPack.refreshItemCountEvent += OnItemRefreshEvent;
        FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChange;
        PetAttributeWin.IsRedPointCultivate += IsRedPointCultivate;
        PetNumberPreservation();
        petLvNameDict = new Dictionary<int, string>();
        FuncConfigConfig petLvName = FuncConfigConfig.Get("PetQuality");
        int[] petLvArray = ConfigParse.GetMultipleStr<int>(petLvName.Numerical1);
        string[] petLvNameArray = ConfigParse.GetMultipleStr(petLvName.Numerical2);
        for (int i = 0; i < petLvArray.Length; i++)
        {
            if (!petLvNameDict.ContainsKey(petLvArray[i]))
            {
                petLvNameDict.Add(petLvArray[i], petLvNameArray[i]);
            }
        }
        petUpgradeToolId = int.Parse(FuncConfigConfig.Get("PetUpItem").Numerical1);
        string str = FuncConfigConfig.Get("PetSkillEffect").Numerical1;
        int[] listeffect = ConfigParse.GetMultipleStr<int>(str);
        ListEffectSkill.Clear();
        for (int i = 0; i < listeffect.Length; i++)
        {
            ListEffectSkill.Add(listeffect[i]);
        }
        string PetRedDotstr = FuncConfigConfig.Get("MountPetRedDot").Numerical2;
        DicDefaultPet = ConfigParse.GetDic<int, int>(PetRedDotstr);
        PetDanExp = int.Parse(FuncConfigConfig.Get("PetUpItem").Numerical2);
        var funcConfig = FuncConfigConfig.Get("PetHorseSkillIntegration");
        var intArray = ConfigParse.GetMultipleStr<int>(funcConfig.Numerical1);
        for (int i = 0; i < intArray.Length; i++)
namespace Snxxz.UI
{
    public class PetBackpack//宠物背包
    {
        public int PetClass;//宠物阶级
        public int PetStatus;//宠物当前状态 1为出战 0未出战
        public int ItemPlace;//宠物位置索引
        public int[] PetSkill;//宠物当前学习的技能
        public int petExp; //宠物当前经验
    }
    public enum PetEnum
    {
        PetDan = 0,//灵宠丹
        PetDebris = 1,//灵宠碎片
        PetStone = 2,//灵宠魂石
    }
    public class PetModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
    {
        public Dictionary<int, int> _TagPetItem = new Dictionary<int, int>();//关于灵兽魂石
        public Dictionary<int, PetBackpack> _DicPetBack = new Dictionary<int, PetBackpack>();//宠物背包列表
        public Dictionary<int, int> _PetSkillAcquire = new Dictionary<int, int>();//灵宠已获得的技能(同类技能只存最高等级)1.技能TypeID,2.技能ID
        public delegate void Delegate_HB701(HB701_tagMCPetLV info);
        public delegate void Delegate_Ha339(HA339_tagMCAttrFruitEatCntList info);
        public static event Delegate_Ha339 Event_Ha339;//灵兽魂石
        public delegate void Delegate_H0704();
        public static event Delegate_H0704 Event_H0704Add;//灵宠添加(进阶)
        public static Action<int> Event_H0704Update;//灵宠刷新
        public delegate void SpiritPetPlay(int _toPlay = 0);//宠物是否出战
        public static event SpiritPetPlay Event_SpiritPetPlay;
        public int PetNow = 0;//用来保存出战的灵宠
        public bool Wait = true;//(使用灵宠丹)等待回包
        public Dictionary<int, Redpoint> DeblockingRedPoint = new Dictionary<int, Redpoint>();//解锁按钮红点(灵宠红点子级)
        public Dictionary<int, Redpoint> PetRedpoint = new Dictionary<int, Redpoint>();//灵宠列表
        public Dictionary<int, Redpoint> CultivateRedPoint = new Dictionary<int, Redpoint>();//灵宠培养按钮红点
        private List<PetInfoConfig> Sortpet = new List<PetInfoConfig>();//用于红点排序
        public int MinAtkNunber = 0;//灵宠最小攻击力
        public int MaxAtkNunber = 0;//灵宠最大攻击力
        public int PetStoneItemId = 0;//用来记录坐骑魂石的ID
        public bool IsOk = false;
        private int PetDanExp = 0;//灵宠丹经验
        public List<int> ListEffectSkill = new List<int>();
        PackModel _playerPack;
        PackModel playerPack
        {
            var skillConfig = SkillConfig.Get(intArray[i]);
            if (skillConfig != null)
            get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PackModel>()); }
        }
        public Dictionary<int, string> petLvNameDict { get; private set; }
        public int curPetId { get; set; }
        public int petUpgradeToolId { get; set; }
        public event Action PlayerLoginOkData;
        private Dictionary<int, int> DicDefaultPet = new Dictionary<int, int>();
        List<PetInfoConfig> allPetConfigs = new List<PetInfoConfig>();
        Dictionary<SkillEffectValue, int> integrationSkills = new Dictionary<SkillEffectValue, int>();
        Dictionary<SkillEffectValue, List<int>> integrationPetSkills = new Dictionary<SkillEffectValue, List<int>>();
        Dictionary<int, SkillEffectValue> petSkillEffectValues = new Dictionary<int, SkillEffectValue>();
        Dictionary<int, int> petSkills = new Dictionary<int, int>();
        public override void Init()
        {
            ToAddSorting();
            playerPack.refreshItemCountEvent += OnItemRefreshEvent;
            FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChange;
            PetAttributeWin.IsRedPointCultivate += IsRedPointCultivate;
            PetNumberPreservation();
            petLvNameDict = new Dictionary<int, string>();
            FuncConfigConfig petLvName = FuncConfigConfig.Get("PetQuality");
            int[] petLvArray = ConfigParse.GetMultipleStr<int>(petLvName.Numerical1);
            string[] petLvNameArray = ConfigParse.GetMultipleStr(petLvName.Numerical2);
            for (int i = 0; i < petLvArray.Length; i++)
            {
                integrationSkills.Add(skillConfig.Effect1, intArray[i]);
                if (!petLvNameDict.ContainsKey(petLvArray[i]))
                {
                    petLvNameDict.Add(petLvArray[i], petLvNameArray[i]);
                }
            }
            petUpgradeToolId = int.Parse(FuncConfigConfig.Get("PetUpItem").Numerical1);
            string str = FuncConfigConfig.Get("PetSkillEffect").Numerical1;
            int[] listeffect = ConfigParse.GetMultipleStr<int>(str);
            ListEffectSkill.Clear();
            for (int i = 0; i < listeffect.Length; i++)
            {
                ListEffectSkill.Add(listeffect[i]);
            }
            string PetRedDotstr = FuncConfigConfig.Get("MountPetRedDot").Numerical2;
            DicDefaultPet = ConfigParse.GetDic<int, int>(PetRedDotstr);
            PetDanExp = int.Parse(FuncConfigConfig.Get("PetUpItem").Numerical2);
            var funcConfig = FuncConfigConfig.Get("PetHorseSkillIntegration");
            var intArray = ConfigParse.GetMultipleStr<int>(funcConfig.Numerical1);
            for (int i = 0; i < intArray.Length; i++)
            {
                var skillConfig = SkillConfig.Get(intArray[i]);
                if (skillConfig != null)
                {
                    var effectValue = SkillConfig.GetSkillEffectValue(skillConfig);
                    integrationSkills.Add(effectValue, intArray[i]);
                }
            }
            var configs = PetInfoConfig.GetValues();
            foreach (var config in configs)
            {
                for (int i = 0; i < config.SkillID.Length; i++)
                {
                    var skillConfig = SkillConfig.Get(config.SkillID[i]);
                    var effectValue = SkillConfig.GetSkillEffectValue(skillConfig);
                    if (integrationSkills.ContainsKey(effectValue))
                    {
                        List<int> skills = null;
                        if (!integrationPetSkills.TryGetValue(effectValue, out skills))
                        {
                            skills = new List<int>();
                            integrationPetSkills.Add(effectValue, skills);
                        }
                        skills.Add(config.SkillID[i]);
                    }
                    petSkills.Add(config.SkillID[i], config.ID);
                    petSkillEffectValues.Add(config.SkillID[i], effectValue);
                }
            }
        }
        var configs = PetInfoConfig.GetValues();
        foreach (var config in configs)
        public override void UnInit()
        {
            for (int i = 0; i < config.SkillID.Length; i++)
            playerPack.refreshItemCountEvent -= OnItemRefreshEvent;
            FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChange;
            PetAttributeWin.IsRedPointCultivate -= IsRedPointCultivate;
        }
        public void OnBeforePlayerDataInitialize()
        {
            Wait = true;
            IsOk = false;
            _TagPetItem.Clear();
            _DicPetBack.Clear();
            PetNow = 0;
            MinAtkNunber = 0;
            MaxAtkNunber = 0;
            curPetId = 0;
        }
        public void OnPlayerLoginOk()
        {
            GlobalTimeEvent.Instance.secondEvent -= secondEvent;
            GlobalTimeEvent.Instance.secondEvent += secondEvent;
            SinglePack singPack = playerPack.GetSinglePack(PackType.PetPack);
            if (singPack == null) return;
            foreach (var index in singPack.GetAllItems().Keys)
            {
                var skillConfig = SkillConfig.Get(config.SkillID[i]);
                if (integrationSkills.ContainsKey(skillConfig.Effect1))
                {
                    List<int> skills = null;
                    if (!integrationPetSkills.TryGetValue(skillConfig.Effect1, out skills))
                    {
                        skills = new List<int>();
                        integrationPetSkills.Add(skillConfig.Effect1, skills);
                    }
                    skills.Add(config.SkillID[i]);
                }
                petSkills.Add(config.SkillID[i], config.ID);
                OnItemRefreshEvent(singPack.type, index, singPack.GetAllItems()[index].itemId);
            }
        }
    }
    public override void UnInit()
    {
        playerPack.refreshItemCountEvent -= OnItemRefreshEvent;
        FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChange;
        PetAttributeWin.IsRedPointCultivate -= IsRedPointCultivate;
    }
    public void OnBeforePlayerDataInitialize()
    {
        Wait = true;
        IsOk = false;
        _TagPetItem.Clear();
        _DicPetBack.Clear();
        PetNow = 0;
        MinAtkNunber = 0;
        MaxAtkNunber = 0;
        curPetId = 0;
    }
    public void OnPlayerLoginOk()
    {
        GlobalTimeEvent.Instance.secondEvent -= secondEvent;
        GlobalTimeEvent.Instance.secondEvent += secondEvent;
        SinglePack singPack = playerPack.GetSinglePack(PackType.PetPack);
        if (singPack == null) return;
        foreach (var index in singPack.GetAllItems().Keys)
        {
            OnItemRefreshEvent(singPack.type, index, singPack.GetAllItems()[index].itemId);
        }
        IsOk = true;
        if (PlayerLoginOkData != null)
        {
            PlayerLoginOkData();
        }
    }
    private DateTime dateTimeA;
    private void secondEvent()
    {
        if (!Wait)
        {
            TimeSpan timeS = DateTime.Now - dateTimeA;
            if (timeS.Seconds >= 2f)
            {
                Wait = true;
            }
        }
        else
        {
            dateTimeA = DateTime.Now;
        }
    }
    #region 发送服务端请求
    public void SendPetSwitchQuest(int petIndex)
    {
        C1603_tagCPetStateChange tag_Cpet = new C1603_tagCPetStateChange();
        tag_Cpet.PetID = (uint)petIndex;
        tag_Cpet.State = 1;
        GameNetSystem.Instance.SendInfo(tag_Cpet);
    }
    public void SendBreakPetLockQuest(int petId)
    {
        CA702_tagCMActivatePet CMPet = new CA702_tagCMActivatePet();
        CMPet.PetNPCID = (uint)petId;
        GameNetSystem.Instance.SendInfo(CMPet);
        if (ItemOperateUtility.Instance.useItemModel != null)
        {
            ItemOperateUtility.Instance.useItemModel = null;
        }
    }
    public void SendPetTrainQuest(int petIndex, int number)
    {
        CA704_tagCMPetClassUP _tagCA704 = new CA704_tagCMPetClassUP();
        _tagCA704.PetItemIndex = (byte)petIndex;
        _tagCA704.UseItemCnt = (ushort)number;
        GameNetSystem.Instance.SendInfo(_tagCA704);
    }
    #endregion
    private void OnItemRefreshEvent(PackType type, int index, int id)
    {
        PetH0704(playerPack.GetItemByIndex(type, index));
        if (type == PackType.Item)
        {
            if (_TagPetItem.ContainsKey(id))
            {
                PetStoneRed();
            }
            PetActivateRedPoint();
            GetCultivateRedPoint();
        }
    }
    private void OnFuncStateChange(int obj)
    {
        if (obj == 6)
        {
            PetStoneRed();
            PetActivateRedPoint();
            GetCultivateRedPoint();
        }
    }
    private const int Redpoint_key1 = 1050201;
    private Redpoint redPointStre1 = new Redpoint(MainRedDot.RedPoint_PetKey2, Redpoint_key1);
    private void PetStoneRed()//灵宠魂石红点
    {
        redPointStre1.state = RedPointState.None;
        if (!FuncOpen.Instance.IsFuncOpen(6))
        {
            return;
        }
        int type = 0;
        foreach (var key in _TagPetItem.Keys)
        {
            if (_TagPetItem[key] >= AttrFruitConfig.Get(key).MaxUseCnt)
            {
                continue;
            }
            type += playerPack.GetItemCountByID(PackType.Item, key);
        }
        if (type > 0)
        {
            redPointStre1.state = RedPointState.Simple;
            return;
        }
    }
    private void PetNumberPreservation()//用来对灵宠个数进行保存
    {
        if (PetRedpoint.Count != 0)
        {
            return;
        }
        int type = 0;
        if (allPetConfigs.Count <= 0)
        {
            allPetConfigs = PetInfoConfig.GetValues();
        }
        //  var allPetConfigs = PetInfoConfig.GetValues();
        foreach (var config in allPetConfigs)
        {
            if (!DeblockingRedPoint.ContainsKey(config.ID))
            {
                type += 1;
                int petID = config.ID;
                int RedPoint_Mountkey = MainRedDot.RedPoint_PetKey2 * 10 + type;
                Redpoint redPointMountStare = new Redpoint(MainRedDot.RedPoint_PetKey2, RedPoint_Mountkey);
                PetRedpoint.Add(petID, redPointMountStare);//列表
                int RedPoint_Mountkey1 = RedPoint_Mountkey * 10 + type;
                Redpoint redPointMountStare1 = new Redpoint(RedPoint_Mountkey, RedPoint_Mountkey1);
                DeblockingRedPoint.Add(petID, redPointMountStare1);//解锁按钮
                int RedPoint_Mountkey2 = RedPoint_Mountkey1 * 10 + type;
                Redpoint redPointMountStare2 = new Redpoint(RedPoint_Mountkey, RedPoint_Mountkey2);
                CultivateRedPoint.Add(petID, redPointMountStare2);
            }
        }
    }
    private void PetActivateRedPoint()//灵宠激活红点
    {
        foreach (var key in PetRedpoint.Keys)
        {
            DeblockingRedPoint[key].state = RedPointState.None;
        }
        if (!FuncOpen.Instance.IsFuncOpen(6))
        {
            return;
        }
        // var configs = PetInfoConfig.GetValues();
        if (allPetConfigs.Count <= 0)
        {
            allPetConfigs = PetInfoConfig.GetValues();
        }
        foreach (var config in allPetConfigs)
        {
            int unlockItemID = config.UnLockNeedItemID;
            int itemCount = playerPack.GetItemCountByID(PackType.Item, unlockItemID);
            int unlockItemCnt = config.UnLockNeedItemCnt;
            if (itemCount >= unlockItemCnt && !_DicPetBack.ContainsKey(config.ID) && FuncOpen.Instance.IsFuncOpen(6))
            {
                DeblockingRedPoint[config.ID].state = RedPointState.Simple;
            }
        }
    }
    private void IsRedPointCultivate()
    {
        GetCultivateRedPoint();
    }
    private void ToAddSorting()
    {
        Sortpet.Clear();
        if (allPetConfigs.Count <= 0)
        {
            allPetConfigs = PetInfoConfig.GetValues();
        }
        Sortpet = allPetConfigs;
        Sortpet.Sort(Compare);
    }
    int Compare(PetInfoConfig x, PetInfoConfig y)//数组排列
    {
        if (x.Sort.CompareTo(y.Sort) != 0)
        {
            return x.Sort.CompareTo(y.Sort);
        }
        return 1;
    }
    public void GetCultivateRedPoint()//灵宠培养红点
    {
        foreach (var key in CultivateRedPoint.Keys)
        {
            CultivateRedPoint[key].state = RedPointState.None;
        }
        if (!FuncOpen.Instance.IsFuncOpen(6))
        {
            return;
        }
        if (_DicPetBack.Count <= 0)
        {
            return;
        }
        int GetPetId = 0;
        int petLv = 100;
        int itemCount = playerPack.GetItemCountByID(PackType.Item, 4151);
        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);
                }
            }
        }
        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;
            }
        }
        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]));
                }
            }
        }
        int SkillPetId = GetRedPointPetID(IntListSkill);
        if (SkillPetId != 0 && CultivateRedPoint.ContainsKey(SkillPetId))
        {
            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 (GetPetId != 0 && CultivateRedPoint.ContainsKey(GetPetId))
        {
            CultivateRedPoint[GetPetId].state = RedPointState.Simple;
            return;
        }
    }
    private int GetRedPointPetID(List<int> PetList)
    {
        int GetSkillMinLv = 999;
        for (int i = 0; i < PetList.Count; i++)
        {
            int SkillminLv = GetSkillLvDis(PetList[i]);
            if (SkillminLv < GetSkillMinLv && SkillminLv!=0)
            {
                GetSkillMinLv = SkillminLv;
            }
        }
        int petId = 0;
        int ExpNumber = 999999999;
        for (int i = 0; i < PetList.Count; i++)
        {
            int SkillLv = GetSkillLvDis(PetList[i]);
            if (SkillLv > GetSkillMinLv || SkillLv==0)
            {
                continue;
            }
            var Pet1 = PetClassCostConfig.GetPetIdAndRank(PetList[i], SkillLv);
            var Pet2 = PetClassCostConfig.GetPetIdAndRank(PetList[i], _DicPetBack[(PetList[i])].PetClass);
            int Exp = Pet1.NeedExpTotal - Pet2.NeedExpTotal - _DicPetBack[(PetList[i])].petExp;
            if (Exp < ExpNumber)
            {
                ExpNumber = Exp;
                petId = PetList[i];
            }
        }
        return petId;
    }
    private int GetSkillLvDis(int PetId)//获取离升级最近的技能等级
    {
        int SkillLv = 0;
        var petInfo = PetInfoConfig.Get(PetId);
        if (petInfo == null)
        {
            return 0;
        }
        int[] ListPetSkillUnLock = petInfo.SkillUnLock;
        for (int i = 0; i < ListPetSkillUnLock.Length; i++)
        {
            if (_DicPetBack.ContainsKey(PetId) && ListPetSkillUnLock[i] > _DicPetBack[PetId].PetClass)
            {
                SkillLv = ListPetSkillUnLock[i];
                return SkillLv;
            }
        }
        return SkillLv;
    }
    public int GetMinPetExp()
    {
        foreach (var key in CultivateRedPoint.Keys)//当存在培养红点时,选中当有红点的那只
        {
            if (CultivateRedPoint[key].state == RedPointState.Simple)
            {
                return key;
            }
        }
        List<int> IntListSkill = new List<int>();
        foreach (var key in _DicPetBack.Keys)
        {
            var petConfig = PetInfoConfig.Get(key);
            if (_DicPetBack[key].PetClass < petConfig.MaxRank)
            {
                IntListSkill.Add(key);
            }
        }
        int SkillPetId = GetRedPointPetID(IntListSkill);
        if (SkillPetId != 0)
        {
            return SkillPetId;
        }
        int GetPetId = 0;
        int GetPetLv = 999;
        foreach (var key in _DicPetBack.Keys)//无红点时跳转选中等级最低的
        {
            var config = PetInfoConfig.Get(key);
            if (_DicPetBack[key].PetClass < GetPetLv && _DicPetBack[key].PetClass < config.MaxRank)
            {
                GetPetId = key;
                GetPetLv = _DicPetBack[key].PetClass;
            }
        }
        return GetPetId;
    }
    private int GetPetSkillMaxLv(int PetID)
    {
        int maxskillLV = 0;
        int[] curPetUnlocks;
        PetInfoConfig petInfo = PetInfoConfig.Get(PetID);
        if (petInfo != null)
        {
            curPetUnlocks = petInfo.SkillUnLock;
            maxskillLV = curPetUnlocks[(curPetUnlocks.Length) - 1];
        }
        return maxskillLV;
    }
    public void PetA339(HA339_tagMCAttrFruitEatCntList info)
    {
        for (int i = 0; i < info.count; i++)
        {
            var configItem = ItemConfig.Get((int)info.EatCntList[i].ItemID);
            if (configItem == null)
            {
                continue;
            }
            if (_TagPetItem.ContainsKey((int)info.EatCntList[i].ItemID))
            {
                _TagPetItem[(int)info.EatCntList[i].ItemID] = (int)info.EatCntList[i].EatCnt;
                if (Event_Ha339 != null)
                    Event_Ha339(info);
            }
            else
            {
                if (configItem.Type == 28)
                {
                    _TagPetItem.Add((int)info.EatCntList[i].ItemID, (int)info.EatCntList[i].EatCnt);
                }
            }
        }
        PetStoneRed();
    }
    private void AddPetSkill(int[] intlist)
    {
        for (int i = 0; i < intlist.Length; i++)
        {
            var skillPet = SkillConfig.Get(intlist[i]);
            if (_PetSkillAcquire.ContainsKey(skillPet.SkillTypeID))
            {
                int skilllv = SkillConfig.Get(_PetSkillAcquire[skillPet.SkillTypeID]).SkillLV;
                if (skillPet.SkillLV > skilllv)
                {
                    _PetSkillAcquire[skillPet.SkillTypeID] = skillPet.SkillID;
                }
            }
            else
            {
                _PetSkillAcquire.Add(skillPet.SkillTypeID, skillPet.SkillID);
            }
        }
    }
    public void PetH0704(ItemModel info)//宠物背包列表
    {
        if (info == null)
            return;
        if (info.packType == PackType.PetPack)
        {
            Dictionary<int, int[]> _dic = Analysis(info.itemInfo.userData);
            if (GetUseDataModel(200, _dic) != null)
            {
                int petId = _dic[200][0];
                int petLv = 0;
                int petState = 0;
                int[] petSkill = null;
                int petIndex = info.gridIndex;
                int petExp = 0;
                if (GetUseDataModel(201, _dic) != null)
                {
                    petSkill = _dic[201];//宠物当前学习的技能
                }
                if (GetUseDataModel(202, _dic) != null)
                {
                    petLv = _dic[202][0] + 1;//宠物阶级
                }
                if (GetUseDataModel(204, _dic) != null)
                {
                    petState = _dic[204][0];//宠物当前状态;
                }
                if (GetUseDataModel(208, _dic) != null)
                {
                    petExp = _dic[208][0]; //宠物经验
                }
                if (!_DicPetBack.ContainsKey(petId))
                {
                    PetBackpack _petBack = new PetBackpack();
                    _petBack.PetClass = petLv;
                    _petBack.petExp = petExp; //宠物经验
                    _petBack.PetStatus = petState;//宠物当前状态
                    if (_petBack.PetStatus == 1)
                    {
                        PetNow = petId;
                    }
                    if (petSkill != null)
                    {
                        _petBack.PetSkill = petSkill;//宠物当前学习的技能
                        AddPetSkill(_petBack.PetSkill);
                    }
                    else
                    {
                        _petBack.PetSkill = null;
                    }
                    _petBack.ItemPlace = petIndex;//宠物位置索引
                    _DicPetBack.Add(petId, _petBack);
                    if (Event_H0704Add != null && IsOk)
                    {
                        Event_H0704Add();
                    }
                }
                else
                {
                    _DicPetBack[petId].PetClass = petLv;
                    _DicPetBack[petId].PetStatus = petState;
                    _DicPetBack[petId].petExp = petExp; //宠物经验
                    if (petSkill != null)
                    {
                        _DicPetBack[petId].PetSkill = petSkill;//宠物当前学习的技能
                        AddPetSkill(_DicPetBack[petId].PetSkill);
                    }
                    else
                    {
                        _DicPetBack[petId].PetSkill = null;
                    }
                    _DicPetBack[petId].ItemPlace = petIndex;
                    if (Event_H0704Update != null && IsOk)
                    {
                        Event_H0704Update(petId);
                    }
                    if (_DicPetBack[petId].PetStatus == 1)
                    {
                        PetNow = petId;
                        if (Event_SpiritPetPlay != null && IsOk)
                        {
                            Event_SpiritPetPlay(petState);
                        }
                    }
                }
            }
        }
        PetStoneRed();
        PetActivateRedPoint();
        GetCultivateRedPoint();
        GetPetMinAndMaxAttack();
    }
    public int[] GetUseDataModel(int key, Dictionary<int, int[]> useDataDict)
    {
        int[] list = null;
        if (useDataDict != null)
        {
            useDataDict.TryGetValue(key, out list);
        }
        return list;
    }
    private void GetPetMinAndMaxAttack()
    {
        if (_DicPetBack.Count <= 0)
        {
            return;
        }
        MinAtkNunber = 0;
        MaxAtkNunber = 0;
        foreach (var key in _DicPetBack.Keys)
        {
            PetClassCostConfig _tagPetClass = PetClassCostConfig.GetPetIdAndRank(key, _DicPetBack[key].PetClass);
            MinAtkNunber += _tagPetClass.AtkAdd;
            MaxAtkNunber += _tagPetClass.AtkAdd;
        }
    }
    public static Regex userData = new Regex(@"'([0-9]+)':\[(.*?)\]", RegexOptions.Singleline);
    public Dictionary<int, int[]> Analysis(string val)//正则表达式的字符串分割
    {
        if (!userData.IsMatch(val))
        {
            return null;
        }
        else
        {
            Dictionary<int, int[]> dics = new Dictionary<int, int[]>();
            foreach (Match match in userData.Matches(val))
            {
                int id = int.Parse(match.Groups[1].Value);
                string str = match.Groups[2].Value;
                string[] vals = str.Split(',');
                int[] intarray = new int[vals.Length];
                for (int i = 0; i < vals.Length; i++)
                {
                    int intval = int.Parse(vals[i].Replace('\'', ' '));
                    intarray[i] = intval;
                }
                if (!dics.ContainsKey(id))
                {
                    dics.Add(id, intarray);
                }
            }
            return dics;
        }
    }
    public bool IsHint(PetEnum petEnum, int id = 0)//True提示,False不提示
    {
        bool iSHint = false;
        switch (petEnum)
        {
            case PetEnum.PetDan:
                foreach (var key in _DicPetBack.Keys)
                {
                    PetInfoConfig petConfig = PetInfoConfig.Get(key);
                    if (petConfig.MaxRank > _DicPetBack[key].PetClass)
                    {
                        iSHint = true;
                    }
                }
                return iSHint;
            case PetEnum.PetDebris:
                if (allPetConfigs.Count <= 0)
                {
                    allPetConfigs = PetInfoConfig.GetValues();
                }
                foreach (var value in allPetConfigs)
                {
                    if (value.UnLockNeedItemID == id)
                    {
                        if (!_DicPetBack.ContainsKey(value.ID))
                        {
                            iSHint = true;
                        }
                    }
                }
                return iSHint;
            case PetEnum.PetStone:
                int _maxuse = AttrFruitConfig.Get(id).MaxUseCnt;
                if (_TagPetItem.ContainsKey(id))
                {
                    if (_maxuse > _TagPetItem[id])
                    {
                        iSHint = true;
                    }
                }
                return iSHint;
            default:
                return true;
        }
    }
    public int IsPetPanelRedPointState()//用于判断当前灵宠页签是否有红点亮起
    {
        int Type = 0;
        foreach (var value in DeblockingRedPoint.Values)
        {
            if (value.state == RedPointState.Simple)
            {
                Type = 2;
                return Type;
            }
        }
        if (MainRedDot.Instance.redPonintPetFunc2.state == RedPointState.Simple)
        {
            Type = 1;
            return Type;
        }
        return Type;
    }
    #region 预览宠物碎片属性
    Dictionary<int, int> petAttrDict = new Dictionary<int, int>();
    public Dictionary<int, int> GetPetAttrAddDict(int petCode)
    {
        PetInfoConfig infoConfig = PetInfoConfig.Get(petCode);
        petAttrDict.Clear();
        if (infoConfig == null) return petAttrDict;
        int maxRank = infoConfig.MaxRank;
        PetClassCostConfig cost = PetClassCostConfig.GetPetIdAndRank(petCode, maxRank);
        int allAtkAdd = 0;
        if (cost != null)
        {
            allAtkAdd = cost.AtkAdd;
        }
        petAttrDict.Add(7, allAtkAdd);
        return petAttrDict;
    }
    #endregion
            IsOk = true;
            if (PlayerLoginOkData != null)
            {
                PlayerLoginOkData();
            }
        }
    #region 技能整合
    public ICollection<int> GetPetTotalSkills()
    {
        return petSkills.Keys;
    }
    public bool TryGetIntegrationSkill(int effect, out int skillId)
    {
        return integrationSkills.TryGetValue(effect, out skillId);
    }
    public bool TryGetPetSkills(int effect,out List<int> skills)
    {
        return integrationPetSkills.TryGetValue(effect, out skills);
    }
    public bool TryGetPetId(int skillId,out int petId)
    {
        return petSkills.TryGetValue(skillId, out petId);
    }
    public bool IsSkillUnlock(int skillId)
    {
        var config = SkillConfig.Get(skillId);
        if (config == null)
        private DateTime dateTimeA;
        private void secondEvent()
        {
            if (!Wait)
            {
                TimeSpan timeS = DateTime.Now - dateTimeA;
                if (timeS.Seconds >= 2f)
                {
                    Wait = true;
                }
            }
            else
            {
                dateTimeA = DateTime.Now;
            }
        }
        #region 发送服务端请求
        public void SendPetSwitchQuest(int petIndex)
        {
            C1603_tagCPetStateChange tag_Cpet = new C1603_tagCPetStateChange();
            tag_Cpet.PetID = (uint)petIndex;
            tag_Cpet.State = 1;
            GameNetSystem.Instance.SendInfo(tag_Cpet);
        }
        public void SendBreakPetLockQuest(int petId)
        {
            CA702_tagCMActivatePet CMPet = new CA702_tagCMActivatePet();
            CMPet.PetNPCID = (uint)petId;
            GameNetSystem.Instance.SendInfo(CMPet);
            if (ItemOperateUtility.Instance.useItemModel != null)
            {
                ItemOperateUtility.Instance.useItemModel = null;
            }
        }
        public void SendPetTrainQuest(int petIndex, int number)
        {
            CA704_tagCMPetClassUP _tagCA704 = new CA704_tagCMPetClassUP();
            _tagCA704.PetItemIndex = (byte)petIndex;
            _tagCA704.UseItemCnt = (ushort)number;
            GameNetSystem.Instance.SendInfo(_tagCA704);
        }
        #endregion
        private void OnItemRefreshEvent(PackType type, int index, int id)
        {
            PetH0704(playerPack.GetItemByIndex(type, index));
            if (type == PackType.Item)
            {
                if (_TagPetItem.ContainsKey(id))
                {
                    PetStoneRed();
                }
                PetActivateRedPoint();
                GetCultivateRedPoint();
            }
        }
        private void OnFuncStateChange(int obj)
        {
            if (obj == 6)
            {
                PetStoneRed();
                PetActivateRedPoint();
                GetCultivateRedPoint();
            }
        }
        private const int Redpoint_key1 = 1050201;
        private Redpoint redPointStre1 = new Redpoint(MainRedDot.RedPoint_PetKey2, Redpoint_key1);
        private void PetStoneRed()//灵宠魂石红点
        {
            redPointStre1.state = RedPointState.None;
            if (!FuncOpen.Instance.IsFuncOpen(6))
            {
                return;
            }
            int type = 0;
            foreach (var key in _TagPetItem.Keys)
            {
                if (_TagPetItem[key] >= AttrFruitConfig.Get(key).MaxUseCnt)
                {
                    continue;
                }
                type += playerPack.GetItemCountByID(PackType.Item, key);
            }
            if (type > 0)
            {
                redPointStre1.state = RedPointState.Simple;
                return;
            }
        }
        private void PetNumberPreservation()//用来对灵宠个数进行保存
        {
            if (PetRedpoint.Count != 0)
            {
                return;
            }
            int type = 0;
            if (allPetConfigs.Count <= 0)
            {
                allPetConfigs = PetInfoConfig.GetValues();
            }
            //  var allPetConfigs = PetInfoConfig.GetValues();
            foreach (var config in allPetConfigs)
            {
                if (!DeblockingRedPoint.ContainsKey(config.ID))
                {
                    type += 1;
                    int petID = config.ID;
                    int RedPoint_Mountkey = MainRedDot.RedPoint_PetKey2 * 10 + type;
                    Redpoint redPointMountStare = new Redpoint(MainRedDot.RedPoint_PetKey2, RedPoint_Mountkey);
                    PetRedpoint.Add(petID, redPointMountStare);//列表
                    int RedPoint_Mountkey1 = RedPoint_Mountkey * 10 + type;
                    Redpoint redPointMountStare1 = new Redpoint(RedPoint_Mountkey, RedPoint_Mountkey1);
                    DeblockingRedPoint.Add(petID, redPointMountStare1);//解锁按钮
                    int RedPoint_Mountkey2 = RedPoint_Mountkey1 * 10 + type;
                    Redpoint redPointMountStare2 = new Redpoint(RedPoint_Mountkey, RedPoint_Mountkey2);
                    CultivateRedPoint.Add(petID, redPointMountStare2);
                }
            }
        }
        private void PetActivateRedPoint()//灵宠激活红点
        {
            foreach (var key in PetRedpoint.Keys)
            {
                DeblockingRedPoint[key].state = RedPointState.None;
            }
            if (!FuncOpen.Instance.IsFuncOpen(6))
            {
                return;
            }
            // var configs = PetInfoConfig.GetValues();
            if (allPetConfigs.Count <= 0)
            {
                allPetConfigs = PetInfoConfig.GetValues();
            }
            foreach (var config in allPetConfigs)
            {
                int unlockItemID = config.UnLockNeedItemID;
                int itemCount = playerPack.GetItemCountByID(PackType.Item, unlockItemID);
                int unlockItemCnt = config.UnLockNeedItemCnt;
                if (itemCount >= unlockItemCnt && !_DicPetBack.ContainsKey(config.ID) && FuncOpen.Instance.IsFuncOpen(6))
                {
                    DeblockingRedPoint[config.ID].state = RedPointState.Simple;
                }
            }
        }
        private void IsRedPointCultivate()
        {
            GetCultivateRedPoint();
        }
        private void ToAddSorting()
        {
            Sortpet.Clear();
            if (allPetConfigs.Count <= 0)
            {
                allPetConfigs = PetInfoConfig.GetValues();
            }
            Sortpet = allPetConfigs;
            Sortpet.Sort(Compare);
        }
        int Compare(PetInfoConfig x, PetInfoConfig y)//数组排列
        {
            if (x.Sort.CompareTo(y.Sort) != 0)
            {
                return x.Sort.CompareTo(y.Sort);
            }
            return 1;
        }
        public void GetCultivateRedPoint()//灵宠培养红点
        {
            foreach (var key in CultivateRedPoint.Keys)
            {
                CultivateRedPoint[key].state = RedPointState.None;
            }
            if (!FuncOpen.Instance.IsFuncOpen(6))
            {
                return;
            }
            if (_DicPetBack.Count <= 0)
            {
                return;
            }
            int GetPetId = 0;
            int petLv = 100;
            int itemCount = playerPack.GetItemCountByID(PackType.Item, 4151);
            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);
                    }
                }
            }
            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;
                }
            }
            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]));
                    }
                }
            }
            int SkillPetId = GetRedPointPetID(IntListSkill);
            if (SkillPetId != 0 && CultivateRedPoint.ContainsKey(SkillPetId))
            {
                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 (GetPetId != 0 && CultivateRedPoint.ContainsKey(GetPetId))
            {
                CultivateRedPoint[GetPetId].state = RedPointState.Simple;
                return;
            }
        }
        private int GetRedPointPetID(List<int> PetList)
        {
            int GetSkillMinLv = 999;
            for (int i = 0; i < PetList.Count; i++)
            {
                int SkillminLv = GetSkillLvDis(PetList[i]);
                if (SkillminLv < GetSkillMinLv && SkillminLv != 0)
                {
                    GetSkillMinLv = SkillminLv;
                }
            }
            int petId = 0;
            int ExpNumber = 999999999;
            for (int i = 0; i < PetList.Count; i++)
            {
                int SkillLv = GetSkillLvDis(PetList[i]);
                if (SkillLv > GetSkillMinLv || SkillLv == 0)
                {
                    continue;
                }
                var Pet1 = PetClassCostConfig.GetPetIdAndRank(PetList[i], SkillLv);
                var Pet2 = PetClassCostConfig.GetPetIdAndRank(PetList[i], _DicPetBack[(PetList[i])].PetClass);
                int Exp = Pet1.NeedExpTotal - Pet2.NeedExpTotal - _DicPetBack[(PetList[i])].petExp;
                if (Exp < ExpNumber)
                {
                    ExpNumber = Exp;
                    petId = PetList[i];
                }
            }
            return petId;
        }
        private int GetSkillLvDis(int PetId)//获取离升级最近的技能等级
        {
            int SkillLv = 0;
            var petInfo = PetInfoConfig.Get(PetId);
            if (petInfo == null)
            {
                return 0;
            }
            int[] ListPetSkillUnLock = petInfo.SkillUnLock;
            for (int i = 0; i < ListPetSkillUnLock.Length; i++)
            {
                if (_DicPetBack.ContainsKey(PetId) && ListPetSkillUnLock[i] > _DicPetBack[PetId].PetClass)
                {
                    SkillLv = ListPetSkillUnLock[i];
                    return SkillLv;
                }
            }
            return SkillLv;
        }
        public int GetMinPetExp()
        {
            foreach (var key in CultivateRedPoint.Keys)//当存在培养红点时,选中当有红点的那只
            {
                if (CultivateRedPoint[key].state == RedPointState.Simple)
                {
                    return key;
                }
            }
            List<int> IntListSkill = new List<int>();
            foreach (var key in _DicPetBack.Keys)
            {
                var petConfig = PetInfoConfig.Get(key);
                if (_DicPetBack[key].PetClass < petConfig.MaxRank)
                {
                    IntListSkill.Add(key);
                }
            }
            int SkillPetId = GetRedPointPetID(IntListSkill);
            if (SkillPetId != 0)
            {
                return SkillPetId;
            }
            int GetPetId = 0;
            int GetPetLv = 999;
            foreach (var key in _DicPetBack.Keys)//无红点时跳转选中等级最低的
            {
                var config = PetInfoConfig.Get(key);
                if (_DicPetBack[key].PetClass < GetPetLv && _DicPetBack[key].PetClass < config.MaxRank)
                {
                    GetPetId = key;
                    GetPetLv = _DicPetBack[key].PetClass;
                }
            }
            return GetPetId;
        }
        private int GetPetSkillMaxLv(int PetID)
        {
            int maxskillLV = 0;
            int[] curPetUnlocks;
            PetInfoConfig petInfo = PetInfoConfig.Get(PetID);
            if (petInfo != null)
            {
                curPetUnlocks = petInfo.SkillUnLock;
                maxskillLV = curPetUnlocks[(curPetUnlocks.Length) - 1];
            }
            return maxskillLV;
        }
        public void PetA339(HA339_tagMCAttrFruitEatCntList info)
        {
            for (int i = 0; i < info.count; i++)
            {
                var configItem = ItemConfig.Get((int)info.EatCntList[i].ItemID);
                if (configItem == null)
                {
                    continue;
                }
                if (_TagPetItem.ContainsKey((int)info.EatCntList[i].ItemID))
                {
                    _TagPetItem[(int)info.EatCntList[i].ItemID] = (int)info.EatCntList[i].EatCnt;
                    if (Event_Ha339 != null)
                        Event_Ha339(info);
                }
                else
                {
                    if (configItem.Type == 28)
                    {
                        _TagPetItem.Add((int)info.EatCntList[i].ItemID, (int)info.EatCntList[i].EatCnt);
                    }
                }
            }
            PetStoneRed();
        }
        private void AddPetSkill(int[] intlist)
        {
            for (int i = 0; i < intlist.Length; i++)
            {
                var skillPet = SkillConfig.Get(intlist[i]);
                if (_PetSkillAcquire.ContainsKey(skillPet.SkillTypeID))
                {
                    int skilllv = SkillConfig.Get(_PetSkillAcquire[skillPet.SkillTypeID]).SkillLV;
                    if (skillPet.SkillLV > skilllv)
                    {
                        _PetSkillAcquire[skillPet.SkillTypeID] = skillPet.SkillID;
                    }
                }
                else
                {
                    _PetSkillAcquire.Add(skillPet.SkillTypeID, skillPet.SkillID);
                }
            }
        }
        public void PetH0704(ItemModel info)//宠物背包列表
        {
            if (info == null)
                return;
            if (info.packType == PackType.PetPack)
            {
                Dictionary<int, int[]> _dic = Analysis(info.itemInfo.userData);
                if (GetUseDataModel(200, _dic) != null)
                {
                    int petId = _dic[200][0];
                    int petLv = 0;
                    int petState = 0;
                    int[] petSkill = null;
                    int petIndex = info.gridIndex;
                    int petExp = 0;
                    if (GetUseDataModel(201, _dic) != null)
                    {
                        petSkill = _dic[201];//宠物当前学习的技能
                    }
                    if (GetUseDataModel(202, _dic) != null)
                    {
                        petLv = _dic[202][0] + 1;//宠物阶级
                    }
                    if (GetUseDataModel(204, _dic) != null)
                    {
                        petState = _dic[204][0];//宠物当前状态;
                    }
                    if (GetUseDataModel(208, _dic) != null)
                    {
                        petExp = _dic[208][0]; //宠物经验
                    }
                    if (!_DicPetBack.ContainsKey(petId))
                    {
                        PetBackpack _petBack = new PetBackpack();
                        _petBack.PetClass = petLv;
                        _petBack.petExp = petExp; //宠物经验
                        _petBack.PetStatus = petState;//宠物当前状态
                        if (_petBack.PetStatus == 1)
                        {
                            PetNow = petId;
                        }
                        if (petSkill != null)
                        {
                            _petBack.PetSkill = petSkill;//宠物当前学习的技能
                            AddPetSkill(_petBack.PetSkill);
                        }
                        else
                        {
                            _petBack.PetSkill = null;
                        }
                        _petBack.ItemPlace = petIndex;//宠物位置索引
                        _DicPetBack.Add(petId, _petBack);
                        if (Event_H0704Add != null && IsOk)
                        {
                            Event_H0704Add();
                        }
                    }
                    else
                    {
                        _DicPetBack[petId].PetClass = petLv;
                        _DicPetBack[petId].PetStatus = petState;
                        _DicPetBack[petId].petExp = petExp; //宠物经验
                        if (petSkill != null)
                        {
                            _DicPetBack[petId].PetSkill = petSkill;//宠物当前学习的技能
                            AddPetSkill(_DicPetBack[petId].PetSkill);
                        }
                        else
                        {
                            _DicPetBack[petId].PetSkill = null;
                        }
                        _DicPetBack[petId].ItemPlace = petIndex;
                        if (Event_H0704Update != null && IsOk)
                        {
                            Event_H0704Update(petId);
                        }
                        if (_DicPetBack[petId].PetStatus == 1)
                        {
                            PetNow = petId;
                            if (Event_SpiritPetPlay != null && IsOk)
                            {
                                Event_SpiritPetPlay(petState);
                            }
                        }
                    }
                }
            }
            PetStoneRed();
            PetActivateRedPoint();
            GetCultivateRedPoint();
            GetPetMinAndMaxAttack();
        }
        public int[] GetUseDataModel(int key, Dictionary<int, int[]> useDataDict)
        {
            int[] list = null;
            if (useDataDict != null)
            {
                useDataDict.TryGetValue(key, out list);
            }
            return list;
        }
        private void GetPetMinAndMaxAttack()
        {
            if (_DicPetBack.Count <= 0)
            {
                return;
            }
            MinAtkNunber = 0;
            MaxAtkNunber = 0;
            foreach (var key in _DicPetBack.Keys)
            {
                PetClassCostConfig _tagPetClass = PetClassCostConfig.GetPetIdAndRank(key, _DicPetBack[key].PetClass);
                MinAtkNunber += _tagPetClass.AtkAdd;
                MaxAtkNunber += _tagPetClass.AtkAdd;
            }
        }
        public static Regex userData = new Regex(@"'([0-9]+)':\[(.*?)\]", RegexOptions.Singleline);
        public Dictionary<int, int[]> Analysis(string val)//正则表达式的字符串分割
        {
            if (!userData.IsMatch(val))
            {
                return null;
            }
            else
            {
                Dictionary<int, int[]> dics = new Dictionary<int, int[]>();
                foreach (Match match in userData.Matches(val))
                {
                    int id = int.Parse(match.Groups[1].Value);
                    string str = match.Groups[2].Value;
                    string[] vals = str.Split(',');
                    int[] intarray = new int[vals.Length];
                    for (int i = 0; i < vals.Length; i++)
                    {
                        int intval = int.Parse(vals[i].Replace('\'', ' '));
                        intarray[i] = intval;
                    }
                    if (!dics.ContainsKey(id))
                    {
                        dics.Add(id, intarray);
                    }
                }
                return dics;
            }
        }
        public bool IsHint(PetEnum petEnum, int id = 0)//True提示,False不提示
        {
            bool iSHint = false;
            switch (petEnum)
            {
                case PetEnum.PetDan:
                    foreach (var key in _DicPetBack.Keys)
                    {
                        PetInfoConfig petConfig = PetInfoConfig.Get(key);
                        if (petConfig.MaxRank > _DicPetBack[key].PetClass)
                        {
                            iSHint = true;
                        }
                    }
                    return iSHint;
                case PetEnum.PetDebris:
                    if (allPetConfigs.Count <= 0)
                    {
                        allPetConfigs = PetInfoConfig.GetValues();
                    }
                    foreach (var value in allPetConfigs)
                    {
                        if (value.UnLockNeedItemID == id)
                        {
                            if (!_DicPetBack.ContainsKey(value.ID))
                            {
                                iSHint = true;
                            }
                        }
                    }
                    return iSHint;
                case PetEnum.PetStone:
                    int _maxuse = AttrFruitConfig.Get(id).MaxUseCnt;
                    if (_TagPetItem.ContainsKey(id))
                    {
                        if (_maxuse > _TagPetItem[id])
                        {
                            iSHint = true;
                        }
                    }
                    return iSHint;
                default:
                    return true;
            }
        }
        public int IsPetPanelRedPointState()//用于判断当前灵宠页签是否有红点亮起
        {
            int Type = 0;
            foreach (var value in DeblockingRedPoint.Values)
            {
                if (value.state == RedPointState.Simple)
                {
                    Type = 2;
                    return Type;
                }
            }
            if (MainRedDot.Instance.redPonintPetFunc2.state == RedPointState.Simple)
            {
                Type = 1;
                return Type;
            }
            return Type;
        }
        #region 预览宠物碎片属性
        Dictionary<int, int> petAttrDict = new Dictionary<int, int>();
        public Dictionary<int, int> GetPetAttrAddDict(int petCode)
        {
            PetInfoConfig infoConfig = PetInfoConfig.Get(petCode);
            petAttrDict.Clear();
            if (infoConfig == null) return petAttrDict;
            int maxRank = infoConfig.MaxRank;
            PetClassCostConfig cost = PetClassCostConfig.GetPetIdAndRank(petCode, maxRank);
            int allAtkAdd = 0;
            if (cost != null)
            {
                allAtkAdd = cost.AtkAdd;
            }
            petAttrDict.Add(7, allAtkAdd);
            return petAttrDict;
        }
        #endregion
        #region 技能整合
        public ICollection<int> GetPetTotalSkills()
        {
            return petSkills.Keys;
        }
        public bool TryGetIntegrationSkill(SkillEffectValue effect, out int skillId)
        {
            return integrationSkills.TryGetValue(effect, out skillId);
        }
        public bool TryGetPetSkills(SkillEffectValue effect, out List<int> skills)
        {
            return integrationPetSkills.TryGetValue(effect, out skills);
        }
        public bool TryGetPetId(int skillId, out int petId)
        {
            return petSkills.TryGetValue(skillId, out petId);
        }
        public bool IsSkillUnlock(int skillId)
        {
            var config = SkillConfig.Get(skillId);
            if (config == null)
            {
                return false;
            }
            var effect = SkillConfig.GetSkillEffectValue(config);
            if (integrationPetSkills.ContainsKey(effect)
                && !integrationPetSkills[effect].Contains(skillId))
            {
                var skills = integrationPetSkills[effect];
                foreach (var id in skills)
                {
                    if (IsSkillUnlock(id))
                    {
                        return true;
                    }
                }
            }
            else
            {
                if (petSkills.ContainsKey(skillId))
                {
                    var petId = petSkills[skillId];
                    if (!_DicPetBack.ContainsKey(petId))
                    {
                        return false;
                    }
                    var petInfo = _DicPetBack[petId];
                    if (petInfo.PetClass >= GetSkillUnlockLevel(skillId))
                    {
                        return true;
                    }
                }
            }
            return false;
        }
        if (integrationPetSkills.ContainsKey(config.Effect1)
            && !integrationPetSkills[config.Effect1].Contains(skillId))
        public int GetSkillUnlockLevel(int skillId)
        {
            var skills = integrationPetSkills[config.Effect1];
            foreach (var id in skills)
            var petId = 0;
            if (TryGetPetId(skillId, out petId))
            {
                if (IsSkillUnlock(id))
                var petConfig = PetInfoConfig.Get(petId);
                var index = 0;
                for (int i = 0; i < petConfig.SkillID.Length; i++)
                {
                    return true;
                    if (petConfig.SkillID[i] == skillId)
                    {
                        index = i;
                    }
                }
                if (index < petConfig.SkillUnLock.Length)
                {
                    return petConfig.SkillUnLock[index];
                }
            }
            return 0;
        }
        else
        {
            if (petSkills.ContainsKey(skillId))
            {
                var petId = petSkills[skillId];
                if (!_DicPetBack.ContainsKey(petId))
                {
                    return false;
                }
                var petInfo = _DicPetBack[petId];
                if (petInfo.PetClass >= GetSkillUnlockLevel(skillId))
                {
                    return true;
                }
            }
        }
        return false;
    }
    public int GetSkillUnlockLevel(int skillId)
    {
        var petId = 0;
        if (TryGetPetId(skillId, out petId))
        {
            var petConfig = PetInfoConfig.Get(petId);
            var index = 0;
            for (int i = 0; i < petConfig.SkillID.Length; i++)
            {
                if (petConfig.SkillID[i] == skillId)
                {
                    index = i;
                }
            }
            if (index < petConfig.SkillUnLock.Length)
            {
                return petConfig.SkillUnLock[index];
            }
        }
        return 0;
    }
    #endregion
        #endregion
    }
}
System/Pet/SkillButtonPet.cs
@@ -21,6 +21,7 @@
        [SerializeField] Text lockLvText;
        PetModel petModel { get { return ModelCenter.Instance.GetModel<PetModel>(); } }
        MountModel mountModel { get { return ModelCenter.Instance.GetModel<MountModel>(); } }
        public void SetModel(int skillId, int skillUnlock, bool isUnlock, int petId, SkillType skillType, bool isAll = false)
        {
@@ -69,7 +70,8 @@
                        {
                            List<int> skills;
                            var value = 0;
                            if (petModel.TryGetPetSkills(skillConfig.Effect1, out skills))
                            var effect = SkillConfig.GetSkillEffectValue(skillConfig);
                            if (petModel.TryGetPetSkills(effect, out skills))
                            {
                                foreach (var id in skills)
                                {
@@ -86,13 +88,39 @@
                        }
                        break;
                    case SkillType.MountSkill:
                        HorseConfig horseInfo = HorseConfig.Get(petId);
                        if (horseInfo != null)
                        {
                            str[0] = skillConfig.Description;
                            str[1] = Language.Get("pet_SkillTipLv", horseInfo.Name, skillUnlock);
                            if (mountModel.GetMountSkillAndItem.ContainsKey(skillId))
                            {
                                var horseId = mountModel.GetMountSkillAndItem[skillId].HorseID;
                                var horseConfig = HorseConfig.Get(horseId);
                                if (horseConfig != null)
                                {
                                    str[0] = skillConfig.Description;
                                    str[1] = Language.Get("pet_SkillTipLv", horseConfig.Name, mountModel.GetSkillUnlockLevel(skillId));
                                }
                                fightPower = skillConfig.FightPower;
                            }
                            else
                            {
                                var effect = SkillConfig.GetSkillEffectValue(skillConfig);
                                List<int> skills;
                                var value = 0;
                                if (mountModel.TryGetHorseSkills(effect, out skills))
                                {
                                    foreach (var id in skills)
                                    {
                                        if (mountModel.IsSkillUnlock(id))
                                        {
                                            var config = SkillConfig.Get(id);
                                            value += config.EffectValue11;
                                            fightPower += config.FightPower;
                                        }
                                    }
                                }
                                str[0] = string.Format(skillConfig.Description, value);
                                str[1] = string.Empty;
                            }
                        }
                        fightPower = skillConfig.FightPower;
                        break;
                }
                SkillDetails.ShowSkillDetails(skillId, SkillDetails.SkillSourceType.PetSkill, fightPower, str);
System/RoleParticulars/ViewHorseDetailWin.cs
@@ -32,9 +32,11 @@
        List<int> skills = new List<int>();
        [NonSerialized] public List<int> activeSkills = new List<int>();
        [NonSerialized] public List<int> displayTotalSkills = new List<int>();
        [NonSerialized] public List<int> unlockTotalSkills = new List<int>();
        RoleParticularModel model { get { return ModelCenter.Instance.GetModel<RoleParticularModel>(); } }
        MountModel mountModel { get { return ModelCenter.Instance.GetModel<MountModel>(); } }
        #region Built-in
        protected override void BindController()
        {
@@ -157,14 +159,34 @@
        void DisplayTotalSkills(List<RoleParticularModel.HorseInfo> horses)
        {
            activeSkills.Clear();
            displayTotalSkills.Clear();
            unlockTotalSkills.Clear();
            for (int i = 0; i < horses.Count; i++)
            {
                HorseUpConfig.GetHorseSkills(horses[i].id, horses[i].lv, true, ref skills);
                activeSkills.AddRange(skills);
                unlockTotalSkills.AddRange(skills);
                foreach (var id in skills)
                {
                    var config = SkillConfig.Get(id);
                    var effect = SkillConfig.GetSkillEffectValue(config);
                    var skillId = 0;
                    if (mountModel.TryGetIntegrationSkill(effect, out skillId))
                    {
                        if (!displayTotalSkills.Contains(skillId))
                        {
                            displayTotalSkills.Add(skillId);
                        }
                        continue;
                    }
                    displayTotalSkills.Add(id);
                }
            }
            displayTotalSkills.Sort(Compare);
            m_SkillController.Refresh();
            var line = Mathf.CeilToInt((float)activeSkills.Count / m_LineCount);
            var line = Mathf.CeilToInt((float)displayTotalSkills.Count / m_LineCount);
            for (int i = 0; i < line; i++)
            {
                m_SkillController.AddCell(ScrollerDataType.Header, i);
@@ -199,6 +221,40 @@
            var line = cell.index;
            ViewHorseSkillCell skillCell = cell as ViewHorseSkillCell;
            skillCell.Display(line, this);
        }
        int Compare(int lhs, int rhs)
        {
            var lhs_config = SkillConfig.Get(lhs);
            var rhs_config = SkillConfig.Get(rhs);
            var lhs_Id = 0;
            var rhs_Id = 0;
            var lhs_effect = SkillConfig.GetSkillEffectValue(lhs_config);
            var rhs_effect = SkillConfig.GetSkillEffectValue(rhs_config);
            var lhs_integration = mountModel.TryGetIntegrationSkill(lhs_effect, out lhs_Id);
            var rhs_integration = mountModel.TryGetIntegrationSkill(rhs_effect, out rhs_Id);
            if (lhs_integration != rhs_integration)
            {
                return -lhs_integration.CompareTo(rhs_integration);
            }
            if (lhs_integration && rhs_integration)
            {
                return lhs_config.Effect1.CompareTo(rhs_config.Effect1);
            }
            var lhs_horseInfo = mountModel.GetMountSkillAndItem[lhs];
            var rhs_horseInfo = mountModel.GetMountSkillAndItem[rhs];
            if (lhs_horseInfo.HorseID != rhs_horseInfo.HorseID)
            {
                return lhs_horseInfo.HorseID.CompareTo(rhs_horseInfo.HorseID);
            }
            if (lhs_horseInfo.HorseLV.CompareTo(rhs_horseInfo.HorseLV) != 0)
            {
                return lhs_horseInfo.HorseLV.CompareTo(rhs_horseInfo.HorseLV);
            }
            return 0;
        }
        [Serializable]
@@ -244,8 +300,9 @@
            {
                var config = HorseConfig.Get(horseId);
                var skillConfig = SkillConfig.Get(skillId);
                SkillDetails.ShowSkillDetails(skillId, SkillDetails.SkillSourceType.ViewHorsePet, skillConfig == null ? 0 : skillConfig.FightPower,
                    Language.Get("pet_SkillTipLv", config.Name, HorseUpConfig.GetSkillCondition(horseId, skillId)));
                var label1 = skillConfig.Description;
                var label2 = Language.Get("pet_SkillTipLv", config.Name, HorseUpConfig.GetSkillCondition(horseId, skillId));
                SkillDetails.ShowSkillDetails(skillId, SkillDetails.SkillSourceType.ViewHorsePet, skillConfig.FightPower, label1, label2);
            }
            public void SetActive(bool active)
System/RoleParticulars/ViewHorseSkillCell.cs
@@ -8,6 +8,8 @@
    {
        [SerializeField] SkillBehaviour[] m_Skills;
        MountModel model { get { return ModelCenter.Instance.GetModel<MountModel>(); } }
        ViewHorseDetailWin displayWindow;
        public void Display(int line, ViewHorseDetailWin win)
        {
@@ -15,10 +17,10 @@
            for (int i = 0; i < displayWindow.lineCount; i++)
            {
                var index = line * displayWindow.lineCount + i;
                if (index < displayWindow.activeSkills.Count)
                if (index < displayWindow.displayTotalSkills.Count)
                {
                    m_Skills[i].gameObject.SetActive(true);
                    m_Skills[i].Display(displayWindow.activeSkills[index]);
                    m_Skills[i].Display(displayWindow.displayTotalSkills[index]);
                    m_Skills[i].onClick -= OnSkillClick;
                    m_Skills[i].onClick += OnSkillClick;
                }
@@ -32,13 +34,41 @@
        public void OnSkillClick(int skillId)
        {
            int horseId = 0;
            if (HorseUpConfig.TryGetHorseBySkill(skillId, out horseId))
            var skillConfig = SkillConfig.Get(skillId);
            if (model.GetMountSkillAndItem.ContainsKey(skillId))
            {
                int horseId = model.GetMountSkillAndItem[skillId].HorseID;
                var config = HorseConfig.Get(horseId);
                var skillConfig = SkillConfig.Get(skillId);
                SkillDetails.ShowSkillDetails(skillId, SkillDetails.SkillSourceType.ViewHorsePet, skillConfig == null ? 0 : skillConfig.FightPower,
                    Language.Get("pet_SkillTipLv", config.Name, HorseUpConfig.GetSkillCondition(horseId, skillId)));
                var label1 = skillConfig.Description;
                var label2 = Language.Get("pet_SkillTipLv", config.Name, model.GetSkillUnlockLevel(skillId));
                SkillDetails.ShowSkillDetails(skillId, SkillDetails.SkillSourceType.ViewHorsePet,
                    skillConfig == null ? 0 : skillConfig.FightPower, label1, label2);
            }
            else
            {
                List<int> skills;
                var value = 0;
                var fightPower = 0;
                var effect = SkillConfig.GetSkillEffectValue(skillConfig);
                if (model.TryGetHorseSkills(effect, out skills))
                {
                    foreach (var id in skills)
                    {
                        if (displayWindow.unlockTotalSkills.Contains(id))
                        {
                            var config = SkillConfig.Get(id);
                            value += config.EffectValue11;
                            fightPower += config.FightPower;
                        }
                    }
                }
                var label1 = string.Format(skillConfig.Description, value);
                var label2 = string.Empty;
                SkillDetails.ShowSkillDetails(skillId, SkillDetails.SkillSourceType.ViewHorsePet,
                        fightPower, label1, label2);
            }
        }
    }
System/RoleParticulars/ViewPetDetailWin.cs
@@ -150,7 +150,8 @@
                {
                    var config = SkillConfig.Get(id);
                    var skillId = 0;
                    if (petModel.TryGetIntegrationSkill(config.Effect1, out skillId))
                    var effect = SkillConfig.GetSkillEffectValue(config);
                    if (petModel.TryGetIntegrationSkill(effect, out skillId))
                    {
                        if (!displayTotalSkills.Contains(skillId))
                        {
@@ -213,8 +214,10 @@
            var rhs_config = SkillConfig.Get(rhs);
            var lhs_Id = 0;
            var rhs_Id = 0;
            var lhs_integration = petModel.TryGetIntegrationSkill(lhs_config.Effect1, out lhs_Id);
            var rhs_integration = petModel.TryGetIntegrationSkill(rhs_config.Effect1, out rhs_Id);
            var lhs_effect = SkillConfig.GetSkillEffectValue(lhs_config);
            var rhs_effect = SkillConfig.GetSkillEffectValue(rhs_config);
            var lhs_integration = petModel.TryGetIntegrationSkill(lhs_effect, out lhs_Id);
            var rhs_integration = petModel.TryGetIntegrationSkill(rhs_effect, out rhs_Id);
            if (lhs_integration != rhs_integration)
            {
                return -lhs_integration.CompareTo(rhs_integration);
System/RoleParticulars/ViewPetSkillCell.cs
@@ -55,7 +55,8 @@
                var value = 0;
                var fightPower = 0;
                if (model.TryGetPetSkills(skillConfig.Effect1, out skills))
                var effect = SkillConfig.GetSkillEffectValue(skillConfig);
                if (model.TryGetPetSkills(effect, out skills))
                {
                    foreach (var id in skills)
                    {