Skip to content

Commit ef431f2

Browse files
committed
up
1 parent 55e30b1 commit ef431f2

File tree

5 files changed

+45
-45
lines changed

5 files changed

+45
-45
lines changed

Source/kbengine_ue4_demo/GameEntity.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Fill out your copyright notice in the Description page of Project Settings.
1+
// Fill out your copyright notice in the Description page of Project Settings.
22

33
#include "GameEntity.h"
44
#include "kbengine_ue4_demo.h"
@@ -31,12 +31,12 @@ void AGameEntity::BeginPlay()
3131

3232
if (XGameMode)
3333
{
34-
// 把自己注册到AGameModeWorld,方便后面查找
34+
// 把自己注册到AGameModeWorld,方便后面查找
3535
XGameMode->addGameEntity(this->entityID, this);
36-
Entity* pEntity = KBEngineApp::getSingleton().findEntity(entityID);
36+
KBEngine::Entity* pEntity = KBEngine::KBEngineApp::getSingleton().findEntity(entityID);
3737

38-
// 由于UE4可视化实体创建要晚于KBE的插件的逻辑实体,而KBE插件实体先前可能已经触发了一些属性设置事件
39-
// 因此此时我们可能已经错过了一些事件,我们只能在此补救必要的触发了, 例如:名称和血量属性值
38+
// 由于UE4可视化实体创建要晚于KBE的插件的逻辑实体,而KBE插件实体先前可能已经触发了一些属性设置事件
39+
// 因此此时我们可能已经错过了一些事件,我们只能在此补救必要的触发了, 例如:名称和血量属性值
4040
if (pEntity)
4141
pEntity->callPropertysSetMethods();
4242
}
@@ -50,7 +50,7 @@ void AGameEntity::Destroyed()
5050

5151
if (XGameMode)
5252
{
53-
// 把自己注册到AGameModeWorld,方便后面查找
53+
// 把自己注册到AGameModeWorld,方便后面查找
5454
XGameMode->removeGameEntity(this->entityID);
5555
}
5656
}
@@ -62,7 +62,7 @@ void AGameEntity::updateLocation(float DeltaTime)
6262
//Direction from Self to targetPos
6363
FVector vectorDirection = targetLocation - currLocation;
6464

65-
float deltaSpeed = (moveSpeed * 10.f /*由于服务端脚本moveSpeed的单位是厘米,这里需要转换为UE4单位毫米*/) * DeltaTime;
65+
float deltaSpeed = (moveSpeed * 10.f /*由于服务端脚本moveSpeed的单位是厘米,这里需要转换为UE4单位毫米*/) * DeltaTime;
6666
if (vectorDirection.Size() > deltaSpeed)
6767
{
6868
//Normalize Vector so it is just a direction
@@ -123,20 +123,20 @@ void AGameEntity::createAvatar()
123123
TArray<UActorComponent*> components = this->GetComponents().Array();
124124
for (int i=0; i < components.Num(); i++)
125125
{
126-
if (components[i]->GetName() == "Scene") //调整血条位置
126+
if (components[i]->GetName() == "Scene") //调整血条位置
127127
{
128128
UWidgetComponent* pWidget = (UWidgetComponent*)components[i];
129129
pWidget->SetRelativeLocation(FVector(0.f, 0.f, 50.f));
130130
}
131131

132-
if (components[i]->GetName() == "Sphere") //隐藏整球
132+
if (components[i]->GetName() == "Sphere") //隐藏整球
133133
{
134134
USphereComponent* pSphere = (USphereComponent*)components[i];
135135
pSphere->SetActive(false);
136136
pSphere->SetVisibility(false);
137137
}
138138

139-
if (components[i]->GetName() == "Cone") //隐藏圆锥体
139+
if (components[i]->GetName() == "Cone") //隐藏圆锥体
140140
{
141141
UStaticMeshComponent* pCone = (UStaticMeshComponent*)components[i];
142142
pCone->SetActive(false);

Source/kbengine_ue4_demo/GameModeDemoBase.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Fill out your copyright notice in the Description page of Project Settings.
1+
// Fill out your copyright notice in the Description page of Project Settings.
22

33
#include "GameModeDemoBase.h"
44
#include "kbengine_ue4_demo.h"
@@ -32,7 +32,7 @@ void AGameModeDemoBase::Logout(AController* Exiting)
3232
{
3333
Super::Logout(Exiting);
3434

35-
// 可以在这里理解为玩家编辑器Stop游戏或者离开了这个场景
35+
// 可以在这里理解为玩家编辑器Stop游戏或者离开了这个场景
3636
if (Exiting)
3737
{
3838
KBENGINE_DEREGISTER_ALL_EVENT();
@@ -42,9 +42,9 @@ void AGameModeDemoBase::Logout(AController* Exiting)
4242
void AGameModeDemoBase::installEvents()
4343
{
4444
// common
45-
KBENGINE_REGISTER_EVENT(KBEventTypes::onKicked, onKicked);
46-
KBENGINE_REGISTER_EVENT(KBEventTypes::onDisconnected, onDisconnected);
47-
KBENGINE_REGISTER_EVENT(KBEventTypes::onConnectionState, onConnectionState);
45+
KBENGINE_REGISTER_EVENT(KBEngine::KBEventTypes::onKicked, onKicked);
46+
KBENGINE_REGISTER_EVENT(KBEngine::KBEventTypes::onDisconnected, onDisconnected);
47+
KBENGINE_REGISTER_EVENT(KBEngine::KBEventTypes::onConnectionState, onConnectionState);
4848
}
4949

5050
void AGameModeDemoBase::fire(const FString& eventName, UKBEventData* pEventData)

Source/kbengine_ue4_demo/GameModeLogin.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Fill out your copyright notice in the Description page of Project Settings.
1+
// Fill out your copyright notice in the Description page of Project Settings.
22

33
#include "GameModeLogin.h"
44
#include "kbengine_ue4_demo.h"
@@ -15,12 +15,12 @@ void AGameModeLogin::installEvents()
1515
Super::installEvents();
1616

1717
// login
18-
KBENGINE_REGISTER_EVENT(KBEventTypes::onCreateAccountResult, onCreateAccountResult);
19-
KBENGINE_REGISTER_EVENT(KBEventTypes::onLoginFailed, onLoginFailed);
20-
KBENGINE_REGISTER_EVENT(KBEventTypes::onVersionNotMatch, onVersionNotMatch);
21-
KBENGINE_REGISTER_EVENT(KBEventTypes::onScriptVersionNotMatch, onScriptVersionNotMatch);
22-
KBENGINE_REGISTER_EVENT(KBEventTypes::onLoginBaseappFailed, onLoginBaseappFailed);
23-
KBENGINE_REGISTER_EVENT(KBEventTypes::onLoginBaseapp, onLoginBaseapp);
18+
KBENGINE_REGISTER_EVENT(KBEngine::KBEventTypes::onCreateAccountResult, onCreateAccountResult);
19+
KBENGINE_REGISTER_EVENT(KBEngine::KBEventTypes::onLoginFailed, onLoginFailed);
20+
KBENGINE_REGISTER_EVENT(KBEngine::KBEventTypes::onVersionNotMatch, onVersionNotMatch);
21+
KBENGINE_REGISTER_EVENT(KBEngine::KBEventTypes::onScriptVersionNotMatch, onScriptVersionNotMatch);
22+
KBENGINE_REGISTER_EVENT(KBEngine::KBEventTypes::onLoginBaseappFailed, onLoginBaseappFailed);
23+
KBENGINE_REGISTER_EVENT(KBEngine::KBEventTypes::onLoginBaseapp, onLoginBaseapp);
2424
KBENGINE_REGISTER_EVENT("onLoginSuccessfully", onLoginSuccessfully);
2525
KBENGINE_REGISTER_EVENT("Loginapp_importClientMessages", Loginapp_importClientMessages);
2626
KBENGINE_REGISTER_EVENT("Baseapp_importClientMessages", Baseapp_importClientMessages);
@@ -30,8 +30,8 @@ void AGameModeLogin::installEvents()
3030
// Called when the game starts or when spawned
3131
void AGameModeLogin::BeginPlay()
3232
{
33-
// 每次进入到这个界面时对KBE做一次清理,否则KBE插件内缓存的内容将一直存在
34-
KBEngineApp::getSingleton().reset();
33+
// 每次进入到这个界面时对KBE做一次清理,否则KBE插件内缓存的内容将一直存在
34+
KBEngine::KBEngineApp::getSingleton().reset();
3535

3636
Super::BeginPlay();
3737
}
@@ -43,7 +43,7 @@ void AGameModeLogin::Destroyed()
4343

4444
bool AGameModeLogin::validEmail(FString strEmail)
4545
{
46-
return KBEngineApp::getSingleton().validEmail(strEmail);
46+
return KBEngine::KBEngineApp::getSingleton().validEmail(strEmail);
4747
}
4848

4949
void AGameModeLogin::onCreateAccountResult_Implementation(const UKBEventData* pEventData)

Source/kbengine_ue4_demo/GameModeWorld.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Fill out your copyright notice in the Description page of Project Settings.
1+
// Fill out your copyright notice in the Description page of Project Settings.
22

33
#include "GameModeWorld.h"
44
#include "kbengine_ue4_demo.h"
@@ -19,16 +19,16 @@ void AGameModeWorld::installEvents()
1919
Super::installEvents();
2020

2121
// in world
22-
// 这个事件触发时我们需要切换地图到游戏世界地图
23-
KBENGINE_REGISTER_EVENT(KBEventTypes::addSpaceGeometryMapping, addSpaceGeometryMapping);
24-
KBENGINE_REGISTER_EVENT(KBEventTypes::onEnterWorld, onEnterWorld);
25-
KBENGINE_REGISTER_EVENT(KBEventTypes::onLeaveWorld, onLeaveWorld);
26-
KBENGINE_REGISTER_EVENT(KBEventTypes::onEnterSpace, onEnterSpace);
27-
KBENGINE_REGISTER_EVENT(KBEventTypes::onLeaveSpace, onLeaveSpace);
28-
KBENGINE_REGISTER_EVENT(KBEventTypes::set_position, set_position);
29-
KBENGINE_REGISTER_EVENT(KBEventTypes::set_direction, set_direction);
30-
KBENGINE_REGISTER_EVENT(KBEventTypes::updatePosition, updatePosition);
31-
KBENGINE_REGISTER_EVENT(KBEventTypes::onControlled, onControlled);
22+
// 这个事件触发时我们需要切换地图到游戏世界地图
23+
KBENGINE_REGISTER_EVENT(KBEngine::KBEventTypes::addSpaceGeometryMapping, addSpaceGeometryMapping);
24+
KBENGINE_REGISTER_EVENT(KBEngine::KBEventTypes::onEnterWorld, onEnterWorld);
25+
KBENGINE_REGISTER_EVENT(KBEngine::KBEventTypes::onLeaveWorld, onLeaveWorld);
26+
KBENGINE_REGISTER_EVENT(KBEngine::KBEventTypes::onEnterSpace, onEnterSpace);
27+
KBENGINE_REGISTER_EVENT(KBEngine::KBEventTypes::onLeaveSpace, onLeaveSpace);
28+
KBENGINE_REGISTER_EVENT(KBEngine::KBEventTypes::set_position, set_position);
29+
KBENGINE_REGISTER_EVENT(KBEngine::KBEventTypes::set_direction, set_direction);
30+
KBENGINE_REGISTER_EVENT(KBEngine::KBEventTypes::updatePosition, updatePosition);
31+
KBENGINE_REGISTER_EVENT(KBEngine::KBEventTypes::onControlled, onControlled);
3232

3333
// in world(register by scripts)
3434
KBENGINE_REGISTER_EVENT("set_HP", set_HP);
@@ -55,32 +55,32 @@ void AGameModeWorld::BeginPlay()
5555
{
5656
Super::BeginPlay();
5757

58-
check(KBEngineApp::getSingleton().isInitialized());
58+
check(KBEngine::KBEngineApp::getSingleton().isInitialized());
5959

60-
// 如果已经有被创建的实体,说明他们在上一个场景未来得及跳转之前已经通知创建了,但由于我们的world场景并没有来得及创建,这部分实体进入世界事件已经漏掉
61-
// 此时我们需要再次触发一次onEnterWorld,让表现层能够在游戏场景中创建出所有的实体
62-
KBEngineApp::ENTITIES_MAP& entities = KBEngineApp::getSingleton().entities();
60+
// 如果已经有被创建的实体,说明他们在上一个场景未来得及跳转之前已经通知创建了,但由于我们的world场景并没有来得及创建,这部分实体进入世界事件已经漏掉
61+
// 此时我们需要再次触发一次onEnterWorld,让表现层能够在游戏场景中创建出所有的实体
62+
KBEngine::KBEngineApp::ENTITIES_MAP& entities = KBEngine::KBEngineApp::getSingleton().entities();
6363
for (auto& item : entities)
6464
{
65-
Entity* pEntity = item.Value;
65+
KBEngine::Entity* pEntity = item.Value;
6666

6767
UKBEventData_onEnterWorld* pEventData = NewObject<UKBEventData_onEnterWorld>();
6868
pEventData->entityID = pEntity->id();
69-
pEventData->spaceID = KBEngineApp::getSingleton().spaceID();
69+
pEventData->spaceID = KBEngine::KBEngineApp::getSingleton().spaceID();
7070
KBPos2UE4Pos(pEventData->position, pEntity->position);
7171
pEventData->direction = pEntity->direction;
7272
pEventData->moveSpeed = pEntity->velocity();
7373
pEventData->isOnGround = pEntity->isOnGround();
7474
pEventData->isPlayer = pEntity->isPlayer();
7575
pEventData->entityClassName = pEntity->className();
7676
pEventData->res = TEXT("");
77-
KBENGINE_EVENT_FIRE(KBEventTypes::onEnterWorld, pEventData);
77+
KBENGINE_EVENT_FIRE(KBEngine::KBEventTypes::onEnterWorld, pEventData);
7878
}
7979
}
8080

8181
void AGameModeWorld::reqRelive(int reliveType)
8282
{
83-
// 由于玩家的Avatar实体注册了该事件, 如果此时Avatar实体存在那么必然会执行到该事件
83+
// 由于玩家的Avatar实体注册了该事件, 如果此时Avatar实体存在那么必然会执行到该事件
8484
UKBEventData_reqRelive* pEventData = NewObject<UKBEventData_reqRelive>();
8585
pEventData->reliveType = reliveType;
8686
KBENGINE_EVENT_FIRE("relive", pEventData);

Source/kbengine_ue4_demo/PlayerCharacter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
1+
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
22

33
#include "PlayerCharacter.h"
44
#include "kbengine_ue4_demo.h"

0 commit comments

Comments
 (0)