HTTP Communication in Unreal Engine
•
HTTPService implementation: login
HTTPService.cpp
void AHTTPService::LoginResponse(FHttpRequestPtr Request,
FHttpResponsePtr Response, bool bWasSuccessful,
APlayerState* playerState){
if (!ResponseIsValid(Response, bWasSuccessful)){
return;
}
FLoginResponse LoginResponse;
FString JsonString = Response->GetContentAsString();
FJsonObjectConverter::JsonObjectStringToUStruct<FLoginResponse>(
JsonString, &LoginResponse, 0, 0);
if (LoginResponse.LoginResult.status == 0){
LoginWidget->RemoveFromViewport();
LocalCharacter->EnableInput(nullptr);
APlayerController* pController = Cast<APlayerController>(
LocalCharacter->GetController());
...