Skip to content

Commit eaa443e

Browse files
committed
up
1 parent 6264bec commit eaa443e

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

kbe/src/server/tools/kbcmd/client_sdk_ue4.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1297,6 +1297,7 @@ bool ClientSDKUE4::writeCustomDataType(const DataType* pDataType)
12971297
if (strcmp(pDataType->getName(), "FIXED_DICT") == 0)
12981298
{
12991299
fileBody() += fmt::format("\nclass KBENGINEPLUGINS_API DATATYPE_{} : DATATYPE_BASE\n{{\npublic:\n", typeName);
1300+
std::map<std::string, std::string> allClassName;
13001301

13011302
FixedDictType* dictdatatype = const_cast<FixedDictType*>(static_cast<const FixedDictType*>(pDataType));
13021303

@@ -1318,7 +1319,13 @@ bool ClientSDKUE4::writeCustomDataType(const DataType* pDataType)
13181319

13191320
std::string className = pKeyDataType->aliasName();
13201321

1321-
createArrayChildClass(pFixedArrayType, pFixedArrayType->getDataType(), className + "_ChildArray", "\t");
1322+
std::map<std::string, std::string>::iterator findChildClassNameIter = allClassName.find(className + "_ChildArray");
1323+
1324+
if (findChildClassNameIter == allClassName.end())
1325+
{
1326+
allClassName[className + "_ChildArray"] = typeName;
1327+
createArrayChildClass(pFixedArrayType, pFixedArrayType->getDataType(), className + "_ChildArray", "\t");
1328+
}
13221329

13231330
fileBody() += fmt::format("\tDATATYPE_{} {}_DataType;\n\n",
13241331
className + "_ChildArray", keyiter->first, className + "_ChildArray");

kbe/src/server/tools/kbcmd/client_sdk_unity.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,6 +980,7 @@ bool ClientSDKUnity::writeCustomDataType(const DataType* pDataType)
980980
if (strcmp(pDataType->getName(), "FIXED_DICT") == 0)
981981
{
982982
sourcefileBody_ += fmt::format("\n\n\tpublic class DATATYPE_{} : DATATYPE_BASE\n\t{{\n", typeName);
983+
std::map<std::string, std::string> allClassName;
983984

984985
FixedDictType* dictdatatype = const_cast<FixedDictType*>(static_cast<const FixedDictType*>(pDataType));
985986

@@ -1004,7 +1005,13 @@ bool ClientSDKUnity::writeCustomDataType(const DataType* pDataType)
10041005
sourcefileBody_ += fmt::format("\t\tprivate DATATYPE_{} {}_DataType = new DATATYPE_{}();\n\n",
10051006
className + "_ChildArray", keyiter->first, className + "_ChildArray");
10061007

1007-
createArrayChildClass(pFixedArrayType, pFixedArrayType->getDataType(), className + "_ChildArray", "\t\t");
1008+
std::map<std::string, std::string>::iterator findChildClassNameIter = allClassName.find(className + "_ChildArray");
1009+
1010+
if (findChildClassNameIter == allClassName.end())
1011+
{
1012+
allClassName[className + "_ChildArray"] = typeName;
1013+
createArrayChildClass(pFixedArrayType, pFixedArrayType->getDataType(), className + "_ChildArray", "\t\t");
1014+
}
10081015
}
10091016
else
10101017
{

0 commit comments

Comments
 (0)