From 937393c74ad3e713bf0cbbeeedba062ce9e58a44 Mon Sep 17 00:00:00 2001
From: client_Zxw <826696702@qq.com>
Date: 星期四, 06 十二月 2018 11:30:32 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts

---
 System/KnapSack/Logic/ItemTipsModel.cs |   79 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 78 insertions(+), 1 deletions(-)

diff --git a/System/KnapSack/Logic/ItemTipsModel.cs b/System/KnapSack/Logic/ItemTipsModel.cs
index b610943..6c37937 100644
--- a/System/KnapSack/Logic/ItemTipsModel.cs
+++ b/System/KnapSack/Logic/ItemTipsModel.cs
@@ -451,7 +451,8 @@
                     petAndMountQualityDict.Add(qualitys[i],qualityNames[i]);
                 }
             }
-        
+
+            ParseFuncConfig();
         }
 
         public void OnBeforePlayerDataInitialize()
@@ -463,6 +464,47 @@
         {
 
         }
+        #region 瑙f瀽鏈湴鏁版嵁
+        public Dictionary<string,List<int>> atkSpeedColorDict { get; private set; }
+        private void ParseFuncConfig()
+        {
+            atkSpeedColorDict = new Dictionary<string, List<int>>();
+            var equipYPAtkSpeedColor = Config.Instance.Get<FuncConfigConfig>("EquipYPAtkSpeedColor");
+            JsonData atkSpeedData = JsonMapper.ToObject(equipYPAtkSpeedColor.Numerical1);
+            foreach(var color in atkSpeedData.Keys)
+            {
+                List<int> list = new List<int>();
+                atkSpeedColorDict.Add(color,list);
+                if(atkSpeedData[color].IsArray)
+                {
+                    for(int i = 0; i < atkSpeedData[color].Count; i++)
+                    {
+                        int range = 0;
+                        int.TryParse(atkSpeedData[color][i].ToString(),out range);
+                        list.Add(range);
+                    }
+                }
+            }
+        }
+
+        public bool TryGetAtkSpeedColor(int atkSpeed,out string color)
+        {
+            color = string.Empty;
+            foreach(var key in atkSpeedColorDict.Keys)
+            {
+                var rangelist = atkSpeedColorDict[key];
+                if(rangelist.Count > 1)
+                {
+                    if(atkSpeed >= rangelist[0] && atkSpeed <= rangelist[1])
+                    {
+                        color = key;
+                        return true;
+                    }
+                }
+            }
+            return false;
+        }
+        #endregion
 
         /// <summary>
         /// 鍒锋柊鑴辨満澶栨寕鏃堕棿
@@ -1071,6 +1113,12 @@
                             }
                         }
 
+                        if(key == (int)AttrEnum.ATKSPEED)
+                        {
+                            int attrValue = GetProValueType(playerProModel.ISPercentage, itemEffectDict[key]);
+                            otherStr = SetAttrColor(otherStr,attrValue,attrData.itemConfig.EquipPlace);
+                        }
+
                         if (attrSB.Length <= 0)
                         {
                             attrSB.Append(otherStr);
@@ -1177,6 +1225,35 @@
             }
             return s;
         }
+
+        private string SetAttrColor(string attrStr,int atkSpeed,int equipPlace)
+        {
+            if ((RoleEquipType)equipPlace != RoleEquipType.retFairyCan
+                && (RoleEquipType)equipPlace != RoleEquipType.retFairyCan2)
+            {
+                return attrStr;
+            }
+
+            string color = string.Empty;
+            bool isColor = TryGetAtkSpeedColor(atkSpeed,out color);
+            if(isColor)
+            {
+                return StringUtility.Contact("<color=#",color, ">", attrStr, "</color>");
+            }
+            return attrStr;
+        }
+
+        public int GetProValueType(int precentType, int value)
+        {
+            switch(precentType)
+            {
+                case 1:
+                case 2:
+                    return Mathf.RoundToInt(value / 100);
+                default:
+                    return value;
+            }
+        }
         #endregion
 
         #region 璁剧疆浼犲灞炴��

--
Gitblit v1.8.0