Advertisement
Guest User

Untitled

a guest
Jul 9th, 2017
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1.  
  2. #include "CapsPlayerState.h"
  3. #include <UnrealNetwork.h>
  4. #include <CoreNet.h>
  5. #include "Savegames/ProfileSave.h"
  6.  
  7. void ACapsPlayerState::BeginPlay()
  8. {
  9. Super::BeginPlay();
  10.  
  11. LoadPlayerProfile();
  12. }
  13.  
  14. void ACapsPlayerState::GetLifetimeReplicatedProps(TArray< FLifetimeProperty > & OutLifetimeProps) const
  15. {
  16. Super::GetLifetimeReplicatedProps(OutLifetimeProps);
  17.  
  18. DOREPLIFETIME(ACapsPlayerState, clientInformation);
  19. }
  20.  
  21. void ACapsPlayerState::LoadPlayerProfile_Implementation()
  22. {
  23. //We load the player profile
  24. UProfileSave* profile = Cast<UProfileSave>(UGameplayStatics::LoadGameFromSlot("Profile", 0));
  25. if (profile)
  26. {
  27. FClientInformation info;
  28. info.PlayerName = profile->PlayerName;
  29. info.PlayerColor = profile->PlayerColor;
  30. info.HatItem = profile->HatIndex;
  31. info.ChosenTeam = ETeam::Nothing;
  32.  
  33. UpdateClientInfo(info);
  34. }
  35. }
  36.  
  37. bool ACapsPlayerState::LoadPlayerProfile_Validate()
  38. {
  39. return true;
  40. }
  41.  
  42. void ACapsPlayerState::UpdateClientInfo_Implementation(FClientInformation info)
  43. {
  44. clientInformation = info;
  45. }
  46.  
  47. bool ACapsPlayerState::UpdateClientInfo_Validate(FClientInformation info)
  48. {
  49. return true;
  50. }
  51.  
  52. FClientInformation ACapsPlayerState::getClientInformation()
  53. {
  54. return clientInformation;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement