Advertisement
Guest User

Untitled

a guest
Jul 9th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1.  
  2. #pragma once
  3.  
  4. #include "CoreMinimal.h"
  5. #include "GameFramework/PlayerState.h"
  6. #include "CapsPlayerState.generated.h"
  7.  
  8.  
  9. UENUM(BlueprintType)
  10. enum class ETeam : uint8
  11. {
  12. Nothing,
  13. Red,
  14. Blue
  15. };
  16.  
  17. USTRUCT(BlueprintType)
  18. struct FClientInformation
  19. {
  20. GENERATED_BODY()
  21.  
  22. UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Client")
  23. FString PlayerName;
  24.  
  25. UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Client")
  26. FLinearColor PlayerColor;
  27.  
  28. UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Client")
  29. int32 HatItem;
  30.  
  31. UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Client")
  32. ETeam ChosenTeam;
  33. };
  34.  
  35. UCLASS()
  36. class CAPSULAR_API ACapsPlayerState : public APlayerState
  37. {
  38. GENERATED_BODY()
  39.  
  40.  
  41. public:
  42.  
  43. virtual void BeginPlay() override;
  44. void GetLifetimeReplicatedProps(TArray< FLifetimeProperty > & OutLifetimeProps) const override;
  45.  
  46. //Loads the player profile on the server and creates a clientinformation struct
  47. //this struct gets then send to the playerstate.
  48. UFUNCTION(Client, Reliable, WithValidation, Category = "Profile")
  49. void LoadPlayerProfile();
  50. void LoadPlayerProfile_Implementation();
  51. bool LoadPlayerProfile_Validate();
  52.  
  53. UFUNCTION(Client, Reliable, WithValidation, Category = "Profile")
  54. void UpdateClientInfo(FClientInformation info);
  55. void UpdateClientInfo_Implementation(FClientInformation info);
  56. bool UpdateClientInfo_Validate(FClientInformation info);
  57.  
  58. UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Client")
  59. FClientInformation getClientInformation();
  60.  
  61. protected:
  62.  
  63. UPROPERTY(Replicated)
  64. FClientInformation clientInformation;
  65.  
  66.  
  67. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement