Browse Source

修复过滤BUG

胡佳骏 1 year ago
parent
commit
4216d320a6

+ 45 - 6
Assets/FrameWork/ProjectManager/Scripts/Project/XunJian/XunJianDataManager.cs

@@ -19,26 +19,65 @@ public class XunJianDataManager : Singleton<XunJianDataManager>
 
     }
 
+    public string nowArea = "全部";
     public void GetAreaList(string area, Action<List<XunJianListData>> callback)
     {
+        nowArea = area;
+        List<XunJianListData> data = new List<XunJianListData>();
         if (areaList.ContainsKey(area))
         {
-            callback.Invoke(areaList[area]);
+            for (int i = 0; i < areaList[area].Count; i++)
+            {
+                Debug.Log(nowPeople == areaList[area][i].people);
+                Debug.Log(!peopleList.ContainsKey(nowPeople));
+                if (nowPeople == areaList[area][i].people || !peopleList.ContainsKey(nowPeople))
+                {
+                    data.Add(areaList[area][i]);
+                }
+
+            }
+            callback.Invoke(data);
         }
         else
         {
-            callback.Invoke(xjDataList);
+            for (int i = 0; i < xjDataList.Count; i++)
+            {
+                if (nowPeople == xjDataList[i].people || !peopleList.ContainsKey(nowPeople))
+                {
+                    data.Add(xjDataList[i]);
+                }
+
+            }
+            callback.Invoke(data);
         }
     }
-
+    public string nowPeople="全部";
     public void GetPeopleList(string people, Action<List<XunJianListData>> callback)
     {
-        if(peopleList.ContainsKey(people))
+        nowPeople = people;
+        List<XunJianListData> data = new List<XunJianListData>();
+        if (peopleList.ContainsKey(people))
         {
-            callback.Invoke( peopleList[people]);
+            for (int i = 0; i < peopleList[people].Count; i++)
+            {
+                if(nowArea == peopleList[people][i].inarea||!areaList.ContainsKey(nowArea))
+                {
+                    data.Add(peopleList[people][i]);
+                }
+                
+            }
+            callback.Invoke(data);
         }else
         {
-            callback.Invoke(xjDataList);
+            for (int i = 0; i < xjDataList.Count; i++)
+            {
+                if (nowArea == xjDataList[i].inarea || !areaList.ContainsKey(nowArea))
+                {
+                    data.Add(xjDataList[i]);
+                }
+
+            }
+            callback.Invoke(data);
         }
     }
     XunJianListData testData()