GASATHON/Project/Source/Gasa/Game/GasaPlayerState.h

103 lines
3.2 KiB
C
Raw Normal View History

2024-10-22 14:32:37 -07:00
#pragma once
2024-04-13 07:19:45 -07:00
2024-04-13 08:09:22 -07:00
#include "AbilitySystemInterface.h"
2024-04-13 07:19:45 -07:00
#include "GameFramework/PlayerState.h"
2024-04-13 08:09:22 -07:00
#include "GasaCommon.h"
#include "Networking/GasaNetLibrary.h"
2024-04-13 08:09:22 -07:00
2024-04-13 07:19:45 -07:00
#include "GasaPlayerState.generated.h"
UCLASS(Blueprintable)
class GASA_API AGasaPlayerState : public APlayerState
2024-04-13 08:09:22 -07:00
, public IAbilitySystemInterface
2024-04-13 07:19:45 -07:00
{
GENERATED_BODY()
public:
AGasaPlayerState();
2024-10-22 14:32:37 -07:00
UPROPERTY(EditAnywhere, ReplicatedUsing="Client_OnRep_Level", Category="Gameplay")
int32 PlayerLevel;
UFUNCTION()
void Client_OnRep_Level(int32 OldLevel);
2024-04-13 08:09:22 -07:00
#pragma region Ability System
UPROPERTY(EditAnywhere, Category="Ability System")
bool bAutoAbilitySystem;
2024-04-13 08:09:22 -07:00
UPROPERTY(EditAnywhere, Category="Ability System")
TObjectPtr<UAbilitySystemComponent> AbilitySystem;
UPROPERTY(EditAnywhere, Category="Ability System")
TObjectPtr<UAttributeSet> Attributes;
#pragma endregion Ability System
#pragma region GameFramework
UFUNCTION()
void OnGameFrameworkInitialized();
UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, meta = (DisplayName = "On Game Framework Initialized"))
void BP_OnGameFrameworkInitialized();
UFUNCTION()
void OnNetOwnerReady(AGasaPlayerController* PC);
UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, meta = (DisplayName = "On Net Owner Ready"))
void BP_OnNetOwnerReady();
#pragma endregion GameFramework
#pragma region Networking
#if 0
UPROPERTY(ReplicatedUsing = Client_OnRep_GasaID)
int32 GasaID = INDEX_NONE;
UFUNCTION()
void Client_OnRep_GasaID;
#endif
#pragma endregion Networking
#pragma region NetSlime
// NetSlime interface is generated by GasaGen/GasaGen_NetSlime.cpp
FORCEINLINE ENetworkMode GetNetworkMode() const { return Gasa::GetNetworkMode( this ); }
FORCEINLINE bool IsClient() const { return Gasa::IsClient( this ); }
FORCEINLINE bool IsListenServer() const { return Gasa::IsListenServer( this ); }
FORCEINLINE bool IsNetOwner() const { return Gasa::IsNetOwner( this ); }
FORCEINLINE bool IsServer() const { return Gasa::IsServer( this ); }
FORCEINLINE bool IsSimulatedProxy() const { return Gasa::IsSimulatedProxy( this ); }
FORCEINLINE void NetLog(
FString Message,
EGasaVerbosity Verbosity = EGasaVerbosity::Log,
FLogCategoryBase& Category = LogGasaNet,
bool DumpStack = false,
int32 Line = __builtin_LINE(),
ANSICHAR const* File = __builtin_FILE(),
ANSICHAR const* Func = __builtin_FUNCTION()
)
{
Gasa::NetLog( this, Message, Verbosity, Category, DumpStack, Line, File, Func );
}
#pragma endregion NetSlime
2024-04-13 08:09:22 -07:00
#pragma region IAbilitySystem
FORCEINLINE UAttributeSet* GetAttributes() { return Attributes; }
FORCEINLINE UAbilitySystemComponent* GetAbilitySystemComponent() const override { return AbilitySystem; }
#pragma endregion IAbilitySystem
2024-04-13 08:56:19 -07:00
#pragma region PlayerState
void ClientInitialize(AController* C) override;
#pragma endregion PlayerState
#pragma region Actor
void BeginPlay() override;
void PostInitializeComponents() override;
void RegisterPlayerWithSession(bool bWasFromInvite) override;
void Reset() override;
#pragma endregion Actor
#pragma region UObject
void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
#pragma endregion UObject
2024-04-13 07:19:45 -07:00
};