zhaoyang 2 years ago
parent
commit
ef599f705a

+ 1 - 0
GameClient/Assets/Editor/Excel/Template/ConfigArray.txt

@@ -1,4 +1,5 @@
 using System.Collections.Generic;
+using System.Reflection;
 
 namespace GFGGame
 {

+ 13 - 3
GameClient/Assets/Editor/Excel/Template/FunctionAllGroupBlock.txt

@@ -1,7 +1,17 @@
-            {cfgsGroupDicName}.TryGetValue({groupKey}, out var {list});
+            
+            List<string> {cfgsGroupDicName}List = new List<string>();
+            string[] {cfgsGroupDicName}KeyGroup = {groupKey}.Split('_');
+            for (int i = 0; i < {cfgsGroupDicName}KeyGroup.Length; i++)
+            {
+                FieldInfo info = cfg.GetType().GetField({cfgsGroupDicName}KeyGroup[i]);
+                {cfgsGroupDicName}List.Add(info.GetValue(cfg).ToString());
+            }
+
+            string {cfgsGroupDicName}Key = string.Join("_", {cfgsGroupDicName}List);
+            {cfgsGroupDicName}.TryGetValue({cfgsGroupDicName}Key, out var {list});
             if({list} == null)
             {
                 {list} = new List<{CfgName}>();
-                {cfgsGroupDicName}.Add({groupKey}, {list});
+                {cfgsGroupDicName}.Add({cfgsGroupDicName}Key, {list});
             }
-            {list}.Add(cfg);
+            {list}.Add(cfg);

+ 2 - 1
GameClient/Assets/Editor/Excel/Template/FunctionAllSingleBlock.txt

@@ -1 +1,2 @@
-            {cfgsDicName}[{combinedKey}] = cfg;
+            FieldInfo {cfgsDicName}info = cfg.GetType().GetField({combinedKey});
+            {cfgsDicName}[{cfgsDicName}info.GetValue(cfg).ToString()] = cfg;

BIN
GameClient/Assets/ResIn/Config/excelConfig.sqlite.bytes