Browse Source

服装养护修改属性规则

zhaoyang 2 years ago
parent
commit
d822b6d409

+ 64 - 65
GameClient/Assets/Game/HotUpdate/Data/SuitFosterDatamanager.cs

@@ -61,55 +61,55 @@ namespace GFGGame
         }
 
         //加成属性服装占比
-        public List<KeyValuePair<int, string>> GetPropertyPercentData(int suitId, int index)
-        {
-            List<SuitFosterCfg> cfgs = SuitFosterCfgArray.Instance.GetCfgsBysuitId(suitId);
-            Dictionary<int, int> _data = new Dictionary<int, int>();
+        // public List<KeyValuePair<int, string>> GetPropertyPercentData(int suitId, int index)
+        // {
+        // List<SuitFosterCfg> cfgs = SuitFosterCfgArray.Instance.GetCfgsBysuitId(suitId);
+        // Dictionary<int, int> _data = new Dictionary<int, int>();
 
-            for (int i = 0; i < cfgs.Count; i++)
-            {
-                int[][] partsArr = cfgs[i].partsArr;
-                for (int j = 0; j < partsArr.Length; j++)
-                {
-                    ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(partsArr[j][0]);
-                    // int id = ItemTypeCfgArray.Instance.GetCfg(itemCfg.subType).i;
-                    if (index < cfgs.Count && index == i || index >= cfgs.Count)
-                    {
-                        int num = 0;
+        // for (int i = 0; i < cfgs.Count; i++)
+        // {
+        //     int[][] partsArr = cfgs[i].partsArr;
+        //     for (int j = 0; j < partsArr.Length; j++)
+        //     {
+        //         ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(partsArr[j][0]);
+        //         // int id = ItemTypeCfgArray.Instance.GetCfg(itemCfg.subType).i;
+        //         if (index < cfgs.Count && index == i || index >= cfgs.Count)
+        //         {
+        //             int num = 0;
 
-                        if (!_data.ContainsKey(itemCfg.id))
-                        {
-                            _data.Add(itemCfg.id, num);
-                        }
+        //             if (!_data.ContainsKey(itemCfg.id))
+        //             {
+        //                 _data.Add(itemCfg.id, num);
+        //             }
 
-                        num = _data[itemCfg.id];
-                        num = num + partsArr[j][1];
-                        _data[itemCfg.id] = num;
+        //             num = _data[itemCfg.id];
+        //             num = num + partsArr[j][1];
+        //             _data[itemCfg.id] = num;
 
-                    }
-                }
-            }
+        //         }
+        //     }
+        // }
 
-            ICollection keys = _data.Keys;
-            Dictionary<int, string> _dataPercent = new Dictionary<int, string>();
-            foreach (int key in keys)
-            {
+        // ICollection keys = _data.Keys;
+        // Dictionary<int, string> _dataPercent = new Dictionary<int, string>();
+        // foreach (int key in keys)
+        // {
 
-                ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(key);
-                float mainScore = ItemDataManager.GetItemBaseScoreValue(key, itemCfg.mainScore);
-                float addScore = _data[key];
-                float percent = (addScore / mainScore * 100);
-                _dataPercent.Add(key, percent.ToString("0.00"));
+        //     ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(key);
+        //     float mainScore = ItemDataManager.GetItemBaseScoreValue(key, itemCfg.mainScore);
+        //     float addScore = _data[key];
+        //     float percent = (addScore / mainScore * 100);
+        //     _dataPercent.Add(key, percent.ToString("0.00"));
 
-            }
-            return new List<KeyValuePair<int, string>>(_dataPercent);
-        }
+        // }
+        // return new List<KeyValuePair<int, string>>(_dataPercent);
+        // }
 
         //获取当前阶段部件属性总值
-        public void GetPropertyData(int suitId, int index, out SortedList _propertyData, out SortedList _addPropertyData)
+        public SortedList GetPropertyData(int suitId, int index)
         {
-            _propertyData = new SortedList();
-            _addPropertyData = new SortedList();
+            SortedList _propertyData = new SortedList();
+            // _addPropertyData = new SortedList();
 
             int[] parts = SuitCfgArray.Instance.GetCfg(suitId).partsArr;
             for (int i = 0; i < parts.Length; i++)
@@ -131,39 +131,38 @@ namespace GFGGame
                         _propertyData.Add(score, count);
                     }
                 }
+
             }
-            List<SuitFosterCfg> cfgs = SuitFosterCfgArray.Instance.GetCfgsBysuitId(suitId);
-            for (int i = 0; i < cfgs.Count; i++)
+            return _propertyData;
+        }
+
+        public Dictionary<int, int> GetAdditionPropertyData(int suitId, int index)
+        {
+            Dictionary<int, int> _addPropertyData = new Dictionary<int, int>();
+            SuitFosterCfg cfg = SuitFosterCfgArray.Instance.GetCfgsBysuitId(suitId)[index];
+
+            int[] parts = SuitCfgArray.Instance.GetCfg(suitId).partsArr;
+            for (int j = 0; j < parts.Length; j++)
             {
-                int[][] partsArr = cfgs[i].partsArr;
-                for (int j = 0; j < partsArr.Length; j++)
+                ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(parts[j]);
+                for (int k = 0; k < ConstDressUpScoreType.scoreTypeList().Count; k++)
                 {
-                    ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(partsArr[j][0]);
-                    for (int k = 0; k < ConstDressUpScoreType.scoreTypeList().Count; k++)
-                    {
-                        int score = k + 1;
-                        if (index < cfgs.Count && index == i || index >= cfgs.Count)
-                        {
-
-                            int addCount = 0;
-                            if (score == itemCfg.mainScore)
-                            {
-                                addCount = partsArr[j][1];
-                            }
-                            if (_addPropertyData.ContainsKey(score))
-                            {
-                                addCount = addCount + (int)_addPropertyData[score];
-                                _addPropertyData[score] = addCount;
-                            }
-                            else
-                            {
-                                _addPropertyData.Add(score, addCount);
-                            }
-                        }
+                    int score = k + 1;
+
+                    int addCount = cfg.addition;
 
+                    if (_addPropertyData.ContainsKey(score))
+                    {
+                        addCount = addCount + (int)_addPropertyData[score];
+                        _addPropertyData[score] = addCount;
+                    }
+                    else
+                    {
+                        _addPropertyData.Add(score, addCount);
                     }
                 }
             }
+            return _addPropertyData;
         }
         //0:已完成,1:养护中,2未养护
         public int GetFosterState(int suitId, int index)

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/ClothingFoster/ClothingFosterFinishView.cs

@@ -49,7 +49,7 @@ namespace GFGGame
 
 
             _lastPropertyList = (this.viewData as object[])[2] as SortedList;
-            SuitFosterDataManager.Instance.GetPropertyData(_suitId, _index, out _curPropertyList, out SortedList _addPropertyList);
+            _curPropertyList = SuitFosterDataManager.Instance.GetPropertyData(_suitId, _index);
 
             SuitFosterData data = SuitFosterDataManager.Instance.GetSuitFosterData(_suitId);
             SuitFosterListCfg cfg = SuitFosterListCfgArray.Instance.GetCfg(_suitId);

+ 5 - 3
GameClient/Assets/Game/HotUpdate/Views/ClothingFoster/ClothingFosterView.cs

@@ -1,4 +1,5 @@
 using System.Collections;
+using System.Collections.Generic;
 using ET;
 using FairyGUI;
 using UI.ClothingFoster;
@@ -12,7 +13,7 @@ namespace GFGGame
         private int _suitId;
         private int _index;
         private SortedList _propertyList;
-        private SortedList _addPropertyList;
+        private Dictionary<int, int> _addPropertyList;
         private bool _canFoster;
         public override void Dispose()
         {
@@ -53,7 +54,7 @@ namespace GFGGame
             _suitId = (int)(this.viewData as object[])[0];
             _index = (int)(this.viewData as object[])[1];
             _propertyList = (this.viewData as object[])[2] as SortedList;
-            _addPropertyList = (this.viewData as object[])[3] as SortedList;
+            _addPropertyList = SuitFosterDataManager.Instance.GetAdditionPropertyData(_suitId, _index);
             _canFoster = true;
 
             SuitFosterCfg cfg = SuitFosterCfgArray.Instance.GetCfgsBysuitId(_suitId)[_index];
@@ -110,7 +111,8 @@ namespace GFGGame
             comProperty.m_txtProperty.text = _propertyList[score].ToString();
             comProperty.m_loaIcon.url = ResPathUtil.GetCommonGameResPath("kp_sx_" + (score));
 
-            item.m_txtAdd.text = "+" + _addPropertyList.GetByIndex(index);
+            double addition = _addPropertyList[score] * 100 / 10000;
+            item.m_txtAdd.text = string.Format("+{0}%", addition);
             UI_ListPropertyAddItem.ProxyEnd();
             UI_ListPropertyItem.ProxyEnd();
         }

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Views/ClothingFoster/ClothingPropertyShowView.cs

@@ -45,8 +45,8 @@ namespace GFGGame
             int index = (int)(this.viewData as object[])[1];
 
 
-            _dataList = SuitFosterDataManager.Instance.GetPropertyPercentData(suitId, index);
-            _ui.m_listPropertyShow.numItems = _dataList.Count;
+            // _dataList = SuitFosterDataManager.Instance.GetPropertyPercentData(suitId, index);
+            // _ui.m_listPropertyShow.numItems = _dataList.Count;
         }
 
         private void ListPropertyShowItemRender(int index, GObject obj)

+ 4 - 3
GameClient/Assets/Game/HotUpdate/Views/ClothingFoster/ClothingView.cs

@@ -183,7 +183,7 @@ namespace GFGGame
             _sceneObject = GameObject.Instantiate(_scenePrefab);
             int scale = 100;
             _sceneObject.transform.localScale = new Vector3(scale, scale, scale);
-            _dressUpObj.setSceneObj(_sceneObject, false,true, null, false);
+            _dressUpObj.setSceneObj(_sceneObject, false, true, null, false);
             _dressUpObj.PutOnDefaultDressUpData();
             _dressUpObj.PutOnSuitCfg(_suitId, isPic, new int[] { ConstDressUpItemType.BEI_JING });
             if (_wrapper == null)
@@ -217,7 +217,8 @@ namespace GFGGame
             _addPropertyList.Clear();
             UpdateFosterList();
 
-            SuitFosterDataManager.Instance.GetPropertyData(_suitId, _index, out _propertyList, out _addPropertyList);
+
+            _propertyList = SuitFosterDataManager.Instance.GetPropertyData(_suitId, _index);
             _ui.m_listProperty.numItems = _propertyList.Count;
         }
         private void UpdateFosterReward()
@@ -267,7 +268,7 @@ namespace GFGGame
             }
             else if (state == 1)
             {
-                ViewManager.Show<ClothingFosterView>(new object[] { _suitId, index, _propertyList, _addPropertyList, this.viewData });
+                ViewManager.Show<ClothingFosterView>(new object[] { _suitId, index, _propertyList, this.viewData });
             }
             else
             {

BIN
GameClient/Assets/ResIn/Config/excelConfig.sqlite.bytes