Update Game Instance to Pass Max Players to Request

This commit is contained in:
Philip W 2023-12-06 04:31:22 +00:00
parent 973ebc6d5c
commit 9b29df3a22
3 changed files with 5 additions and 5 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:2b6023209361bd81256608809d1f600f67957c3719fb717b3c95e59306b4ac04 oid sha256:3ffff5311b038e01da6998ac24cc2be9f75382d7fc2da894dd6714dd47121ab2
size 562037 size 572731

View File

@ -35,7 +35,7 @@ void UCMGameInstance::Logout()
Request->ProcessRequest(); Request->ProcessRequest();
} }
void UCMGameInstance::CreateLobby() void UCMGameInstance::CreateLobby(const int MaxPlayers)
{ {
const auto Request = FHttpModule::Get().CreateRequest(); const auto Request = FHttpModule::Get().CreateRequest();
Request->SetURL(LobbyAPI + "/create"); Request->SetURL(LobbyAPI + "/create");
@ -43,7 +43,7 @@ void UCMGameInstance::CreateLobby()
Request->SetHeader("Authorization", "Bearer " + JwtToken); Request->SetHeader("Authorization", "Bearer " + JwtToken);
Request->SetHeader("Content-Type", "application/json"); Request->SetHeader("Content-Type", "application/json");
Request->SetHeader("Accept", "application/json"); Request->SetHeader("Accept", "application/json");
Request->SetContentAsString("{\"maxPlayers\":\"4\"}"); Request->SetContentAsString("{\"maxPlayers\":" + FString::FromInt(MaxPlayers) + "}");
Request->OnProcessRequestComplete().BindUObject(this, &UCMGameInstance::OnRequestToCreateLobbyComplete); Request->OnProcessRequestComplete().BindUObject(this, &UCMGameInstance::OnRequestToCreateLobbyComplete);
Request->ProcessRequest(); Request->ProcessRequest();
} }

View File

@ -67,7 +67,7 @@ public:
UFUNCTION(BlueprintCallable, Category = "Account") UFUNCTION(BlueprintCallable, Category = "Account")
void Logout(); void Logout();
UFUNCTION(BlueprintCallable, Category = "Lobby") UFUNCTION(BlueprintCallable, Category = "Lobby")
void CreateLobby(); void CreateLobby(const int MaxPlayers);
UFUNCTION(BlueprintCallable, Category = "Lobby") UFUNCTION(BlueprintCallable, Category = "Lobby")
void JoinLobby(); void JoinLobby();
UFUNCTION(BlueprintCallable, Category = "Lobby") UFUNCTION(BlueprintCallable, Category = "Lobby")