Prechádzať zdrojové kódy

Merge branch 'master' of http://192.168.2.10:3000/GFG/Client

zhangyuqian 10 mesiacov pred
rodič
commit
4f4b4c8c63

+ 20 - 7
GameClient/Assets/Editor/Excel/Scanner/ItemApproachScanner.cs

@@ -3,6 +3,7 @@ using UnityEngine;
 using GFGGame;
 using System;
 using System.Linq;
+using ET;
 
 namespace GFGEditor
 {
@@ -719,19 +720,31 @@ namespace GFGEditor
         }
         private static bool CheckIsHasItem(int itemId, int checkId)
         {
-            ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(checkId);
-            if (itemCfg.itemType == ConstItemType.USEABLE)
+            try
             {
-                for (int i = 0; i < itemCfg.itemsArr.Length; i++)
+                ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(checkId);
+                if (itemCfg == null)
+                {
+                    Log.Error($"CheckIsHasItem itemCfg is null. itemId:{itemId} checkId:{checkId}");
+                }
+                if (itemCfg.itemType == ConstItemType.USEABLE)
+                {
+                    for (int i = 0; i < itemCfg.itemsArr.Length; i++)
+                    {
+                        if (itemCfg.itemsArr[i][0] == itemId) return true;
+                    }
+                }
+                else if (checkId == itemId)
                 {
-                    if (itemCfg.itemsArr[i][0] == itemId) return true;
+                    return true;
                 }
+                return false;
             }
-            else if (checkId == itemId)
+            catch (Exception e)
             {
-                return true;
+                Log.Error($"CheckIsHasItemxxx itemCfg is null. itemId:{itemId} checkId:{checkId}");
+                throw;
             }
-            return false;
         }
 
         /// <summary>