From 9a8583c696c85286956048e4955e4314e46202a2 Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期一, 25 二月 2019 14:18:36 +0800
Subject: [PATCH] 3335 物品相关类型重构

---
 System/Mount/MountModel.cs | 1506 ++++++++++++++++++++++++++++----------------------------
 1 files changed, 753 insertions(+), 753 deletions(-)

diff --git a/System/Mount/PlayerMountDatas.cs b/System/Mount/MountModel.cs
similarity index 99%
rename from System/Mount/PlayerMountDatas.cs
rename to System/Mount/MountModel.cs
index f05699a..1963022 100644
--- a/System/Mount/PlayerMountDatas.cs
+++ b/System/Mount/MountModel.cs
@@ -1,753 +1,753 @@
-锘縰sing Snxxz.UI;
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Text.RegularExpressions;
-
-using UnityEngine;
-//鐢ㄤ簬鍧愰獞
-[XLua.LuaCallCSharp]
-public class HorseClass
-{
-    public int Lv;//鍧愰獞绛夌骇
-    public int Exp;//缁忛獙
-
-}
-public enum HorseEnum
-{
-    HorseDan = 0,//鍧愰獞涓�
-    HorseDebris = 1,//鍧愰獞纰庣墖
-    HorseStone = 2,//鍧愰獞榄傜煶
-}
-
-public class HorseSkillClass
-{
-    public int SkillID;//鎶�鑳絀D
-    public int SkillItem;//鍗囩骇鎶�鑳芥墍闇�閬撳叿
-    public int HorseID;//鍧愰獞ID
-    public int HorseLV;//鎵�闇�绛夌骇
-}
-
-public class PlayerMountDatas : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
-{
-    public string _HorseIDNow = string.Empty;//鑾峰彇褰撳墠鐨勫潗楠慖D
-    public int HorseIDNow = 0;
-    public delegate void MountHA301Update(int _HorseID);
-    public static event MountHA301Update Event_MountHA301U;//鍧愰獞鐨勬洿鏂�
-    public delegate void MountHA301Add(int _HorseID);
-    public static event MountHA301Add Event_MountHA301A;//鍧愰獞鐨勬坊鍔�
-    public delegate void MountHA339Update(HA339_tagMCAttrFruitEatCntList info);
-    public static event MountHA339Update Event_MountHA339U;//鍧愰獞榄傜煶鐨勫埛鏂�
-
-    public Dictionary<int, HorseSkillClass> GetMountSkillAndItem = new Dictionary<int, HorseSkillClass>();//1鎶�鑳絋ypeID锛屾墍闇�鐨勬秷鑰楃墿鍝両D
-    public delegate void OnMountAlteration(string NowMount);//褰撳墠鍧愰獞鍙樻洿
-    public static event OnMountAlteration Event_MountAlteration;
-    public static event Action OnMountUieffectUpLv;//鍏充簬鍧愰獞鍗囩骇鏃剁壒鏁堟挱鏀炬椂鐨勮皟鐢�
-    public Dictionary<int, HorseClass> _DicHorse = new Dictionary<int, HorseClass>();//褰撳墠鐨勫潗楠戝瓧鍏�
-    public Dictionary<int, int> _DicMountItem = new Dictionary<int, int>();//鍧愰獞榄傜煶鐨勫瓧鍏�
-    public Dictionary<int, Redpoint> mountRedpoint = new Dictionary<int, Redpoint>();//鍧愰獞澶栬鍒囨崲绾㈢偣
-    public Dictionary<int, Redpoint> DeblockingRedPoint = new Dictionary<int, Redpoint>();//婵�娲绘寜閽孩鐐�
-    public Dictionary<int, Redpoint> ASingleFeedRedPoint = new Dictionary<int, Redpoint>();//鍗曟鍠傚吇绾㈢偣
-    private List<HorseConfig> SortMount = new List<HorseConfig>();//鐢ㄤ簬绾㈢偣鎺掑簭
-    public int MountStoneItemId = 0;
-    public bool IsOk = false;
-    public List<int> ListEffectSkill = new List<int>();
-    private int HorseDanExp = 0;//鍧愰獞涓圭粡楠�
-    PackModel _playerPack;
-    PackModel playerPack
-    {
-        get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PackModel>()); }
-    }
-    public bool HorseRidingBool = false;//鐢ㄦ潵鍒ゆ柇鐜╁鏄兘鍦ㄩ獞椹�
-    public bool Wait = true;//绛夊緟鍥炲寘(浣跨敤鍧愰獞涓�)
-    public static Action<int, bool> MultipleEvent;
-    public static event Action PlayerLoginOKData;
-    private Dictionary<int, int> DicDefaultMount = new Dictionary<int, int>();
-    public override void Init()
-    {
-        ToAddSorting();
-        playerPack.refreshItemCountEvent += OnItemRefreshEvent;
-        MountWin.RedPointMountDan += RedPointMountDan;
-        MountSkillAndItem();
-        MountNumberPreservation();
-        string str = FuncConfigConfig.Get("MountSkillEffect").Numerical1;
-        int[] listeffect = ConfigParse.GetMultipleStr<int>(str);
-        ListEffectSkill.Clear();
-        for (int i = 0; i < listeffect.Length; i++)
-        {
-            ListEffectSkill.Add(listeffect[i]);
-        }
-        string MountRedDotstr = FuncConfigConfig.Get("MountPetRedDot").Numerical1;
-        DicDefaultMount = ConfigParse.GetDic<int, int>(MountRedDotstr);
-        string HorseUpItem = FuncConfigConfig.Get("HorseUpItem").Numerical2;
-        HorseDanExp = int.Parse(HorseUpItem);
-    }
-
-    public override void UnInit()
-    {
-        MountWin.RedPointMountDan -= RedPointMountDan;
-        playerPack.refreshItemCountEvent -= OnItemRefreshEvent;
-    }
-
-
-
-    public void OnBeforePlayerDataInitialize()
-    {
-        IsOk = false;
-        _HorseIDNow = string.Empty;
-        HorseIDNow = 0;
-        _DicHorse.Clear();
-        HorseRidingBool = false;
-        Wait = true;
-    }
-
-    public void OnPlayerLoginOk()
-    {
-        GlobalTimeEvent.Instance.secondEvent -= secondEvent;
-        GlobalTimeEvent.Instance.secondEvent += secondEvent;
-        IsOk = true;
-        SinglePack singPack = playerPack.GetSinglePack(PackType.Equip);
-        if (singPack == null) return;
-        foreach (var index in singPack.GetAllItems().Keys)
-        {
-            OnItemRefreshEvent(singPack.type, index, singPack.GetAllItems()[index].itemId);
-        }
-        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;
-        }
-    }
-
-    List<HorseConfig> Hconfigs = new List<HorseConfig>();
-    List<HorseUpConfig> Uconfigs = new List<HorseUpConfig>();
-    private void MountNumberPreservation()//鐢ㄦ潵瀵瑰潗楠戜釜鏁扮殑淇濆瓨
-    {
-        if (mountRedpoint.Count != 0)
-            return;
-
-        // var configs = HorseConfig.GetValues();
-        if (Hconfigs.Count <= 0)
-        {
-            Hconfigs = HorseConfig.GetValues();
-        }
-        int type = 0;
-        foreach (var config in Hconfigs)
-        {
-            if (!mountRedpoint.ContainsKey(config.HorseID))
-            {
-                type += 1;
-                int mountID = config.HorseID;
-                int RedPoint_Mountkey = MainRedDot.RedPoint_MountPackKey * 10 + mountID;
-                Redpoint redPointMountStare = new Redpoint(Redpoint_key1, RedPoint_Mountkey);
-                mountRedpoint.Add(mountID, redPointMountStare);
-
-                int RedPoint_Mountkey1 = RedPoint_Mountkey * 10 + type;
-                Redpoint redPointMountStare1 = new Redpoint(RedPoint_Mountkey, RedPoint_Mountkey1);
-                DeblockingRedPoint.Add(mountID, redPointMountStare1);
-
-                int RedPoint_Mountkey2 = RedPoint_Mountkey1 * 10 + type;
-                Redpoint redPointMountStare2 = new Redpoint(RedPoint_Mountkey, RedPoint_Mountkey2);
-                ASingleFeedRedPoint.Add(mountID, redPointMountStare2);
-            }
-
-        }
-
-    }
-    private void MountChangeRedPoint()//鍧愰獞婵�娲荤孩鐐�
-    {
-        foreach (var key in DeblockingRedPoint.Keys)
-        {
-            DeblockingRedPoint[key].state = RedPointState.None;
-        }
-        if (!FuncOpen.Instance.IsFuncOpen(8))
-        {
-            return;
-        }
-        if (Hconfigs.Count <= 0)
-        {
-            Hconfigs = HorseConfig.GetValues();
-        }
-        //  var configs = HorseConfig.GetValues();
-        foreach (var config in Hconfigs)
-        {
-            int unlockItemID = config.UnlockItemID;
-            int itemCount = playerPack.GetItemCountByID(PackType.Item, unlockItemID);
-            int unlockItemCnt = config.UnlockItemCnt;
-            if (itemCount >= unlockItemCnt && !_DicHorse.ContainsKey(config.HorseID))
-            {
-                DeblockingRedPoint[config.HorseID].state = RedPointState.Simple;
-            }
-        }
-    }
-
-    void MountSkillAndItem()//鑾峰彇鍧愰獞鎶�鑳�
-    {
-        if (GetMountSkillAndItem.Count != 0)
-            return;
-        if (Uconfigs.Count <= 0)
-        {
-            Uconfigs = HorseUpConfig.GetValues();
-        }
-        //var configs = HorseUpConfig.GetValues();
-        foreach (var config in Uconfigs)
-        {
-            for (int i = 0; i < config.SkillID.Length; i++)
-            {
-                int skillID = config.SkillID[i];
-                if (skillID != 0 && !GetMountSkillAndItem.ContainsKey(skillID))
-                {
-                    SkillConfig _skillModel = SkillConfig.Get(skillID);
-                    HorseSkillClass horseSkillClass = new HorseSkillClass();
-                    horseSkillClass.SkillID = skillID;
-                    horseSkillClass.SkillItem = _skillModel.ExAttr4;
-                    horseSkillClass.HorseID = config.HorseID;
-                    horseSkillClass.HorseLV = config.LV;
-                    GetMountSkillAndItem.Add(skillID, horseSkillClass);
-                }
-            }
-        }
-    }
-    private const int Redpoint_key1 = 1050101;
-    public Redpoint redPointStre1 = new Redpoint(MainRedDot.RedPoint_MountPackKey, Redpoint_key1);//鍧愰獞澶栬
-    private const int Redpoint_key2 = 1050102;
-    public Redpoint redPointStre2 = new Redpoint(MainRedDot.RedPoint_MountPackKey, Redpoint_key2);//鍧愰獞鍏介瓊
-    private void OnItemRefreshEvent(PackType type, int index, int id)
-    {
-        MountH0704(playerPack.GetItemByIndex(type, index));
-        if (type == PackType.Item)
-        {
-            if (_DicMountItem.ContainsKey(id))
-            {
-                MountStoneRed();
-            }
-            MountChangeRedPoint();
-            MountDanRed();
-        }
-    }
-    private void MountStoneRed()//鍧愰獞榄傜煶绾㈢偣
-    {
-
-        redPointStre2.state = RedPointState.None;
-        if (!FuncOpen.Instance.IsFuncOpen(8))
-            return;
-        int type = 0;
-        foreach (var key in _DicMountItem.Keys)
-        {
-            var AttrFruit = AttrFruitConfig.Get(key);
-            if (AttrFruit == null)
-            {
-                continue;
-            }
-            if (_DicMountItem[key] >= AttrFruit.MaxUseCnt)
-            {
-                continue;
-            }
-            type += playerPack.GetItemCountByID(PackType.Item, key);
-        }
-        if (type > 0)
-        {
-            redPointStre2.state = RedPointState.Simple;
-            return;
-        }
-    }
-
-    private void RedPointMountDan()
-    {
-        MountDanRed();
-    }
-
-    private void ToAddSorting()
-    {
-        SortMount.Clear();
-        if (Hconfigs.Count <= 0)
-        {
-            Hconfigs = HorseConfig.GetValues();
-        }
-        SortMount = Hconfigs;
-        SortMount.Sort(Compare);
-    }
-    int Compare(HorseConfig x, HorseConfig y)//鏁扮粍鎺掑垪
-    {
-        if (x.Sort.CompareTo(y.Sort) != 0)
-        {
-            return x.Sort.CompareTo(y.Sort);
-        }
-        return 1;
-    }
-    private void MountDanRed()//鍏充簬鍧愰獞涓圭孩鐐�
-    {
-        foreach (var key in ASingleFeedRedPoint.Keys)
-        {
-            ASingleFeedRedPoint[key].state = RedPointState.None;
-        }
-        if (!FuncOpen.Instance.IsFuncOpen(8) || _DicHorse.Count == 0)
-        {
-            return;
-        }
-        List<int> IntList = new List<int>();
-        FuncConfigConfig _tagfun = FuncConfigConfig.Get("HorseUpItem");
-        ItemConfig _tagchine = ItemConfig.Get(int.Parse(_tagfun.Numerical1));
-        int number = playerPack.GetItemCountByID(PackType.Item, _tagchine.ID);
-        for (int i = 0; i < SortMount.Count; i++)
-        {
-            int horseID = SortMount[i].HorseID;
-            int MaxLv = HorseConfig.Get(horseID).MaxLV;
-            if (_DicHorse.ContainsKey(horseID) && _DicHorse[horseID].Lv < MaxLv)
-            {
-                int _NeedExp = HorseUpConfig.GetHorseIDAndLV(horseID, (_DicHorse[horseID].Lv)).NeedExp;
-                int NeedExp = _NeedExp - _DicHorse[horseID].Exp;
-                int NeedNumber = Mathf.CeilToInt((float)NeedExp / HorseDanExp);
-                if (number >= NeedNumber)
-                {
-                    IntList.Add(horseID);
-                }
-            }
-        }
-
-        foreach (var key in _DicHorse.Keys)//鍥犱负鏈夋垚灏变换鍔¢檺鍒舵墍鏈� 绗竴鍙潗楠戠孩鐐归�昏緫鐗规畩鍐�
-        {
-            if (DicDefaultMount.ContainsKey(key) && DicDefaultMount[key] > _DicHorse[key].Lv
-                && number > 0 && ASingleFeedRedPoint.ContainsKey(key))
-            {
-                ASingleFeedRedPoint[key].state = RedPointState.Simple;
-                return;
-            }
-        }
-        int GetMinLV = 100;
-        int GetMountID = 0;
-        List<int> IntListSkill = new List<int>();
-        for (int j = 0; j < SortMount.Count; j++)//閫夊彇鍑哄彲鍗囩骇鍧愰獞绛夌骇鏈�浣庝笖鏈夋湭婵�娲绘妧鑳界殑鍧愰獞鍒囩粡楠屾渶灏�
-        {
-            int Id = SortMount[j].HorseID;
-            int GetHorseMaxLv = GetMountSkillMaxLV(Id);
-            if (IntList.Contains(Id) && _DicHorse.ContainsKey(Id))
-            {
-                if (_DicHorse[Id].Lv < GetHorseMaxLv)
-                {
-                    IntListSkill.Add(Id);
-                }
-            }
-        }
-        int SkillHorseId = GetRedPointMountID(IntListSkill);
-        if (SkillHorseId != 0 && ASingleFeedRedPoint.ContainsKey(SkillHorseId))
-        {
-            ASingleFeedRedPoint[SkillHorseId].state = RedPointState.Simple;
-            return;
-        }
-
-
-        for (int j = 0; j < SortMount.Count; j++)//閫夊彇鍑哄彲鍗囩骇鍧愰獞绛夌骇鏈�浣�
-        {
-            int Id = SortMount[j].HorseID;
-            if (IntList.Contains(Id) && _DicHorse.ContainsKey(Id))
-            {
-                if (_DicHorse[Id].Lv < GetMinLV)
-                {
-                    GetMinLV = _DicHorse[Id].Lv;
-                    GetMountID = Id;
-                }
-            }
-        }
-        if (GetMountID != 0 && ASingleFeedRedPoint.ContainsKey(GetMountID))
-        {
-            ASingleFeedRedPoint[GetMountID].state = RedPointState.Simple;
-            return;
-        }
-    }
-
-    public int GetMinExpMount()
-    {
-        foreach (var key in ASingleFeedRedPoint.Keys)//褰撳瓨鍦ㄩ┋鍏荤孩鐐规椂閫変腑褰撴湁绾㈢偣鐨勯偅鍙�
-        {
-            if (ASingleFeedRedPoint[key].state == RedPointState.Simple)
-            {
-                return key;
-            }
-        }
-        int GetMountID = 0;
-        int MountLV = 999;
-        List<int> IntListSkill = new List<int>();
-        foreach (var key in _DicHorse.Keys)
-        {
-            var mountConfig = HorseConfig.Get(key);
-            if (_DicHorse[key].Lv < mountConfig.MaxLV)
-            {
-                IntListSkill.Add(key);
-            }
-        }
-        int SkillHorseId = GetRedPointMountID(IntListSkill);
-        if (SkillHorseId != 0)
-        {
-            GetMountID = SkillHorseId;
-            return GetMountID;
-        }
-        foreach (var key in _DicHorse.Keys)//鏃犵孩鐐规椂璺宠浆閫変腑鏈�浣庨樁鏁颁笖鏈弧绾�
-        {
-            var mountConfig = HorseConfig.Get(key);
-            if (_DicHorse[key].Lv < MountLV && _DicHorse[key].Lv < mountConfig.MaxLV)
-            {
-                GetMountID = key;
-                MountLV = _DicHorse[key].Lv;
-            }
-        }
-        return GetMountID;
-    }
-
-    private int GetRedPointMountID(List<int> MountList)
-    {
-        int GetSkillMinLv = 999;
-        for (int i = 0; i < MountList.Count; i++)
-        {
-            int SkillminLv = GetSkillLvDis(MountList[i]);
-            if (SkillminLv < GetSkillMinLv && SkillminLv!=0)
-            {
-                GetSkillMinLv = SkillminLv;
-            }
-        }
-
-        int mountId = 0;
-        int ExpNumber = 999999999;
-        for (int i = 0; i < MountList.Count; i++)
-        {
-            int SkillLv = GetSkillLvDis(MountList[i]);
-            if (SkillLv > GetSkillMinLv || SkillLv==0)
-            {
-                continue;
-            }
-            var Hor1 = HorseUpConfig.GetHorseIDAndLV(MountList[i], SkillLv);
-            var Hor2 = HorseUpConfig.GetHorseIDAndLV(MountList[i],_DicHorse[(MountList[i])].Lv);
-            int Exp = Hor1.NeedExpTotal - Hor2.NeedExpTotal - _DicHorse[(MountList[i])].Exp;
-            if (Exp < ExpNumber)
-            {
-                ExpNumber = Exp;
-                mountId = MountList[i];
-            }
-        }
-        return mountId;
-    }
-
-    private int GetSkillLvDis(int MountId)//鑾峰彇绂诲崌绾ф渶杩戠殑鎶�鑳界瓑绾�
-    {
-        int SkillLv = 0;
-     
-        foreach (var key in GetMountSkillAndItem.Keys)
-        {
-            if (_DicHorse.ContainsKey(MountId) && GetMountSkillAndItem[key].HorseID == MountId)
-            {
-                if (GetMountSkillAndItem[key].HorseLV > _DicHorse[MountId].Lv)
-                {
-                    SkillLv = GetMountSkillAndItem[key].HorseLV;
-                    return SkillLv;
-                }
-            }
-        }
-        return SkillLv;
-    }
-
-    public int GetMountSkillMaxLV(int MountId)//鑾峰彇鍧愰獞鏈�澶ф妧鑳界瓑绾�
-    {
-        int SkillLv = 0;
-        foreach (var key in GetMountSkillAndItem.Keys)
-        {
-            if (GetMountSkillAndItem[key].HorseID == MountId)
-            {
-                if (GetMountSkillAndItem[key].HorseLV > SkillLv)
-                {
-                    SkillLv = GetMountSkillAndItem[key].HorseLV;
-                }
-
-            }
-        }
-        return SkillLv;
-    }
-    public void MountH0704(ItemModel info)//鑾峰彇褰撳墠鐨勫潗楠�
-    {
-
-        if (info == null || info.packType != PackType.Equip)
-            return;
-        if (info.itemPlace == (byte)RoleEquipType.mount)//鍧愰獞浣嶇疆19
-        {
-            if (Hconfigs.Count <= 0)
-            {
-                Hconfigs = HorseConfig.GetValues();
-            }
-            // var configs = HorseConfig.GetValues();
-            foreach (var config in Hconfigs)
-            {
-                if (config.ItemID == info.itemId)
-                {
-                    HorseIDNow = config.HorseID;
-                    _HorseIDNow = config.HorseID.ToString();
-                    if (Event_MountAlteration != null && IsOk)
-                    {
-                        Event_MountAlteration(_HorseIDNow);
-                    }
-
-                }
-            }
-        }
-        MountDanRed();
-        MountStoneRed();
-    }
-
-    public void MountHA301(HA301_tagTrainHorseData info)//宸叉嫢鏈夌殑鍧愰獞锛堣幏寰椾笌鍒锋柊锛�
-    {
-        for (int i = 0; i < info.Num; i++)
-        {
-
-            if (_DicHorse.ContainsKey((int)info.InfoList[i].HorseID))
-            {
-                if ((int)info.InfoList[i].LV > _DicHorse[(int)info.InfoList[i].HorseID].Lv)
-                {
-                    if (OnMountUieffectUpLv != null && IsOk)
-                    {
-                        OnMountUieffectUpLv();
-                    }
-                }
-                _DicHorse[(int)info.InfoList[i].HorseID].Lv = (int)info.InfoList[i].LV;//鍧愰獞绛夌骇
-                _DicHorse[(int)info.InfoList[i].HorseID].Exp = (int)info.InfoList[i].Exp;//鍧愰獞缁忛獙
-                if (Event_MountHA301U != null && IsOk)
-                {
-                    Event_MountHA301U((int)info.InfoList[i].HorseID);
-                }
-
-            }
-            else
-            {
-                HorseClass _horseClass = new HorseClass();
-                _horseClass.Lv = (int)info.InfoList[i].LV;//鍧愰獞绛夌骇
-                _horseClass.Exp = (int)info.InfoList[i].Exp;//鍧愰獞缁忛獙
-
-                _DicHorse.Add((int)info.InfoList[i].HorseID, _horseClass);
-                if (Event_MountHA301A != null && IsOk)
-                {
-                    Event_MountHA301A((int)info.InfoList[i].HorseID);
-                }
-
-            }
-        }
-        MountStoneRed();
-        MountChangeRedPoint();
-        MountDanRed();
-    }
-
-    public void MountHA339(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 (_DicMountItem.ContainsKey((int)info.EatCntList[i].ItemID))
-            {
-                _DicMountItem[(int)info.EatCntList[i].ItemID] = (int)info.EatCntList[i].EatCnt;
-                if (Event_MountHA339U != null)
-                    Event_MountHA339U(info);//鍧愰獞榄傜煶鐨勫埛鏂�
-            }
-            else
-            {
-                if (configItem.Type == 22)
-                {
-                    _DicMountItem.Add((int)info.EatCntList[i].ItemID, (int)info.EatCntList[i].EatCnt);
-                }
-            }
-        }
-        MountStoneRed();
-    }
-    public int GetAllMountAttack()//寰楀埌鎵�鏈夊潗楠戠殑鏀诲嚮
-    {
-        Dictionary<int, int> dicStone = Bonuses();
-        if (_DicHorse.Count == 0)
-        {
-            return dicStone[7];
-        }
-        else
-        {
-            int _AttT = 0;//鏀诲嚮
-            foreach (int key in _DicHorse.Keys)
-            {
-                HorseUpConfig tagMode = HorseUpConfig.GetHorseIDAndLV(key, _DicHorse[key].Lv);
-                int[] intAttrValue = tagMode.AttrValue;
-                if (intAttrValue.Length != 0)
-                {
-                    _AttT += intAttrValue[1];
-                }
-            }
-            return _AttT + dicStone[7];
-        }
-    }
-    Dictionary<int, int> Bonuses()//灞炴�у姞鎴�
-    {
-        Dictionary<int, int> dic = new Dictionary<int, int>();
-        dic.Clear();
-        dic.Add(6, 0);//鐢熷懡
-        dic.Add(7, 0);//鏀诲嚮
-        dic.Add(8, 0);//闃插尽
-        foreach (int key in _DicMountItem.Keys)
-        {
-            if (_DicMountItem[key] != 0)
-            {
-                ItemConfig itemModel = ItemConfig.Get(key);
-                if (dic.ContainsKey(itemModel.Effect1))
-                {
-                    dic[itemModel.Effect1] += itemModel.EffectValueA1 * _DicMountItem[key];
-                }
-                if (dic.ContainsKey(itemModel.Effect2))
-                {
-                    dic[itemModel.Effect2] += itemModel.EffectValueA2 * _DicMountItem[key];
-                }
-                if (dic.ContainsKey(itemModel.Effect3))
-                {
-                    dic[itemModel.Effect3] += itemModel.EffectValueA3 * _DicMountItem[key];
-                }
-                if (dic.ContainsKey(itemModel.Effect4))
-                {
-                    dic[itemModel.Effect4] += itemModel.EffectValueA4 * _DicMountItem[key];
-                }
-                if (dic.ContainsKey(itemModel.Effect5))
-                {
-                    dic[itemModel.Effect5] += itemModel.EffectValueA5 * _DicMountItem[key];
-                }
-            }
-        }
-        return dic;
-    }
-
-    public bool IsHint(HorseEnum horseEnum, int id = 0)//True鎻愮ず锛孎alse涓嶆彁绀�
-    {
-        bool iSHint = false;
-        switch (horseEnum)
-        {
-            case HorseEnum.HorseDan:
-                foreach (var key in _DicHorse.Keys)
-                {
-                    HorseConfig horseConfig = HorseConfig.Get(key);
-                    if (horseConfig.MaxLV > _DicHorse[key].Lv)
-                    {
-                        iSHint = true;
-                    }
-                }
-                return iSHint;
-            case HorseEnum.HorseDebris:
-                if (Hconfigs.Count <= 0)
-                {
-                    Hconfigs = HorseConfig.GetValues();
-                }
-                foreach (var value in Hconfigs)
-                {
-                    if (value.UnlockItemID == id)
-                    {
-                        if (!_DicHorse.ContainsKey(value.HorseID))
-                        {
-                            iSHint = true;
-                        }
-                    }
-                }
-                return iSHint;
-            case HorseEnum.HorseStone:
-                int _maxuse = AttrFruitConfig.Get(id).MaxUseCnt;
-                if (_DicMountItem.ContainsKey(id))
-                {
-                    if (_maxuse > _DicMountItem[id])
-                    {
-                        iSHint = true;
-                    }
-                }
-                return iSHint;
-            default:
-                return true;
-        }
-    }
-
-    public void AppearanceSwitch(int HorseID)//鍧愰獞澶栬鍒囨崲
-    {
-        CA502_tagPlayerChooseHorse _tagCA502 = new CA502_tagPlayerChooseHorse();
-        _tagCA502.Index = (uint)HorseID;
-        GameNetSystem.Instance.SendInfo(_tagCA502);
-    }
-
-    public void MountDanUse(int HorseID, int Number, bool IsAutoBuy = false)//鏄惁鑷姩璐拱
-    {
-        CA527_tagCMHorseUp _tagC527 = new CA527_tagCMHorseUp();//鍚戞湇鍔$鍙戝寘鍧愰獞缁忛獙鍗�
-        _tagC527.HorseID = (uint)HorseID;
-        _tagC527.UseItemCnt = (byte)Number;
-        if (IsAutoBuy)
-        {
-            _tagC527.IsAutoBuy = 1;
-        }
-        GameNetSystem.Instance.SendInfo(_tagC527);
-    }
-
-    public int IsHorsePanelState()
-    {
-        int Type = 0;
-        foreach (var value in DeblockingRedPoint.Values)
-        {
-            if (value.state == RedPointState.Simple)
-            {
-                Type = 2;
-                return Type;
-            }
-        }
-        if (MainRedDot.Instance.redPointMountFunc.state == RedPointState.Simple)
-        {
-            Type = 1;
-            return Type;
-        }
-        return Type;
-    }
-
-    #region 棰勮鍧愰獞纰庣墖灞炴��
-    Dictionary<int, int> mountAttrDict = new Dictionary<int, int>();
-    public Dictionary<int, int> GetMountAttrAddDict(int mountCode)
-    {
-        HorseConfig horseConfig = HorseConfig.Get(mountCode);
-        mountAttrDict.Clear();
-        if (horseConfig == null) return mountAttrDict;
-
-        int maxRank = horseConfig.MaxLV;
-        HorseUpConfig cost = HorseUpConfig.GetHorseIDAndLV(mountCode, maxRank);
-        if (cost != null)
-        {
-            int[] attrIds = cost.AttrType;
-            int[] attrValues = cost.AttrValue;
-            if (attrIds != null)
-            {
-                for (int j = 0; j < attrIds.Length; j++)
-                {
-                    if (!mountAttrDict.ContainsKey(attrIds[j]))
-                    {
-                        mountAttrDict.Add(attrIds[j], attrValues[j]);
-                    }
-                    else
-                    {
-                        mountAttrDict[attrIds[j]] += attrValues[j];
-                    }
-                }
-            }
-        }
-        return mountAttrDict;
-    }
-    #endregion
-}
+锘縰sing Snxxz.UI;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Text.RegularExpressions;
+
+using UnityEngine;
+//鐢ㄤ簬鍧愰獞
+[XLua.LuaCallCSharp]
+public class HorseClass
+{
+    public int Lv;//鍧愰獞绛夌骇
+    public int Exp;//缁忛獙
+
+}
+public enum HorseEnum
+{
+    HorseDan = 0,//鍧愰獞涓�
+    HorseDebris = 1,//鍧愰獞纰庣墖
+    HorseStone = 2,//鍧愰獞榄傜煶
+}
+
+public class HorseSkillClass
+{
+    public int SkillID;//鎶�鑳絀D
+    public int SkillItem;//鍗囩骇鎶�鑳芥墍闇�閬撳叿
+    public int HorseID;//鍧愰獞ID
+    public int HorseLV;//鎵�闇�绛夌骇
+}
+
+public class MountModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
+{
+    public string _HorseIDNow = string.Empty;//鑾峰彇褰撳墠鐨勫潗楠慖D
+    public int HorseIDNow = 0;
+    public delegate void MountHA301Update(int _HorseID);
+    public static event MountHA301Update Event_MountHA301U;//鍧愰獞鐨勬洿鏂�
+    public delegate void MountHA301Add(int _HorseID);
+    public static event MountHA301Add Event_MountHA301A;//鍧愰獞鐨勬坊鍔�
+    public delegate void MountHA339Update(HA339_tagMCAttrFruitEatCntList info);
+    public static event MountHA339Update Event_MountHA339U;//鍧愰獞榄傜煶鐨勫埛鏂�
+
+    public Dictionary<int, HorseSkillClass> GetMountSkillAndItem = new Dictionary<int, HorseSkillClass>();//1鎶�鑳絋ypeID锛屾墍闇�鐨勬秷鑰楃墿鍝両D
+    public delegate void OnMountAlteration(string NowMount);//褰撳墠鍧愰獞鍙樻洿
+    public static event OnMountAlteration Event_MountAlteration;
+    public static event Action OnMountUieffectUpLv;//鍏充簬鍧愰獞鍗囩骇鏃剁壒鏁堟挱鏀炬椂鐨勮皟鐢�
+    public Dictionary<int, HorseClass> _DicHorse = new Dictionary<int, HorseClass>();//褰撳墠鐨勫潗楠戝瓧鍏�
+    public Dictionary<int, int> _DicMountItem = new Dictionary<int, int>();//鍧愰獞榄傜煶鐨勫瓧鍏�
+    public Dictionary<int, Redpoint> mountRedpoint = new Dictionary<int, Redpoint>();//鍧愰獞澶栬鍒囨崲绾㈢偣
+    public Dictionary<int, Redpoint> DeblockingRedPoint = new Dictionary<int, Redpoint>();//婵�娲绘寜閽孩鐐�
+    public Dictionary<int, Redpoint> ASingleFeedRedPoint = new Dictionary<int, Redpoint>();//鍗曟鍠傚吇绾㈢偣
+    private List<HorseConfig> SortMount = new List<HorseConfig>();//鐢ㄤ簬绾㈢偣鎺掑簭
+    public int MountStoneItemId = 0;
+    public bool IsOk = false;
+    public List<int> ListEffectSkill = new List<int>();
+    private int HorseDanExp = 0;//鍧愰獞涓圭粡楠�
+    PackModel _playerPack;
+    PackModel playerPack
+    {
+        get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PackModel>()); }
+    }
+    public bool HorseRidingBool = false;//鐢ㄦ潵鍒ゆ柇鐜╁鏄兘鍦ㄩ獞椹�
+    public bool Wait = true;//绛夊緟鍥炲寘(浣跨敤鍧愰獞涓�)
+    public static Action<int, bool> MultipleEvent;
+    public static event Action PlayerLoginOKData;
+    private Dictionary<int, int> DicDefaultMount = new Dictionary<int, int>();
+    public override void Init()
+    {
+        ToAddSorting();
+        playerPack.refreshItemCountEvent += OnItemRefreshEvent;
+        MountWin.RedPointMountDan += RedPointMountDan;
+        MountSkillAndItem();
+        MountNumberPreservation();
+        string str = FuncConfigConfig.Get("MountSkillEffect").Numerical1;
+        int[] listeffect = ConfigParse.GetMultipleStr<int>(str);
+        ListEffectSkill.Clear();
+        for (int i = 0; i < listeffect.Length; i++)
+        {
+            ListEffectSkill.Add(listeffect[i]);
+        }
+        string MountRedDotstr = FuncConfigConfig.Get("MountPetRedDot").Numerical1;
+        DicDefaultMount = ConfigParse.GetDic<int, int>(MountRedDotstr);
+        string HorseUpItem = FuncConfigConfig.Get("HorseUpItem").Numerical2;
+        HorseDanExp = int.Parse(HorseUpItem);
+    }
+
+    public override void UnInit()
+    {
+        MountWin.RedPointMountDan -= RedPointMountDan;
+        playerPack.refreshItemCountEvent -= OnItemRefreshEvent;
+    }
+
+
+
+    public void OnBeforePlayerDataInitialize()
+    {
+        IsOk = false;
+        _HorseIDNow = string.Empty;
+        HorseIDNow = 0;
+        _DicHorse.Clear();
+        HorseRidingBool = false;
+        Wait = true;
+    }
+
+    public void OnPlayerLoginOk()
+    {
+        GlobalTimeEvent.Instance.secondEvent -= secondEvent;
+        GlobalTimeEvent.Instance.secondEvent += secondEvent;
+        IsOk = true;
+        SinglePack singPack = playerPack.GetSinglePack(PackType.Equip);
+        if (singPack == null) return;
+        foreach (var index in singPack.GetAllItems().Keys)
+        {
+            OnItemRefreshEvent(singPack.type, index, singPack.GetAllItems()[index].itemId);
+        }
+        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;
+        }
+    }
+
+    List<HorseConfig> Hconfigs = new List<HorseConfig>();
+    List<HorseUpConfig> Uconfigs = new List<HorseUpConfig>();
+    private void MountNumberPreservation()//鐢ㄦ潵瀵瑰潗楠戜釜鏁扮殑淇濆瓨
+    {
+        if (mountRedpoint.Count != 0)
+            return;
+
+        // var configs = HorseConfig.GetValues();
+        if (Hconfigs.Count <= 0)
+        {
+            Hconfigs = HorseConfig.GetValues();
+        }
+        int type = 0;
+        foreach (var config in Hconfigs)
+        {
+            if (!mountRedpoint.ContainsKey(config.HorseID))
+            {
+                type += 1;
+                int mountID = config.HorseID;
+                int RedPoint_Mountkey = MainRedDot.RedPoint_MountPackKey * 10 + mountID;
+                Redpoint redPointMountStare = new Redpoint(Redpoint_key1, RedPoint_Mountkey);
+                mountRedpoint.Add(mountID, redPointMountStare);
+
+                int RedPoint_Mountkey1 = RedPoint_Mountkey * 10 + type;
+                Redpoint redPointMountStare1 = new Redpoint(RedPoint_Mountkey, RedPoint_Mountkey1);
+                DeblockingRedPoint.Add(mountID, redPointMountStare1);
+
+                int RedPoint_Mountkey2 = RedPoint_Mountkey1 * 10 + type;
+                Redpoint redPointMountStare2 = new Redpoint(RedPoint_Mountkey, RedPoint_Mountkey2);
+                ASingleFeedRedPoint.Add(mountID, redPointMountStare2);
+            }
+
+        }
+
+    }
+    private void MountChangeRedPoint()//鍧愰獞婵�娲荤孩鐐�
+    {
+        foreach (var key in DeblockingRedPoint.Keys)
+        {
+            DeblockingRedPoint[key].state = RedPointState.None;
+        }
+        if (!FuncOpen.Instance.IsFuncOpen(8))
+        {
+            return;
+        }
+        if (Hconfigs.Count <= 0)
+        {
+            Hconfigs = HorseConfig.GetValues();
+        }
+        //  var configs = HorseConfig.GetValues();
+        foreach (var config in Hconfigs)
+        {
+            int unlockItemID = config.UnlockItemID;
+            int itemCount = playerPack.GetItemCountByID(PackType.Item, unlockItemID);
+            int unlockItemCnt = config.UnlockItemCnt;
+            if (itemCount >= unlockItemCnt && !_DicHorse.ContainsKey(config.HorseID))
+            {
+                DeblockingRedPoint[config.HorseID].state = RedPointState.Simple;
+            }
+        }
+    }
+
+    void MountSkillAndItem()//鑾峰彇鍧愰獞鎶�鑳�
+    {
+        if (GetMountSkillAndItem.Count != 0)
+            return;
+        if (Uconfigs.Count <= 0)
+        {
+            Uconfigs = HorseUpConfig.GetValues();
+        }
+        //var configs = HorseUpConfig.GetValues();
+        foreach (var config in Uconfigs)
+        {
+            for (int i = 0; i < config.SkillID.Length; i++)
+            {
+                int skillID = config.SkillID[i];
+                if (skillID != 0 && !GetMountSkillAndItem.ContainsKey(skillID))
+                {
+                    SkillConfig _skillModel = SkillConfig.Get(skillID);
+                    HorseSkillClass horseSkillClass = new HorseSkillClass();
+                    horseSkillClass.SkillID = skillID;
+                    horseSkillClass.SkillItem = _skillModel.ExAttr4;
+                    horseSkillClass.HorseID = config.HorseID;
+                    horseSkillClass.HorseLV = config.LV;
+                    GetMountSkillAndItem.Add(skillID, horseSkillClass);
+                }
+            }
+        }
+    }
+    private const int Redpoint_key1 = 1050101;
+    public Redpoint redPointStre1 = new Redpoint(MainRedDot.RedPoint_MountPackKey, Redpoint_key1);//鍧愰獞澶栬
+    private const int Redpoint_key2 = 1050102;
+    public Redpoint redPointStre2 = new Redpoint(MainRedDot.RedPoint_MountPackKey, Redpoint_key2);//鍧愰獞鍏介瓊
+    private void OnItemRefreshEvent(PackType type, int index, int id)
+    {
+        MountH0704(playerPack.GetItemByIndex(type, index));
+        if (type == PackType.Item)
+        {
+            if (_DicMountItem.ContainsKey(id))
+            {
+                MountStoneRed();
+            }
+            MountChangeRedPoint();
+            MountDanRed();
+        }
+    }
+    private void MountStoneRed()//鍧愰獞榄傜煶绾㈢偣
+    {
+
+        redPointStre2.state = RedPointState.None;
+        if (!FuncOpen.Instance.IsFuncOpen(8))
+            return;
+        int type = 0;
+        foreach (var key in _DicMountItem.Keys)
+        {
+            var AttrFruit = AttrFruitConfig.Get(key);
+            if (AttrFruit == null)
+            {
+                continue;
+            }
+            if (_DicMountItem[key] >= AttrFruit.MaxUseCnt)
+            {
+                continue;
+            }
+            type += playerPack.GetItemCountByID(PackType.Item, key);
+        }
+        if (type > 0)
+        {
+            redPointStre2.state = RedPointState.Simple;
+            return;
+        }
+    }
+
+    private void RedPointMountDan()
+    {
+        MountDanRed();
+    }
+
+    private void ToAddSorting()
+    {
+        SortMount.Clear();
+        if (Hconfigs.Count <= 0)
+        {
+            Hconfigs = HorseConfig.GetValues();
+        }
+        SortMount = Hconfigs;
+        SortMount.Sort(Compare);
+    }
+    int Compare(HorseConfig x, HorseConfig y)//鏁扮粍鎺掑垪
+    {
+        if (x.Sort.CompareTo(y.Sort) != 0)
+        {
+            return x.Sort.CompareTo(y.Sort);
+        }
+        return 1;
+    }
+    private void MountDanRed()//鍏充簬鍧愰獞涓圭孩鐐�
+    {
+        foreach (var key in ASingleFeedRedPoint.Keys)
+        {
+            ASingleFeedRedPoint[key].state = RedPointState.None;
+        }
+        if (!FuncOpen.Instance.IsFuncOpen(8) || _DicHorse.Count == 0)
+        {
+            return;
+        }
+        List<int> IntList = new List<int>();
+        FuncConfigConfig _tagfun = FuncConfigConfig.Get("HorseUpItem");
+        ItemConfig _tagchine = ItemConfig.Get(int.Parse(_tagfun.Numerical1));
+        int number = playerPack.GetItemCountByID(PackType.Item, _tagchine.ID);
+        for (int i = 0; i < SortMount.Count; i++)
+        {
+            int horseID = SortMount[i].HorseID;
+            int MaxLv = HorseConfig.Get(horseID).MaxLV;
+            if (_DicHorse.ContainsKey(horseID) && _DicHorse[horseID].Lv < MaxLv)
+            {
+                int _NeedExp = HorseUpConfig.GetHorseIDAndLV(horseID, (_DicHorse[horseID].Lv)).NeedExp;
+                int NeedExp = _NeedExp - _DicHorse[horseID].Exp;
+                int NeedNumber = Mathf.CeilToInt((float)NeedExp / HorseDanExp);
+                if (number >= NeedNumber)
+                {
+                    IntList.Add(horseID);
+                }
+            }
+        }
+
+        foreach (var key in _DicHorse.Keys)//鍥犱负鏈夋垚灏变换鍔¢檺鍒舵墍鏈� 绗竴鍙潗楠戠孩鐐归�昏緫鐗规畩鍐�
+        {
+            if (DicDefaultMount.ContainsKey(key) && DicDefaultMount[key] > _DicHorse[key].Lv
+                && number > 0 && ASingleFeedRedPoint.ContainsKey(key))
+            {
+                ASingleFeedRedPoint[key].state = RedPointState.Simple;
+                return;
+            }
+        }
+        int GetMinLV = 100;
+        int GetMountID = 0;
+        List<int> IntListSkill = new List<int>();
+        for (int j = 0; j < SortMount.Count; j++)//閫夊彇鍑哄彲鍗囩骇鍧愰獞绛夌骇鏈�浣庝笖鏈夋湭婵�娲绘妧鑳界殑鍧愰獞鍒囩粡楠屾渶灏�
+        {
+            int Id = SortMount[j].HorseID;
+            int GetHorseMaxLv = GetMountSkillMaxLV(Id);
+            if (IntList.Contains(Id) && _DicHorse.ContainsKey(Id))
+            {
+                if (_DicHorse[Id].Lv < GetHorseMaxLv)
+                {
+                    IntListSkill.Add(Id);
+                }
+            }
+        }
+        int SkillHorseId = GetRedPointMountID(IntListSkill);
+        if (SkillHorseId != 0 && ASingleFeedRedPoint.ContainsKey(SkillHorseId))
+        {
+            ASingleFeedRedPoint[SkillHorseId].state = RedPointState.Simple;
+            return;
+        }
+
+
+        for (int j = 0; j < SortMount.Count; j++)//閫夊彇鍑哄彲鍗囩骇鍧愰獞绛夌骇鏈�浣�
+        {
+            int Id = SortMount[j].HorseID;
+            if (IntList.Contains(Id) && _DicHorse.ContainsKey(Id))
+            {
+                if (_DicHorse[Id].Lv < GetMinLV)
+                {
+                    GetMinLV = _DicHorse[Id].Lv;
+                    GetMountID = Id;
+                }
+            }
+        }
+        if (GetMountID != 0 && ASingleFeedRedPoint.ContainsKey(GetMountID))
+        {
+            ASingleFeedRedPoint[GetMountID].state = RedPointState.Simple;
+            return;
+        }
+    }
+
+    public int GetMinExpMount()
+    {
+        foreach (var key in ASingleFeedRedPoint.Keys)//褰撳瓨鍦ㄩ┋鍏荤孩鐐规椂閫変腑褰撴湁绾㈢偣鐨勯偅鍙�
+        {
+            if (ASingleFeedRedPoint[key].state == RedPointState.Simple)
+            {
+                return key;
+            }
+        }
+        int GetMountID = 0;
+        int MountLV = 999;
+        List<int> IntListSkill = new List<int>();
+        foreach (var key in _DicHorse.Keys)
+        {
+            var mountConfig = HorseConfig.Get(key);
+            if (_DicHorse[key].Lv < mountConfig.MaxLV)
+            {
+                IntListSkill.Add(key);
+            }
+        }
+        int SkillHorseId = GetRedPointMountID(IntListSkill);
+        if (SkillHorseId != 0)
+        {
+            GetMountID = SkillHorseId;
+            return GetMountID;
+        }
+        foreach (var key in _DicHorse.Keys)//鏃犵孩鐐规椂璺宠浆閫変腑鏈�浣庨樁鏁颁笖鏈弧绾�
+        {
+            var mountConfig = HorseConfig.Get(key);
+            if (_DicHorse[key].Lv < MountLV && _DicHorse[key].Lv < mountConfig.MaxLV)
+            {
+                GetMountID = key;
+                MountLV = _DicHorse[key].Lv;
+            }
+        }
+        return GetMountID;
+    }
+
+    private int GetRedPointMountID(List<int> MountList)
+    {
+        int GetSkillMinLv = 999;
+        for (int i = 0; i < MountList.Count; i++)
+        {
+            int SkillminLv = GetSkillLvDis(MountList[i]);
+            if (SkillminLv < GetSkillMinLv && SkillminLv!=0)
+            {
+                GetSkillMinLv = SkillminLv;
+            }
+        }
+
+        int mountId = 0;
+        int ExpNumber = 999999999;
+        for (int i = 0; i < MountList.Count; i++)
+        {
+            int SkillLv = GetSkillLvDis(MountList[i]);
+            if (SkillLv > GetSkillMinLv || SkillLv==0)
+            {
+                continue;
+            }
+            var Hor1 = HorseUpConfig.GetHorseIDAndLV(MountList[i], SkillLv);
+            var Hor2 = HorseUpConfig.GetHorseIDAndLV(MountList[i],_DicHorse[(MountList[i])].Lv);
+            int Exp = Hor1.NeedExpTotal - Hor2.NeedExpTotal - _DicHorse[(MountList[i])].Exp;
+            if (Exp < ExpNumber)
+            {
+                ExpNumber = Exp;
+                mountId = MountList[i];
+            }
+        }
+        return mountId;
+    }
+
+    private int GetSkillLvDis(int MountId)//鑾峰彇绂诲崌绾ф渶杩戠殑鎶�鑳界瓑绾�
+    {
+        int SkillLv = 0;
+     
+        foreach (var key in GetMountSkillAndItem.Keys)
+        {
+            if (_DicHorse.ContainsKey(MountId) && GetMountSkillAndItem[key].HorseID == MountId)
+            {
+                if (GetMountSkillAndItem[key].HorseLV > _DicHorse[MountId].Lv)
+                {
+                    SkillLv = GetMountSkillAndItem[key].HorseLV;
+                    return SkillLv;
+                }
+            }
+        }
+        return SkillLv;
+    }
+
+    public int GetMountSkillMaxLV(int MountId)//鑾峰彇鍧愰獞鏈�澶ф妧鑳界瓑绾�
+    {
+        int SkillLv = 0;
+        foreach (var key in GetMountSkillAndItem.Keys)
+        {
+            if (GetMountSkillAndItem[key].HorseID == MountId)
+            {
+                if (GetMountSkillAndItem[key].HorseLV > SkillLv)
+                {
+                    SkillLv = GetMountSkillAndItem[key].HorseLV;
+                }
+
+            }
+        }
+        return SkillLv;
+    }
+    public void MountH0704(ItemModel info)//鑾峰彇褰撳墠鐨勫潗楠�
+    {
+
+        if (info == null || info.packType != PackType.Equip)
+            return;
+        if (info.itemPlace == (byte)RoleEquipType.mount)//鍧愰獞浣嶇疆19
+        {
+            if (Hconfigs.Count <= 0)
+            {
+                Hconfigs = HorseConfig.GetValues();
+            }
+            // var configs = HorseConfig.GetValues();
+            foreach (var config in Hconfigs)
+            {
+                if (config.ItemID == info.itemId)
+                {
+                    HorseIDNow = config.HorseID;
+                    _HorseIDNow = config.HorseID.ToString();
+                    if (Event_MountAlteration != null && IsOk)
+                    {
+                        Event_MountAlteration(_HorseIDNow);
+                    }
+
+                }
+            }
+        }
+        MountDanRed();
+        MountStoneRed();
+    }
+
+    public void MountHA301(HA301_tagTrainHorseData info)//宸叉嫢鏈夌殑鍧愰獞锛堣幏寰椾笌鍒锋柊锛�
+    {
+        for (int i = 0; i < info.Num; i++)
+        {
+
+            if (_DicHorse.ContainsKey((int)info.InfoList[i].HorseID))
+            {
+                if ((int)info.InfoList[i].LV > _DicHorse[(int)info.InfoList[i].HorseID].Lv)
+                {
+                    if (OnMountUieffectUpLv != null && IsOk)
+                    {
+                        OnMountUieffectUpLv();
+                    }
+                }
+                _DicHorse[(int)info.InfoList[i].HorseID].Lv = (int)info.InfoList[i].LV;//鍧愰獞绛夌骇
+                _DicHorse[(int)info.InfoList[i].HorseID].Exp = (int)info.InfoList[i].Exp;//鍧愰獞缁忛獙
+                if (Event_MountHA301U != null && IsOk)
+                {
+                    Event_MountHA301U((int)info.InfoList[i].HorseID);
+                }
+
+            }
+            else
+            {
+                HorseClass _horseClass = new HorseClass();
+                _horseClass.Lv = (int)info.InfoList[i].LV;//鍧愰獞绛夌骇
+                _horseClass.Exp = (int)info.InfoList[i].Exp;//鍧愰獞缁忛獙
+
+                _DicHorse.Add((int)info.InfoList[i].HorseID, _horseClass);
+                if (Event_MountHA301A != null && IsOk)
+                {
+                    Event_MountHA301A((int)info.InfoList[i].HorseID);
+                }
+
+            }
+        }
+        MountStoneRed();
+        MountChangeRedPoint();
+        MountDanRed();
+    }
+
+    public void MountHA339(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 (_DicMountItem.ContainsKey((int)info.EatCntList[i].ItemID))
+            {
+                _DicMountItem[(int)info.EatCntList[i].ItemID] = (int)info.EatCntList[i].EatCnt;
+                if (Event_MountHA339U != null)
+                    Event_MountHA339U(info);//鍧愰獞榄傜煶鐨勫埛鏂�
+            }
+            else
+            {
+                if (configItem.Type == 22)
+                {
+                    _DicMountItem.Add((int)info.EatCntList[i].ItemID, (int)info.EatCntList[i].EatCnt);
+                }
+            }
+        }
+        MountStoneRed();
+    }
+    public int GetAllMountAttack()//寰楀埌鎵�鏈夊潗楠戠殑鏀诲嚮
+    {
+        Dictionary<int, int> dicStone = Bonuses();
+        if (_DicHorse.Count == 0)
+        {
+            return dicStone[7];
+        }
+        else
+        {
+            int _AttT = 0;//鏀诲嚮
+            foreach (int key in _DicHorse.Keys)
+            {
+                HorseUpConfig tagMode = HorseUpConfig.GetHorseIDAndLV(key, _DicHorse[key].Lv);
+                int[] intAttrValue = tagMode.AttrValue;
+                if (intAttrValue.Length != 0)
+                {
+                    _AttT += intAttrValue[1];
+                }
+            }
+            return _AttT + dicStone[7];
+        }
+    }
+    Dictionary<int, int> Bonuses()//灞炴�у姞鎴�
+    {
+        Dictionary<int, int> dic = new Dictionary<int, int>();
+        dic.Clear();
+        dic.Add(6, 0);//鐢熷懡
+        dic.Add(7, 0);//鏀诲嚮
+        dic.Add(8, 0);//闃插尽
+        foreach (int key in _DicMountItem.Keys)
+        {
+            if (_DicMountItem[key] != 0)
+            {
+                ItemConfig itemModel = ItemConfig.Get(key);
+                if (dic.ContainsKey(itemModel.Effect1))
+                {
+                    dic[itemModel.Effect1] += itemModel.EffectValueA1 * _DicMountItem[key];
+                }
+                if (dic.ContainsKey(itemModel.Effect2))
+                {
+                    dic[itemModel.Effect2] += itemModel.EffectValueA2 * _DicMountItem[key];
+                }
+                if (dic.ContainsKey(itemModel.Effect3))
+                {
+                    dic[itemModel.Effect3] += itemModel.EffectValueA3 * _DicMountItem[key];
+                }
+                if (dic.ContainsKey(itemModel.Effect4))
+                {
+                    dic[itemModel.Effect4] += itemModel.EffectValueA4 * _DicMountItem[key];
+                }
+                if (dic.ContainsKey(itemModel.Effect5))
+                {
+                    dic[itemModel.Effect5] += itemModel.EffectValueA5 * _DicMountItem[key];
+                }
+            }
+        }
+        return dic;
+    }
+
+    public bool IsHint(HorseEnum horseEnum, int id = 0)//True鎻愮ず锛孎alse涓嶆彁绀�
+    {
+        bool iSHint = false;
+        switch (horseEnum)
+        {
+            case HorseEnum.HorseDan:
+                foreach (var key in _DicHorse.Keys)
+                {
+                    HorseConfig horseConfig = HorseConfig.Get(key);
+                    if (horseConfig.MaxLV > _DicHorse[key].Lv)
+                    {
+                        iSHint = true;
+                    }
+                }
+                return iSHint;
+            case HorseEnum.HorseDebris:
+                if (Hconfigs.Count <= 0)
+                {
+                    Hconfigs = HorseConfig.GetValues();
+                }
+                foreach (var value in Hconfigs)
+                {
+                    if (value.UnlockItemID == id)
+                    {
+                        if (!_DicHorse.ContainsKey(value.HorseID))
+                        {
+                            iSHint = true;
+                        }
+                    }
+                }
+                return iSHint;
+            case HorseEnum.HorseStone:
+                int _maxuse = AttrFruitConfig.Get(id).MaxUseCnt;
+                if (_DicMountItem.ContainsKey(id))
+                {
+                    if (_maxuse > _DicMountItem[id])
+                    {
+                        iSHint = true;
+                    }
+                }
+                return iSHint;
+            default:
+                return true;
+        }
+    }
+
+    public void AppearanceSwitch(int HorseID)//鍧愰獞澶栬鍒囨崲
+    {
+        CA502_tagPlayerChooseHorse _tagCA502 = new CA502_tagPlayerChooseHorse();
+        _tagCA502.Index = (uint)HorseID;
+        GameNetSystem.Instance.SendInfo(_tagCA502);
+    }
+
+    public void MountDanUse(int HorseID, int Number, bool IsAutoBuy = false)//鏄惁鑷姩璐拱
+    {
+        CA527_tagCMHorseUp _tagC527 = new CA527_tagCMHorseUp();//鍚戞湇鍔$鍙戝寘鍧愰獞缁忛獙鍗�
+        _tagC527.HorseID = (uint)HorseID;
+        _tagC527.UseItemCnt = (byte)Number;
+        if (IsAutoBuy)
+        {
+            _tagC527.IsAutoBuy = 1;
+        }
+        GameNetSystem.Instance.SendInfo(_tagC527);
+    }
+
+    public int IsHorsePanelState()
+    {
+        int Type = 0;
+        foreach (var value in DeblockingRedPoint.Values)
+        {
+            if (value.state == RedPointState.Simple)
+            {
+                Type = 2;
+                return Type;
+            }
+        }
+        if (MainRedDot.Instance.redPointMountFunc.state == RedPointState.Simple)
+        {
+            Type = 1;
+            return Type;
+        }
+        return Type;
+    }
+
+    #region 棰勮鍧愰獞纰庣墖灞炴��
+    Dictionary<int, int> mountAttrDict = new Dictionary<int, int>();
+    public Dictionary<int, int> GetMountAttrAddDict(int mountCode)
+    {
+        HorseConfig horseConfig = HorseConfig.Get(mountCode);
+        mountAttrDict.Clear();
+        if (horseConfig == null) return mountAttrDict;
+
+        int maxRank = horseConfig.MaxLV;
+        HorseUpConfig cost = HorseUpConfig.GetHorseIDAndLV(mountCode, maxRank);
+        if (cost != null)
+        {
+            int[] attrIds = cost.AttrType;
+            int[] attrValues = cost.AttrValue;
+            if (attrIds != null)
+            {
+                for (int j = 0; j < attrIds.Length; j++)
+                {
+                    if (!mountAttrDict.ContainsKey(attrIds[j]))
+                    {
+                        mountAttrDict.Add(attrIds[j], attrValues[j]);
+                    }
+                    else
+                    {
+                        mountAttrDict[attrIds[j]] += attrValues[j];
+                    }
+                }
+            }
+        }
+        return mountAttrDict;
+    }
+    #endregion
+}

--
Gitblit v1.8.0