Lesson 82 - Parsing Create Player Sessions
This commit is contained in:
@@ -145,5 +145,23 @@ void UPortalManager::TryCreatePlayerSession(const FString& PlayerId, const FStri
|
||||
|
||||
void UPortalManager::FindPlayerSession_Response(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)
|
||||
{
|
||||
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Create Player Session Response Received..."));
|
||||
if (!bWasSuccessful)
|
||||
{
|
||||
BroadcastJoinGameSessionMessage.Broadcast(HTTPStatusMessages::SomethingWentWrong, true);
|
||||
}
|
||||
|
||||
TSharedPtr<FJsonObject> JsonObject;
|
||||
TSharedRef<TJsonReader<>> JsonReader = TJsonReaderFactory<>::Create(Response->GetContentAsString());
|
||||
if (FJsonSerializer::Deserialize(JsonReader, JsonObject))
|
||||
{
|
||||
if (ContainsErrors(JsonObject))
|
||||
{
|
||||
BroadcastJoinGameSessionMessage.Broadcast(HTTPStatusMessages::SomethingWentWrong, true);
|
||||
}
|
||||
|
||||
FDSPlayerSession PlayerSession;
|
||||
FJsonObjectConverter::JsonObjectToUStruct(JsonObject.ToSharedRef(), &PlayerSession);
|
||||
|
||||
PlayerSession.Dump();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user