From efa99f3fd7b9a3488ee8fa22bb79eba72e16ee8e Mon Sep 17 00:00:00 2001 From: eyakm1 Date: Mon, 5 Jun 2023 02:37:34 +0300 Subject: [PATCH] Destroy session on game end, random sessions names --- Content/BattleField/BP_EndOfGameWidget.uasset | Bin 29975 -> 27684 bytes Source/TurnBasedTutorial/GameOverWidget.cpp | 33 ++++++++++++++---- Source/TurnBasedTutorial/GameOverWidget.h | 5 +++ .../MyGameInstanceSubsystem.cpp | 28 ++++++++++++--- .../MyGameInstanceSubsystem.h | 8 ++++- Source/TurnBasedTutorial/MyMainMenu.cpp | 2 +- .../MySessionListEntryWidget.cpp | 5 +-- 7 files changed, 67 insertions(+), 14 deletions(-) diff --git a/Content/BattleField/BP_EndOfGameWidget.uasset b/Content/BattleField/BP_EndOfGameWidget.uasset index 91d6502c5163f79eb6c402407947e8138a3a0ce6..0cdda722f9282e0ffa6f76a616f12c6559468343 100644 GIT binary patch literal 27684 zcmeHQ34Bz={hw7p35O?$sIb8Uks~LBAfm}8OMqOE1Qmp^$-X2Do87Sc76_uERqBZc zg2fXNthT6VRkZeyT6=i5wQ5^iwTiZAv0neydgcH7&dhK3?e5#;A)%lDzjgS$otfYK zW`5`VX5O2Z$Ifq@a_hgky1Et}C`8r)LZ*K7J9X#6qR%RJ^?Uzf@zD88PdTX%!PX2r zZqdax{%xEB|-f2i06Qa>x14 zZ`(Zci%D4oJKg;J`PF6HJ+B>k?YgM@xT8)a*q*lSyLOje|M7r7mvrvij4C$bH6Ev4&6&;9Ve4c8RRx-$E@L)QFY_WkSoZ@sMRya%ct zd-hJ>)0+;75lw+{z(5~y4D}y&`BAPTs5W+NLwVuYIY!X%MUC-=6Y`5Bf)J~I+BXvd zb(87zXMXcI3U3kz?w|z4f5;47ke`}F&U9b9kyGk3&7k287(stdX>DV9$Y0ZfhBE{H zR>Ks(|MIzGCp$!*VADT#@a1Y5{g4l}1T7&AH|fsi>p;_GM=yI)yVcBG}*6OI@SHBF0+W>b7JWBjy3 zEN$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Yq?~>r&XC_AlLhWZkexmd1bA#k2Q-$W zl@geB`OjR|N>mDHI&aju%0^H&t1B9_C8wf_oZNAxd3pJ{6$Qmbxdoom+?<>;cXm;E zk=v73>X9dJZu+_7jA$rB{yT$g&5G~x_}=;QPD8L%)+BV`{f^Ry1<}4}9@Sl;5t8B? z?j=ssjr^PeCkisb39Qc<)W2S^nmAFJUfok=d!fwIio)EA?0ipte%`p^;&M;vxSVl0 zh3?bx(4{)=RI-@5oTg=DD;}roKi7Fuwn{@-Iq|57 zRfn~i(n1J9Y?0)UoM^lL%)K8K_(uSw!k7^d63zCXJqLP`MiTYN8kdJCKh6O-4aM2` z(fvbLvQ}pj6-0RXc{w!T17G)$`vaF!F5+(Vdv|PjE zZ)lyT0c@rCAn{s7eyYa7)WEEOGZ!C}aLR%tPt+*yCUyr9DJ#4GFjHWUmeLeQB;J+}H#}L@T6rm8qY>nxrd*I>*?Md@7SadxYZ4 zy3X-Ja$zI}-lCB_I#0^V5~yJ2Azh`ipK00`5*dj@A0St!Dv7$nvNGht-;6H!2fK$vhaEJ8DO5>`$rxqyQsEOnClicked.AddDynamic(this, &ThisClass::QuitCurrentSession); +} + +void UGameOverWidget::QuitCurrentSession() +{ + const UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(GetWorld()); + UMyGameInstanceSubsystem* GameInstanceSubsystem = GameInstance->GetSubsystem(); + GameInstanceSubsystem->QuitCurrentSession(); +} -void UGameOverWidget::SetWidgetText_Implementation(bool HasWon) { - if (HasWon) { - GameOverText->SetText(FText::FromString("You won!")); - } else { - GameOverText->SetText(FText::FromString("You lose!")); - } +void UGameOverWidget::SetWidgetText_Implementation(bool HasWon) +{ + if (HasWon) + { + GameOverText->SetText(FText::FromString("You won!")); + } + else + { + GameOverText->SetText(FText::FromString("You lose!")); + } } diff --git a/Source/TurnBasedTutorial/GameOverWidget.h b/Source/TurnBasedTutorial/GameOverWidget.h index 5bee377..113402b 100644 --- a/Source/TurnBasedTutorial/GameOverWidget.h +++ b/Source/TurnBasedTutorial/GameOverWidget.h @@ -14,9 +14,14 @@ class TURNBASEDTUTORIAL_API UGameOverWidget : public UUserWidget { GENERATED_BODY() public: + virtual void NativeConstruct() override; + UFUNCTION(Client, Reliable) void SetWidgetText(bool HasWon); + UFUNCTION() + void QuitCurrentSession(); + protected: UPROPERTY(meta = (BindWidget)) class UButton *ButtonToMenu; diff --git a/Source/TurnBasedTutorial/MyGameInstanceSubsystem.cpp b/Source/TurnBasedTutorial/MyGameInstanceSubsystem.cpp index 3976783..15a858e 100644 --- a/Source/TurnBasedTutorial/MyGameInstanceSubsystem.cpp +++ b/Source/TurnBasedTutorial/MyGameInstanceSubsystem.cpp @@ -2,7 +2,9 @@ #include "MyGameInstanceSubsystem.h" +#include "MyPlayerController.h" #include "OnlineSubsystemUtils.h" +#include "GameFramework/GameModeBase.h" #include "Kismet/GameplayStatics.h" UMyGameInstanceSubsystem::UMyGameInstanceSubsystem() : CreateSessionCompleteDelegate( @@ -25,12 +27,13 @@ UMyGameInstanceSubsystem::UMyGameInstanceSubsystem() : CreateSessionCompleteDele this, &ThisClass::OnFindSessionsCompleted)), JoinSessionCompleteDelegate( FOnJoinSessionCompleteDelegate::CreateUObject( - this, &ThisClass::OnJoinSessionCompleted)) + this, &ThisClass::OnJoinSessionCompleted)), + bIsHost(false) { } -void UMyGameInstanceSubsystem::CreateSession(int32 NumPublicConnections, bool bIsLANMatch) +void UMyGameInstanceSubsystem::CreateSession(FString SessionName, int32 NumPublicConnections, bool bIsLANMatch) { const IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(GetWorld()); if (!SessionInterface.IsValid()) @@ -50,7 +53,7 @@ void UMyGameInstanceSubsystem::CreateSession(int32 NumPublicConnections, bool bI LastSessionSettings->bIsLANMatch = bIsLANMatch; LastSessionSettings->bShouldAdvertise = true; - LastSessionSettings->Set(SETTING_MAPNAME, FString("Your Level Name"), + LastSessionSettings->Set(SETTING_MAPNAME, SessionName, EOnlineDataAdvertisementType::ViaOnlineService); CreateSessionCompleteDelegateHandle = SessionInterface->AddOnCreateSessionCompleteDelegate_Handle( @@ -74,6 +77,8 @@ void UMyGameInstanceSubsystem::OnCreateSessionCompleted(FName SessionName, bool SessionInterface->ClearOnCreateSessionCompleteDelegate_Handle(CreateSessionCompleteDelegateHandle); } + bIsHost = true; + OnCreateSessionCompleteEvent.Broadcast(bSuccessful); } @@ -150,7 +155,7 @@ void UMyGameInstanceSubsystem::OnStartSessionCompleted(FName SessionName, bool b OnStartSessionCompleteEvent.Broadcast(bSuccessful); // TODO: Move this from gameinstance subsystem. This should not be here. - UGameplayStatics::OpenLevel(GetWorld(),"BattleFieldMap", true, "listen"); + UGameplayStatics::OpenLevel(GetWorld(), "BattleFieldMap", true, "listen"); } @@ -346,3 +351,18 @@ bool UMyGameInstanceSubsystem::TryConnectToCurrentSession() const PlayerController->ClientTravel(ConnectString, TRAVEL_Absolute); return true; } + +void UMyGameInstanceSubsystem::QuitCurrentSession() +{ + if (bIsHost) + { + UGameplayStatics::GetGameMode(GetWorld())->ReturnToMainMenuHost(); + } + else + { + APlayerController* LocalController = GEngine->GetFirstLocalPlayerController(GetWorld()); + LocalController->ClientReturnToMainMenuWithTextReason(FText::FromString("Session ended")); + } + bIsHost = false; + DestroySession(); +} diff --git a/Source/TurnBasedTutorial/MyGameInstanceSubsystem.h b/Source/TurnBasedTutorial/MyGameInstanceSubsystem.h index 10dbc5b..7a08655 100644 --- a/Source/TurnBasedTutorial/MyGameInstanceSubsystem.h +++ b/Source/TurnBasedTutorial/MyGameInstanceSubsystem.h @@ -34,7 +34,7 @@ class TURNBASEDTUTORIAL_API UMyGameInstanceSubsystem : public UGameInstanceSubsy public: UMyGameInstanceSubsystem(); - void CreateSession(int32 NumPublicConnections, bool bIsLANMatch); + void CreateSession(FString SessionName, int32 NumPublicConnections, bool bIsLANMatch); void UpdateSession(); @@ -51,6 +51,10 @@ public: void JoinSession(const int32 Index); bool TryConnectToCurrentSession() const; + + void QuitCurrentSession(); + + void UpdateSessionName(FString NewSessionName); FMyOnCreateSessionComplete OnCreateSessionCompleteEvent; FMyOnUpdateSessionComplete OnUpdateSessionCompleteEvent; @@ -76,6 +80,8 @@ protected: void OnJoinSessionCompleted(FName SessionName, EOnJoinSessionCompleteResult::Type Result); private: + bool bIsHost; + FOnCreateSessionCompleteDelegate CreateSessionCompleteDelegate; FDelegateHandle CreateSessionCompleteDelegateHandle; TSharedPtr LastSessionSettings; diff --git a/Source/TurnBasedTutorial/MyMainMenu.cpp b/Source/TurnBasedTutorial/MyMainMenu.cpp index a80d116..3b0d757 100644 --- a/Source/TurnBasedTutorial/MyMainMenu.cpp +++ b/Source/TurnBasedTutorial/MyMainMenu.cpp @@ -17,7 +17,7 @@ void UMyMainMenu::NativeConstruct() void UMyMainMenu::OnHostOnlineGameButtonClicked() { - GetMyGameSubsystem()->CreateSession(2, true); + GetMyGameSubsystem()->CreateSession("Lobby " + FString::FromInt(FMath::RandRange(1, 1e6)),2, true); } void UMyMainMenu::StartSessionWhenCreatingSessonComplete(bool bSuccess) diff --git a/Source/TurnBasedTutorial/MySessionListEntryWidget.cpp b/Source/TurnBasedTutorial/MySessionListEntryWidget.cpp index da10049..67c5200 100644 --- a/Source/TurnBasedTutorial/MySessionListEntryWidget.cpp +++ b/Source/TurnBasedTutorial/MySessionListEntryWidget.cpp @@ -11,8 +11,9 @@ void UMySessionListEntryWidget::Update(int SessionIndex, const FOnlineSessionSea { SessionId = SessionIndex; IndexText->SetText(FText::AsNumber(SessionIndex + 1)); - // TODO: SessionNameText->SetText(FText::FromString(Session.Session.SessionSettings.Get(...))) - SessionNameText->SetText(FText::FromString("Test session name")); + + Session.Session.SessionSettings.Get(SETTING_MAPNAME, SessionName); + SessionNameText->SetText(FText::FromString(SessionName)); int MaxPlayerCount = Session.Session.SessionSettings.NumPublicConnections; int CurPlayerCount = MaxPlayerCount - Session.Session.NumOpenPublicConnections;