Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include "CoreMinimal.h"
- #include "GameFramework/PlayerState.h"
- #include "CapsPlayerState.generated.h"
- UENUM(BlueprintType)
- enum class ETeam : uint8
- {
- Nothing,
- Red,
- Blue
- };
- USTRUCT(BlueprintType)
- struct FClientInformation
- {
- GENERATED_BODY()
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Client")
- FString PlayerName;
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Client")
- FLinearColor PlayerColor;
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Client")
- int32 HatItem;
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Client")
- ETeam ChosenTeam;
- };
- UCLASS()
- class CAPSULAR_API ACapsPlayerState : public APlayerState
- {
- GENERATED_BODY()
- public:
- virtual void BeginPlay() override;
- void GetLifetimeReplicatedProps(TArray< FLifetimeProperty > & OutLifetimeProps) const override;
- //Loads the player profile on the server and creates a clientinformation struct
- //this struct gets then send to the playerstate.
- UFUNCTION(Client, Reliable, WithValidation, Category = "Profile")
- void LoadPlayerProfile();
- void LoadPlayerProfile_Implementation();
- bool LoadPlayerProfile_Validate();
- UFUNCTION(Client, Reliable, WithValidation, Category = "Profile")
- void UpdateClientInfo(FClientInformation info);
- void UpdateClientInfo_Implementation(FClientInformation info);
- bool UpdateClientInfo_Validate(FClientInformation info);
- UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Client")
- FClientInformation getClientInformation();
- protected:
- UPROPERTY(Replicated)
- FClientInformation clientInformation;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement