浏览代码

养护状态

zhaoyang 3 年之前
父节点
当前提交
e03d60173f

+ 20 - 1
GameClient/Assets/Game/HotUpdate/Data/SuitFosterDatamanager.cs

@@ -42,7 +42,9 @@ namespace GFGGame
 
 
         public SuitFosterData GetSuitFosterData(int suitId)
         public SuitFosterData GetSuitFosterData(int suitId)
         {
         {
-            return _suitInfoBySuitIdDic[suitId];
+
+            return _suitInfoBySuitIdDic.ContainsKey(suitId) ? _suitInfoBySuitIdDic[suitId] : new SuitFosterData() { suitId = suitId, maintainStep = 0, maintainBonusSteps = new List<int>(), makeNewState = 0 };
+
         }
         }
 
 
         //加成属性服装占比
         //加成属性服装占比
@@ -86,6 +88,7 @@ namespace GFGGame
             return new List<KeyValuePair<string, int>>(_dataPercent);
             return new List<KeyValuePair<string, int>>(_dataPercent);
         }
         }
 
 
+        //获取当前阶段部件属性总值
         public SortedList GetPropertyData(int suitId, int index)
         public SortedList GetPropertyData(int suitId, int index)
         {
         {
             SortedList propertyData = new SortedList();
             SortedList propertyData = new SortedList();
@@ -108,5 +111,21 @@ namespace GFGGame
             return propertyData;
             return propertyData;
         }
         }
 
 
+        //0:未养护,1:养护中,2未养护
+        public int GetFosterState(int suitId, int index)
+        {
+            SuitFosterData suitFosterData = this.GetSuitFosterData(suitId);
+            if (suitFosterData.maintainStep == index)
+            {
+                return 1;
+            }
+            else if (suitFosterData.maintainStep < index)
+            {
+                return 2;
+            }
+
+            return 0;
+
+        }
     }
     }
 }
 }

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Utils/SuitUtil.cs

@@ -189,8 +189,8 @@ namespace GFGGame
                 }
                 }
             }
             }
 
 
-            SuitFosterCfg[] dataArray = SuitFosterCfgArray.Instance.dataArray;
-            foreach (SuitFosterCfg suitCfg in dataArray)
+            SuitFosterListCfg[] dataArray = SuitFosterListCfgArray.Instance.dataArray;
+            foreach (SuitFosterListCfg suitCfg in dataArray)
             {
             {
                 CheckToAdd(suitCfg.suitId);
                 CheckToAdd(suitCfg.suitId);
             }
             }

+ 12 - 0
GameClient/Assets/Game/HotUpdate/Views/ClothingFoster/SuitView.cs

@@ -2,6 +2,7 @@ using System.Collections;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using FairyGUI;
 using FairyGUI;
 using UI.ClothingFoster;
 using UI.ClothingFoster;
+using UI.CommonGame;
 using UnityEngine;
 using UnityEngine;
 
 
 namespace GFGGame
 namespace GFGGame
@@ -50,6 +51,8 @@ namespace GFGGame
 
 
             _ui.m_listFoster.itemRenderer = ListFosterItemRender;
             _ui.m_listFoster.itemRenderer = ListFosterItemRender;
             _ui.m_listFoster.onClickItem.Add(OnClickListFosterItem);
             _ui.m_listFoster.onClickItem.Add(OnClickListFosterItem);
+
+            _ui.m_listProperty.itemRenderer = ListPropertyItemRender;
         }
         }
 
 
         protected override void OnShown()
         protected override void OnShown()
@@ -146,6 +149,15 @@ namespace GFGGame
                 _index = index;
                 _index = index;
             }
             }
         }
         }
+
+        private void ListPropertyItemRender(int index, GObject obj)
+        {
+            UI_ListPropertyItem item = UI_ListPropertyItem.Proxy(obj);
+            int score = index + 1;
+            item.m_txtProperty.text = _propertyList[score].ToString();
+            item.m_loaIcon.url = ResPathUtil.GetCommonGameResPath("kp_sx_" + (score));
+        }
+
         private void OnClickListFosterItem(EventContext context)
         private void OnClickListFosterItem(EventContext context)
         {
         {
             int index = (int)(context.data as GObject).data;
             int index = (int)(context.data as GObject).data;