Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 22aee515ed | |||
| 8f84dcf3d3 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -8,9 +8,9 @@
|
||||
|
||||
UGasaAttributeSet::UGasaAttributeSet()
|
||||
{
|
||||
InitHealth( 100.f );
|
||||
InitHealth( 50.f );
|
||||
InitMaxHealth( 100.f );
|
||||
InitMana( 50.f );
|
||||
InitMana( 25.f );
|
||||
InitMaxMana( 50.f );
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,10 @@ class GASA_API AGasaEffectActor : public AGasaActor
|
||||
public:
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Gameplay Effects")
|
||||
TSoftClassPtr<UGameplayEffect> InstantEffectClass;
|
||||
TSubclassOf<UGameplayEffect> InstantEffectClass;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Gameplay Effects")
|
||||
TSubclassOf<UGameplayEffect> DurationEffectClass;
|
||||
|
||||
AGasaEffectActor();
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ AGasaGameState::AGasaGameState()
|
||||
void AGasaGameState::OnGameFrameworkInitialized()
|
||||
{
|
||||
NetLog("Received gameplay framework initialization.");
|
||||
|
||||
if (IsServer())
|
||||
{
|
||||
if (PlayerArray.Num() > 0)
|
||||
@@ -41,7 +40,6 @@ void AGasaGameState::OnGameFrameworkInitialized()
|
||||
NetLog("Was not able to assign HostingPlayer!", ELogV::Error);
|
||||
}
|
||||
}
|
||||
|
||||
BP_OnGameFrameworkInitialized();
|
||||
}
|
||||
#pragma endregion GameFramework
|
||||
@@ -71,7 +69,6 @@ void AGasaGameState::HandleBeginPlay()
|
||||
void AGasaGameState::SeamlessTravelTransitionCheckpoint(bool bToTransitionMap)
|
||||
{
|
||||
Super::SeamlessTravelTransitionCheckpoint(bToTransitionMap);
|
||||
|
||||
NetLog("SeamlessTravelTransitionCheckpoint");
|
||||
NetLog(FString("ToTransitionMap: ") + FString(bToTransitionMap ? "true" : "false"));
|
||||
|
||||
@@ -90,7 +87,6 @@ void AGasaGameState::SeamlessTravelTransitionCheckpoint(bool bToTransitionMap)
|
||||
void AGasaGameState::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
NetLog("BeginPlay");
|
||||
|
||||
// Notified as initialized here as any possible components should also be initialized by this point.
|
||||
@@ -111,7 +107,6 @@ void AGasaGameState::BeginPlay()
|
||||
void AGasaGameState::PostInitializeComponents()
|
||||
{
|
||||
NetLog("PostInitializeComponents");
|
||||
|
||||
Super::PostInitializeComponents();
|
||||
|
||||
if ( ! GetWorld()->IsEditorWorld() && IsServer())
|
||||
@@ -135,6 +130,7 @@ void AGasaGameState::Tick(float DeltaSeconds)
|
||||
Super::Tick(DeltaSeconds);
|
||||
|
||||
#if ENABLE_COG
|
||||
if (CogWindowManager)
|
||||
CogWindowManager->Tick(DeltaSeconds);
|
||||
#endif //ENABLE_COG
|
||||
}
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
#include "GasaGameState.h"
|
||||
|
||||
#include "CogAll.h"
|
||||
#include "CogWindowManager.h"
|
||||
#include "GasaPlayerState.h"
|
||||
#include "GasaGameInstance.h"
|
||||
#include "Net/UnrealNetwork.h"
|
||||
#include "Networking/GasaNetLibrary_Inlines.h"
|
||||
using namespace Gasa;
|
||||
|
||||
AGasaGameState::AGasaGameState()
|
||||
{
|
||||
// Enable ticking
|
||||
PrimaryActorTick.bCanEverTick = true;
|
||||
PrimaryActorTick.SetTickFunctionEnable(true);
|
||||
PrimaryActorTick.bStartWithTickEnabled = true;
|
||||
|
||||
// Replication
|
||||
bReplicates = true;
|
||||
bNetLoadOnClient = false;
|
||||
NetDormancy = DORM_Awake;
|
||||
NetCullDistanceSquared = NetCullDist_Default;
|
||||
NetUpdateFrequency = 10.0f;
|
||||
MinNetUpdateFrequency = 1.0f;
|
||||
NetPriority = 5.0f;
|
||||
}
|
||||
|
||||
#pragma region GameFramework
|
||||
void AGasaGameState::OnGameFrameworkInitialized()
|
||||
{
|
||||
NetLog("Received gameplay framework initialization.");
|
||||
if (IsServer())
|
||||
{
|
||||
if (PlayerArray.Num() > 0)
|
||||
{
|
||||
ListenServerHost = Cast<AGasaPlayerState>(PlayerArray[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
NetLog("Was not able to assign HostingPlayer!", ELogV::Error);
|
||||
}
|
||||
}
|
||||
BP_OnGameFrameworkInitialized();
|
||||
}
|
||||
#pragma endregion GameFramework
|
||||
|
||||
#pragma region Networking
|
||||
void AGasaGameState::Client_OnRep_OnlinePlayers()
|
||||
{
|
||||
}
|
||||
#pragma endregion Networking
|
||||
|
||||
#pragma region Seamless Travel
|
||||
void AGasaGameState::Multicast_R_NotifySeamlessTravelEnd_Implementation()
|
||||
{
|
||||
NetLog("Multicast_R_NotifySeamlessTravelEnd_Implementation");
|
||||
BP_Event_OnSeamlessTravelEnd.Broadcast();
|
||||
Event_OnSeamlessTravelEnd.Broadcast();
|
||||
}
|
||||
#pragma endregion Seamless Travel
|
||||
|
||||
#pragma region GameStateBase
|
||||
void AGasaGameState::HandleBeginPlay()
|
||||
{
|
||||
Super::HandleBeginPlay();
|
||||
NetLog("HandleBeginPlay: Directly called from GM");
|
||||
}
|
||||
|
||||
void AGasaGameState::SeamlessTravelTransitionCheckpoint(bool bToTransitionMap)
|
||||
{
|
||||
Super::SeamlessTravelTransitionCheckpoint(bToTransitionMap);
|
||||
NetLog("SeamlessTravelTransitionCheckpoint");
|
||||
NetLog(FString("ToTransitionMap: ") + FString(bToTransitionMap ? "true" : "false"));
|
||||
|
||||
if (bToTransitionMap)
|
||||
{
|
||||
Event_OnSeamlessTravelStart.Broadcast();
|
||||
}
|
||||
else
|
||||
{
|
||||
Multicast_R_NotifySeamlessTravelEnd();
|
||||
}
|
||||
}
|
||||
#pragma endregion GameStateBase
|
||||
|
||||
#pragma region Actor
|
||||
void AGasaGameState::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
NetLog("BeginPlay");
|
||||
|
||||
// Notified as initialized here as any possible components should also be initialized by this point.
|
||||
UGasaGameInstance*
|
||||
GI = GetGameInstance<UGasaGameInstance>();
|
||||
GI->Event_OnGameFrameworkInitialized.AddDynamic(this, & ThisClass::OnGameFrameworkInitialized);
|
||||
GI->NotifyGameFrameworkClassReady(EGameFrameworkClassFlag::GameState);
|
||||
|
||||
#if ENABLE_COG
|
||||
CogWindowManager = NewObject<UCogWindowManager>(this);
|
||||
CogWindowManagerRef = CogWindowManager;
|
||||
|
||||
// Add all the built-in windows
|
||||
Cog::AddAllWindows(*CogWindowManager);
|
||||
#endif //ENABLE_COG
|
||||
}
|
||||
|
||||
void AGasaGameState::PostInitializeComponents()
|
||||
{
|
||||
NetLog("PostInitializeComponents");
|
||||
Super::PostInitializeComponents();
|
||||
|
||||
if ( ! GetWorld()->IsEditorWorld() && IsServer())
|
||||
{
|
||||
OnlinePlayers.Empty();
|
||||
#if 0
|
||||
const auto GI = Cast<UGasaGameInstance>(GetGameInstance());
|
||||
if (GI != nullptr)
|
||||
{
|
||||
int32 NumConnections = GI->SessionSettings.bPublicGame
|
||||
? GI->SessionSettings.PublicConnections
|
||||
: GI->SessionSettings.PrivateConnections;
|
||||
OnlinePlayers.Init(nullptr, NumConnections);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void AGasaGameState::Tick(float DeltaSeconds)
|
||||
{
|
||||
Super::Tick(DeltaSeconds);
|
||||
|
||||
#if ENABLE_COG
|
||||
if (CogWindowManager)
|
||||
CogWindowManager->Tick(DeltaSeconds);
|
||||
#endif //ENABLE_COG
|
||||
}
|
||||
#pragma endregion Actor
|
||||
|
||||
#pragma region UObject
|
||||
void AGasaGameState::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
|
||||
{
|
||||
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
|
||||
|
||||
DOREPLIFETIME(AGasaGameState, ListenServerHost);
|
||||
DOREPLIFETIME(AGasaGameState, OnlinePlayers);
|
||||
}
|
||||
#pragma endregion UObject
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
|
||||
#pragma region Actor
|
||||
void BeginPlay() override;
|
||||
#pragma region endActor
|
||||
#pragma endregion endActor
|
||||
};
|
||||
|
||||
namespace Gasa
|
||||
|
||||
Reference in New Issue
Block a user