Lesson 82 - Parsing Create Player Sessions

This commit is contained in:
Norman Lansing
2026-04-05 20:52:27 -04:00
parent 16e4470081
commit 03867600b8
4 changed files with 27 additions and 10 deletions

View File

@@ -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();
}
}