Skip to content

Commit cd6c907

Browse files
committed
up
1 parent 7cc4116 commit cd6c907

File tree

12 files changed

+80
-25
lines changed

12 files changed

+80
-25
lines changed

Plugins/kbengine_ue4_plugins/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ Usage
3535
Account.cpp: pBaseEntityCall->reqAvatarList();
3636
Avatar.cpp: pCellEntityCall->relive(reliveType);
3737

38+
Reference: https://github.com/kbengine/kbengine/issues/532
39+
3840
4: Monitor KBE-plugins event
3941
For example:
4042
class KBENGINE_UE4_DEMO_API AGameModeLogin : public AGameMode

Plugins/kbengine_ue4_plugins/Source/KBEnginePlugins/Engine/AvatarBase.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -944,23 +944,20 @@ AvatarBase::AvatarBase():
944944
{
945945
component1->pOwner = this;
946946
component1->ownerID = id_;
947+
component1->entityComponentPropertyID = 16;
947948

948949
component2->pOwner = this;
949950
component2->ownerID = id_;
951+
component2->entityComponentPropertyID = 21;
950952

951953
component3->pOwner = this;
952954
component3->ownerID = id_;
955+
component3->entityComponentPropertyID = 22;
953956

954957
}
955958

956959
AvatarBase::~AvatarBase()
957960
{
958-
if(pBaseEntityCall)
959-
delete pBaseEntityCall;
960-
961-
if(pCellEntityCall)
962-
delete pCellEntityCall;
963-
964961
if(component1)
965962
delete component1;
966963

@@ -970,5 +967,11 @@ AvatarBase::~AvatarBase()
970967
if(component3)
971968
delete component3;
972969

970+
if(pBaseEntityCall)
971+
delete pBaseEntityCall;
972+
973+
if(pCellEntityCall)
974+
delete pCellEntityCall;
975+
973976
}
974977

Plugins/kbengine_ue4_plugins/Source/KBEnginePlugins/Engine/EntityComponent.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "MemoryStream.h"
66

77
EntityComponent::EntityComponent():
8+
entityComponentPropertyID(0),
89
componentType(0),
910
ownerID(0),
1011
pOwner(NULL)

Plugins/kbengine_ue4_plugins/Source/KBEnginePlugins/Engine/EntityComponent.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ class KBENGINEPLUGINS_API EntityComponent
1414
virtual ~EntityComponent();
1515

1616
public:
17+
//virtual void onAttached(Entity* pOwner)
18+
//{
19+
//}
20+
21+
//virtual void onDetached(Entity* pOwner)
22+
//{
23+
//}
24+
1725
virtual void onRemoteMethodCall(uint16 methodUtype, MemoryStream& stream)
1826
{
1927
// 动态生成
@@ -32,6 +40,7 @@ class KBENGINEPLUGINS_API EntityComponent
3240
virtual void createFromStream(MemoryStream& stream);
3341

3442
public:
43+
uint16 entityComponentPropertyID;
3544
uint16 componentType;
3645
ENTITY_ID ownerID;
3746
Entity* pOwner;

Plugins/kbengine_ue4_plugins/Source/KBEnginePlugins/Engine/EntityDef.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ void EntityDef::initScriptModules()
411411
Property* pAvatar_component1 = new Property();
412412
pAvatar_component1->name = TEXT("component1");
413413
pAvatar_component1->properUtype = 16;
414-
pAvatar_component1->properFlags = 255;
414+
pAvatar_component1->properFlags = 253;
415415
pAvatar_component1->aliasID = 8;
416416
pAvatarModule->propertys.Add(TEXT("component1"), pAvatar_component1);
417417

@@ -423,7 +423,7 @@ void EntityDef::initScriptModules()
423423
Property* pAvatar_component2 = new Property();
424424
pAvatar_component2->name = TEXT("component2");
425425
pAvatar_component2->properUtype = 21;
426-
pAvatar_component2->properFlags = 255;
426+
pAvatar_component2->properFlags = 97;
427427
pAvatar_component2->aliasID = 9;
428428
pAvatarModule->propertys.Add(TEXT("component2"), pAvatar_component2);
429429

@@ -435,7 +435,7 @@ void EntityDef::initScriptModules()
435435
Property* pAvatar_component3 = new Property();
436436
pAvatar_component3->name = TEXT("component3");
437437
pAvatar_component3->properUtype = 22;
438-
pAvatar_component3->properFlags = 159;
438+
pAvatar_component3->properFlags = 157;
439439
pAvatar_component3->aliasID = 10;
440440
pAvatarModule->propertys.Add(TEXT("component3"), pAvatar_component3);
441441

Plugins/kbengine_ue4_plugins/Source/KBEnginePlugins/Engine/KBEngine.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ KBEngineApp::KBEngineApp() :
3434
clientVersion_(TEXT("")),
3535
serverScriptVersion_(TEXT("")),
3636
clientScriptVersion_(TEXT("")),
37-
serverProtocolMD5_(TEXT("A27C011AA0FCAC031A349A8A3D288C7D")),
38-
serverEntitydefMD5_(TEXT("6325C7D6CBB53B6431AFD48B3A5F1E7D")),
37+
serverProtocolMD5_(TEXT("4930E6C01028CE4D5B3CE228CA841378")),
38+
serverEntitydefMD5_(TEXT("A0C96A57AD7D75964F55B1BF3ED664D3")),
3939
entity_uuid_(0),
4040
entity_id_(0),
4141
entity_type_(TEXT("")),
@@ -73,8 +73,8 @@ KBEngineApp::KBEngineApp(KBEngineArgs* pArgs):
7373
clientVersion_(TEXT("")),
7474
serverScriptVersion_(TEXT("")),
7575
clientScriptVersion_(TEXT("")),
76-
serverProtocolMD5_(TEXT("A27C011AA0FCAC031A349A8A3D288C7D")),
77-
serverEntitydefMD5_(TEXT("6325C7D6CBB53B6431AFD48B3A5F1E7D")),
76+
serverProtocolMD5_(TEXT("4930E6C01028CE4D5B3CE228CA841378")),
77+
serverEntitydefMD5_(TEXT("A0C96A57AD7D75964F55B1BF3ED664D3")),
7878
entity_uuid_(0),
7979
entity_id_(0),
8080
entity_type_(TEXT("")),

Plugins/kbengine_ue4_plugins/Source/KBEnginePlugins/Engine/Messages.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,30 +1369,30 @@ class KBENGINEPLUGINS_API Messages
13691369
Messages::messages.Add(TEXT("Loginapp_reqAccountResetPassword"), new Message_Loginapp_reqAccountResetPassword(11, "Loginapp_reqAccountResetPassword", -1, 0, Loginapp_reqAccountResetPassword_argstypes));
13701370
Messages::loginappMessages.Add(11, Messages::messages["Loginapp_reqAccountResetPassword"]);
13711371

1372-
Messages::messages.Add(TEXT("Baseapp_onUpdateDataFromClient"), new Message_Baseapp_onUpdateDataFromClient(27, "Baseapp_onUpdateDataFromClient", -1, -1, TArray<uint8>()));
1373-
Messages::baseappMessages.Add(27, Messages::messages["Baseapp_onUpdateDataFromClient"]);
1372+
Messages::messages.Add(TEXT("Baseapp_onUpdateDataFromClient"), new Message_Baseapp_onUpdateDataFromClient(25, "Baseapp_onUpdateDataFromClient", -1, -1, TArray<uint8>()));
1373+
Messages::baseappMessages.Add(25, Messages::messages["Baseapp_onUpdateDataFromClient"]);
13741374

1375-
Messages::messages.Add(TEXT("Baseapp_onUpdateDataFromClientForControlledEntity"), new Message_Baseapp_onUpdateDataFromClientForControlledEntity(28, "Baseapp_onUpdateDataFromClientForControlledEntity", -1, -1, TArray<uint8>()));
1376-
Messages::baseappMessages.Add(28, Messages::messages["Baseapp_onUpdateDataFromClientForControlledEntity"]);
1375+
Messages::messages.Add(TEXT("Baseapp_onUpdateDataFromClientForControlledEntity"), new Message_Baseapp_onUpdateDataFromClientForControlledEntity(26, "Baseapp_onUpdateDataFromClientForControlledEntity", -1, -1, TArray<uint8>()));
1376+
Messages::baseappMessages.Add(26, Messages::messages["Baseapp_onUpdateDataFromClientForControlledEntity"]);
13771377

13781378

13791379
TArray<uint8> Baseapp_reqAccountBindEmail_argstypes;
13801380
Baseapp_reqAccountBindEmail_argstypes.Add(8);
13811381
Baseapp_reqAccountBindEmail_argstypes.Add(1);
13821382
Baseapp_reqAccountBindEmail_argstypes.Add(1);
1383-
Messages::messages.Add(TEXT("Baseapp_reqAccountBindEmail"), new Message_Baseapp_reqAccountBindEmail(50, "Baseapp_reqAccountBindEmail", -1, 0, Baseapp_reqAccountBindEmail_argstypes));
1384-
Messages::baseappMessages.Add(50, Messages::messages["Baseapp_reqAccountBindEmail"]);
1383+
Messages::messages.Add(TEXT("Baseapp_reqAccountBindEmail"), new Message_Baseapp_reqAccountBindEmail(48, "Baseapp_reqAccountBindEmail", -1, 0, Baseapp_reqAccountBindEmail_argstypes));
1384+
Messages::baseappMessages.Add(48, Messages::messages["Baseapp_reqAccountBindEmail"]);
13851385

13861386

13871387
TArray<uint8> Baseapp_reqAccountNewPassword_argstypes;
13881388
Baseapp_reqAccountNewPassword_argstypes.Add(8);
13891389
Baseapp_reqAccountNewPassword_argstypes.Add(1);
13901390
Baseapp_reqAccountNewPassword_argstypes.Add(1);
1391-
Messages::messages.Add(TEXT("Baseapp_reqAccountNewPassword"), new Message_Baseapp_reqAccountNewPassword(53, "Baseapp_reqAccountNewPassword", -1, 0, Baseapp_reqAccountNewPassword_argstypes));
1392-
Messages::baseappMessages.Add(53, Messages::messages["Baseapp_reqAccountNewPassword"]);
1391+
Messages::messages.Add(TEXT("Baseapp_reqAccountNewPassword"), new Message_Baseapp_reqAccountNewPassword(51, "Baseapp_reqAccountNewPassword", -1, 0, Baseapp_reqAccountNewPassword_argstypes));
1392+
Messages::baseappMessages.Add(51, Messages::messages["Baseapp_reqAccountNewPassword"]);
13931393

1394-
Messages::messages.Add(TEXT("Entity_forwardEntityMessageToCellappFromClient"), new Message_Entity_forwardEntityMessageToCellappFromClient(57, "Entity_forwardEntityMessageToCellappFromClient", -1, -1, TArray<uint8>()));
1395-
Messages::baseappMessages.Add(57, Messages::messages["Entity_forwardEntityMessageToCellappFromClient"]);
1394+
Messages::messages.Add(TEXT("Entity_forwardEntityMessageToCellappFromClient"), new Message_Entity_forwardEntityMessageToCellappFromClient(55, "Entity_forwardEntityMessageToCellappFromClient", -1, -1, TArray<uint8>()));
1395+
Messages::baseappMessages.Add(55, Messages::messages["Entity_forwardEntityMessageToCellappFromClient"]);
13961396

13971397
Messages::messages.Add(TEXT("Baseapp_hello"), new Message_Baseapp_hello(200, "Baseapp_hello", -1, -1, TArray<uint8>()));
13981398
Messages::baseappMessages.Add(200, Messages::messages["Baseapp_hello"]);

Plugins/kbengine_ue4_plugins/Source/KBEnginePlugins/Engine/TestBase.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010
#include "MemoryStream.h"
1111

1212

13+
void TestBase::createFromStream(MemoryStream& stream)
14+
{
15+
EntityComponent::createFromStream(stream);
16+
pBaseEntityCall = new EntityBaseEntityCall_TestBase(entityComponentPropertyID, ownerID);
17+
pCellEntityCall = new EntityCellEntityCall_TestBase(entityComponentPropertyID, ownerID);
18+
}
19+
1320
void TestBase::onRemoteMethodCall(uint16 methodUtype, MemoryStream& stream)
1421
{
1522
ScriptModule* sm = *EntityDef::moduledefs.Find("Test");
@@ -148,12 +155,20 @@ void TestBase::callPropertysSetMethods()
148155

149156
TestBase::TestBase():
150157
EntityComponent(),
158+
pBaseEntityCall(NULL),
159+
pCellEntityCall(NULL),
151160
own((int32)FCString::Atoi64(TEXT("1001"))),
152161
state((int32)FCString::Atoi64(TEXT("100")))
153162
{
154163
}
155164

156165
TestBase::~TestBase()
157166
{
167+
if(pBaseEntityCall)
168+
delete pBaseEntityCall;
169+
170+
if(pCellEntityCall)
171+
delete pCellEntityCall;
172+
158173
}
159174

Plugins/kbengine_ue4_plugins/Source/KBEnginePlugins/Engine/TestBase.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,18 @@ class MemoryStream;
2020
class KBENGINEPLUGINS_API TestBase : public EntityComponent
2121
{
2222
public:
23+
EntityBaseEntityCall_TestBase* pBaseEntityCall;
24+
EntityCellEntityCall_TestBase* pCellEntityCall;
25+
2326
int32 own;
2427
virtual void onOwnChanged(int32 oldValue) {}
2528
int32 state;
2629
virtual void onStateChanged(int32 oldValue) {}
2730

2831
virtual void helloCB(int32 arg1) = 0;
2932

33+
void createFromStream(MemoryStream& stream) override;
34+
3035
void onRemoteMethodCall(uint16 methodUtype, MemoryStream& stream) override;
3136
void onUpdatePropertys(uint16 propUtype, MemoryStream& stream, int maxCount) override;
3237
void callPropertysSetMethods() override;

Plugins/kbengine_ue4_plugins/Source/KBEnginePlugins/Engine/TestNoBaseBase.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010
#include "MemoryStream.h"
1111

1212

13+
void TestNoBaseBase::createFromStream(MemoryStream& stream)
14+
{
15+
EntityComponent::createFromStream(stream);
16+
pBaseEntityCall = new EntityBaseEntityCall_TestNoBaseBase(entityComponentPropertyID, ownerID);
17+
pCellEntityCall = new EntityCellEntityCall_TestNoBaseBase(entityComponentPropertyID, ownerID);
18+
}
19+
1320
void TestNoBaseBase::onRemoteMethodCall(uint16 methodUtype, MemoryStream& stream)
1421
{
1522
ScriptModule* sm = *EntityDef::moduledefs.Find("TestNoBase");
@@ -148,12 +155,20 @@ void TestNoBaseBase::callPropertysSetMethods()
148155

149156
TestNoBaseBase::TestNoBaseBase():
150157
EntityComponent(),
158+
pBaseEntityCall(NULL),
159+
pCellEntityCall(NULL),
151160
own((int32)FCString::Atoi64(TEXT("1001"))),
152161
state((int32)FCString::Atoi64(TEXT("100")))
153162
{
154163
}
155164

156165
TestNoBaseBase::~TestNoBaseBase()
157166
{
167+
if(pBaseEntityCall)
168+
delete pBaseEntityCall;
169+
170+
if(pCellEntityCall)
171+
delete pCellEntityCall;
172+
158173
}
159174

0 commit comments

Comments
 (0)