From 7fbd9ad15f11d7011fe53943b08dc60ff6ec48e8 Mon Sep 17 00:00:00 2001 From: liutao <821580467@qq.com> Date: Tue, 28 Oct 2025 13:09:08 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=B7=B7=E6=B7=86=E3=80=91=E9=98=B2?= =?UTF-8?q?=E5=B4=A9=E6=BA=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Code/Scripts/GameWrapper/Map/MapData.cs | 2 ++ .../Code/Scripts/GameWrapper/Map/MapUtils.cs | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ProjectNLD/Assets/Code/Scripts/GameWrapper/Map/MapData.cs b/ProjectNLD/Assets/Code/Scripts/GameWrapper/Map/MapData.cs index 068bb5a661c..5381fa0be9d 100644 --- a/ProjectNLD/Assets/Code/Scripts/GameWrapper/Map/MapData.cs +++ b/ProjectNLD/Assets/Code/Scripts/GameWrapper/Map/MapData.cs @@ -4,8 +4,10 @@ using cfg.FightCfg; using Sirenix.OdinInspector; using UnityEngine; using Newtonsoft.Json; +using Obfuz; [Serializable] +[ObfuzIgnore] public class MapData { [Serializable] diff --git a/ProjectNLD/Assets/Code/Scripts/GameWrapper/Map/MapUtils.cs b/ProjectNLD/Assets/Code/Scripts/GameWrapper/Map/MapUtils.cs index 9865e46f4cd..6a86c1495e0 100644 --- a/ProjectNLD/Assets/Code/Scripts/GameWrapper/Map/MapUtils.cs +++ b/ProjectNLD/Assets/Code/Scripts/GameWrapper/Map/MapUtils.cs @@ -53,8 +53,19 @@ public static class MapUtils DebugUtil.Log("[MapUtils: LoadMapData] ------------ 4"); MapData mapData = null; DebugUtil.Log("[MapUtils: LoadMapData] ------------ 5"); - if (textAsset is not null) - mapData = JsonUtility.FromJson(textAsset.text); + try + { + // 这里可能会抛异常,捕获一下避免程序崩溃 + if (textAsset is not null) + { + mapData = JsonUtility.FromJson(textAsset.text); + } + } + catch (Exception e) + { + DebugUtil.LogError("LoadMap.LoadMap failed, exception:{0}", e.ToString()); + } + DebugUtil.Log("[MapUtils: LoadMapData] ------------ 6"); if (null == mapData) DebugUtil.LogError("LoadMap.LoadMap failed, can not find map config: {0}", mapPath);