From b1889d4d08cac43888795a71aad7842d55ffccff Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期二, 31 十二月 2024 17:01:21 +0800
Subject: [PATCH] 0312 导表生存代码新增字典格式
---
Assets/Editor/Tool/ConfigClassGenerate.cs | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/Assets/Editor/Tool/ConfigClassGenerate.cs b/Assets/Editor/Tool/ConfigClassGenerate.cs
index 049bdf0..6a1f4fd 100644
--- a/Assets/Editor/Tool/ConfigClassGenerate.cs
+++ b/Assets/Editor/Tool/ConfigClassGenerate.cs
@@ -89,6 +89,14 @@
{
return StringUtility.Contact("public readonly int[][] ", field.Trim(), ";");
}
+ else if (type.Contains("Dictionary<int, int>"))
+ {
+ return StringUtility.Contact("public readonly Dictionary<int, int> ", field.Trim(), ";");
+ }
+ else if (type.Contains("Dictionary<int, int[]>"))
+ {
+ return StringUtility.Contact("public readonly Dictionary<int, int[]> ", field.Trim(), ";");
+ }
else if (type.Contains("float[][]"))
{
return StringUtility.Contact("public readonly float[][] ", field.Trim(), ";");
@@ -157,11 +165,20 @@
public static string GetRead(string type, string field, int index)
{
+
field = field.Replace(" ", "");
if (type.Contains("int[][]"))
{
return StringUtility.Contact(field, " = JsonMapper.ToObject<int[][]>(tables", "[", index, "].Replace(\"(\", \"[\").Replace(\")\", \"]\")); ");
}
+ else if (type.Contains("Dictionary<int, int>"))
+ {
+ return StringUtility.Contact(field, " = ConfigParse.ParseIntDict(tables", "[", index, "]); ");
+ }
+ else if (type.Contains("Dictionary<int, int[]>"))
+ {
+ return StringUtility.Contact(field, " = ConfigParse.ParseIntArrayDict(tables", "[", index, "]); ");
+ }
else if (type.Contains("float[][]"))
{
return StringUtility.Contact(field, " = JsonMapper.ToObject<float[][]>(tables", "[", index, "].Replace(\"(\", \"[\").Replace(\")\", \"]\")); ");
--
Gitblit v1.8.0