@@ -2060,7 +2060,7 @@ bool ClientSDKUE4::writeEntityModuleBegin(ScriptDefModule* pEntityScriptDefModul
2060
2060
if (!pEntityScriptDefModule->isComponentModule ())
2061
2061
initBody_ = " \t Entity(),\n\t pBaseEntityCall(NULL),\n\t pCellEntityCall(NULL),\n " ;
2062
2062
else
2063
- initBody_ = " \t EntityComponent(),\n " ;
2063
+ initBody_ = " \t EntityComponent(),\n\t pBaseEntityCall(NULL), \n\t pCellEntityCall(NULL), \n " ;
2064
2064
2065
2065
fileBody () = headerBody;
2066
2066
strutil::kbe_replace (fileBody (), " #REPLACE#" , fmt::format (" \t Please inherit this module, such as: (class {} : public {}{})\n " ,
@@ -2117,6 +2117,10 @@ bool ClientSDKUE4::writeEntityModuleBegin(ScriptDefModule* pEntityScriptDefModul
2117
2117
{
2118
2118
fileBody () += fmt::format (" class KBENGINEPLUGINS_API {} : public EntityComponent\n {{\n public:\n " , newModuleName);
2119
2119
2120
+ // 写entityCall属性
2121
+ fileBody () += fmt::format (" \t EntityBaseEntityCall_{}* pBaseEntityCall;\n " , newModuleName);
2122
+ fileBody () += fmt::format (" \t EntityCellEntityCall_{}* pCellEntityCall;\n\n " , newModuleName);
2123
+
2120
2124
changeContextToSource ();
2121
2125
fileBody () += fmt::format (" #include \" {}.h\"\n " , newModuleName);
2122
2126
fileBody () += fmt::format (" #include \" KBVar.h\"\n " );
@@ -2207,22 +2211,18 @@ bool ClientSDKUE4::writeEntityModuleEnd(ScriptDefModule* pEntityScriptDefModule)
2207
2211
2208
2212
// EntityComponentType * pEntityComponentType = (EntityComponentType*)pPropertyDescription->getDataType();
2209
2213
fileBody () += fmt::format (" \t {}->pOwner = this;\n " , pPropertyDescription->getName ());
2210
- fileBody () += fmt::format (" \t {}->ownerID = id_;\n\n " , pPropertyDescription->getName ());
2214
+ fileBody () += fmt::format (" \t {}->ownerID = id_;\n " , pPropertyDescription->getName ());
2215
+ fileBody () += fmt::format (" \t {}->entityComponentPropertyID = {};\n\n " , pPropertyDescription->getName (), pPropertyDescription->getUType ());
2211
2216
}
2212
2217
}
2213
2218
2214
2219
fileBody () += fmt::format (" }}\n " );
2215
2220
2216
2221
fileBody () += fmt::format (" \n {}::~{}()\n {{\n " , newModuleName, newModuleName);
2217
2222
2223
+
2218
2224
if (!pEntityScriptDefModule->isComponentModule ())
2219
2225
{
2220
- fileBody () += fmt::format (" \t if(pBaseEntityCall)\n " );
2221
- fileBody () += fmt::format (" \t\t delete pBaseEntityCall;\n\n " );
2222
-
2223
- fileBody () += fmt::format (" \t if(pCellEntityCall)\n " );
2224
- fileBody () += fmt::format (" \t\t delete pCellEntityCall;\n\n " );
2225
-
2226
2226
ScriptDefModule::PROPERTYDESCRIPTION_MAP clientPropertys = pEntityScriptDefModule->getClientPropertyDescriptions ();
2227
2227
ScriptDefModule::PROPERTYDESCRIPTION_MAP::const_iterator propIter = clientPropertys.begin ();
2228
2228
for (; propIter != clientPropertys.end (); ++propIter)
@@ -2238,6 +2238,12 @@ bool ClientSDKUE4::writeEntityModuleEnd(ScriptDefModule* pEntityScriptDefModule)
2238
2238
}
2239
2239
}
2240
2240
2241
+ fileBody () += fmt::format (" \t if(pBaseEntityCall)\n " );
2242
+ fileBody () += fmt::format (" \t\t delete pBaseEntityCall;\n\n " );
2243
+
2244
+ fileBody () += fmt::format (" \t if(pCellEntityCall)\n " );
2245
+ fileBody () += fmt::format (" \t\t delete pCellEntityCall;\n\n " );
2246
+
2241
2247
fileBody () += " }\n\n " ;
2242
2248
2243
2249
changeContextToHeader ();
@@ -2257,6 +2263,19 @@ bool ClientSDKUE4::writeEntityProcessMessagesMethod(ScriptDefModule* pEntityScri
2257
2263
// EntityCall
2258
2264
std::string newModuleName = fmt::format (" {}{}" , pEntityScriptDefModule->getName (), moduleSuffix);
2259
2265
2266
+ if (pEntityScriptDefModule->isComponentModule ())
2267
+ {
2268
+ changeContextToHeader ();
2269
+ fileBody () += fmt::format (" \n\t void createFromStream(MemoryStream& stream) override;\n " );
2270
+
2271
+ changeContextToSource ();
2272
+ fileBody () += fmt::format (" \n void {}::createFromStream(MemoryStream& stream)\n {{\n " , newModuleName);
2273
+ fileBody () += fmt::format (" \t EntityComponent::createFromStream(stream);\n " );
2274
+ fileBody () += fmt::format (" \t pBaseEntityCall = new EntityBaseEntityCall_{}(entityComponentPropertyID, ownerID);\n " , newModuleName);
2275
+ fileBody () += fmt::format (" \t pCellEntityCall = new EntityCellEntityCall_{}(entityComponentPropertyID, ownerID);\n " , newModuleName);
2276
+ fileBody () += fmt::format (" }}\n " );
2277
+ }
2278
+
2260
2279
if (!pEntityScriptDefModule->isComponentModule ())
2261
2280
{
2262
2281
changeContextToHeader ();
0 commit comments