Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "CapsPlayerState.h"
- #include <UnrealNetwork.h>
- #include <CoreNet.h>
- #include "Savegames/ProfileSave.h"
- void ACapsPlayerState::BeginPlay()
- {
- Super::BeginPlay();
- LoadPlayerProfile();
- }
- void ACapsPlayerState::GetLifetimeReplicatedProps(TArray< FLifetimeProperty > & OutLifetimeProps) const
- {
- Super::GetLifetimeReplicatedProps(OutLifetimeProps);
- DOREPLIFETIME(ACapsPlayerState, clientInformation);
- }
- void ACapsPlayerState::LoadPlayerProfile_Implementation()
- {
- //We load the player profile
- UProfileSave* profile = Cast<UProfileSave>(UGameplayStatics::LoadGameFromSlot("Profile", 0));
- if (profile)
- {
- FClientInformation info;
- info.PlayerName = profile->PlayerName;
- info.PlayerColor = profile->PlayerColor;
- info.HatItem = profile->HatIndex;
- info.ChosenTeam = ETeam::Nothing;
- UpdateClientInfo(info);
- }
- }
- bool ACapsPlayerState::LoadPlayerProfile_Validate()
- {
- return true;
- }
- void ACapsPlayerState::UpdateClientInfo_Implementation(FClientInformation info)
- {
- clientInformation = info;
- }
- bool ACapsPlayerState::UpdateClientInfo_Validate(FClientInformation info)
- {
- return true;
- }
- FClientInformation ACapsPlayerState::getClientInformation()
- {
- return clientInformation;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement