From f5a30bfc9b74cd0185334fd45b5c27c93742576f Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期二, 31 十二月 2024 17:04:42 +0800
Subject: [PATCH] 10331 【越南】【英语】【BT】【砍树】境界修改 - 临时同步
---
Core/GameEngine/Model/ConfigParse.cs | 42 ++++++++++++++++++++++++++++++++++++++++--
1 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/Core/GameEngine/Model/ConfigParse.cs b/Core/GameEngine/Model/ConfigParse.cs
index 44f08ba..3b00b1a 100644
--- a/Core/GameEngine/Model/ConfigParse.cs
+++ b/Core/GameEngine/Model/ConfigParse.cs
@@ -202,12 +202,50 @@
public static Dictionary<int, List<int>> ParseJsonDict(string jsonStr)
{
+ if (jsonStr == "{}" || string.IsNullOrEmpty(jsonStr))
+ {
+ return new Dictionary<int, List<int>>();
+ }
var dict = JsonMapper.ToObject<Dictionary<string, List<int>>>(jsonStr);
Dictionary<int, List<int>> result = new Dictionary<int, List<int>>();
- foreach (var key in dict.Keys)
+ foreach (var item in dict)
{
- result[int.Parse(key)] = dict[key];
+ result[int.Parse(item.Key)] = item.Value;
+ }
+
+ return result;
+ }
+
+ public static Dictionary<int, int> ParseIntDict(string jsonStr)
+ {
+ if (jsonStr == "{}" || string.IsNullOrEmpty(jsonStr))
+ {
+ return new Dictionary<int, int>();
+ }
+ var dict = JsonMapper.ToObject<Dictionary<string, int>>(jsonStr);
+ Dictionary<int, int> result = new Dictionary<int, int>();
+
+ foreach (var item in dict)
+ {
+ result[int.Parse(item.Key)] = item.Value;
+ }
+
+ return result;
+ }
+
+ public static Dictionary<int, int[]> ParseIntArrayDict(string jsonStr)
+ {
+ if (jsonStr == "{}" || string.IsNullOrEmpty(jsonStr))
+ {
+ return new Dictionary<int, int[]>();
+ }
+ var dict = JsonMapper.ToObject<Dictionary<string, int[]>>(jsonStr);
+ Dictionary<int, int[]> result = new Dictionary<int, int[]>();
+
+ foreach (var item in dict)
+ {
+ result[int.Parse(item.Key)] = item.Value;
}
return result;
--
Gitblit v1.8.0