Skip to content

Commit

Permalink
Merge pull request #15 from 4Players/ue-networking-5.4
Browse files Browse the repository at this point in the history
Ue networking 5.4
  • Loading branch information
SFuhrmann authored Nov 4, 2024
2 parents ef5c2bd + 6a623fd commit db6ff9d
Show file tree
Hide file tree
Showing 25 changed files with 32 additions and 1 deletion.
Binary file modified Content/Blueprints/Game/GameInstance_TD.uasset
Binary file not shown.
Binary file modified Content/Blueprints/Game/TopDownCharacter.uasset
Binary file not shown.
Binary file modified Content/Blueprints/Game/TopDownController.uasset
Binary file not shown.
Binary file modified Content/Blueprints/Odin/OdinClientComponent.uasset
Binary file not shown.
Binary file modified Content/Blueprints/Widgets/IngameHud.uasset
Binary file not shown.
Binary file modified Content/Blueprints/Widgets/OptionsMenu/WBP_Options.uasset
Binary file not shown.
Binary file modified Content/Mannequin/Animations/ThirdPerson_AnimBP.uasset
Binary file not shown.
Binary file modified Content/Maps/TopDownExampleMap.umap
Binary file not shown.
Binary file added Content/Sound/ReverbEffectSubmixPreset.uasset
Binary file not shown.
Binary file added Content/SteamAudio/Materials/Brick.uasset
Binary file not shown.
Binary file added Content/SteamAudio/Materials/Carpet.uasset
Binary file not shown.
Binary file added Content/SteamAudio/Materials/Ceramic.uasset
Binary file not shown.
Binary file added Content/SteamAudio/Materials/Concrete.uasset
Binary file not shown.
Binary file added Content/SteamAudio/Materials/Glass.uasset
Binary file not shown.
Binary file added Content/SteamAudio/Materials/Metal.uasset
Binary file not shown.
Binary file added Content/SteamAudio/Materials/Wood.uasset
Binary file not shown.
Binary file modified Plugins/SteamAudio/Content/Materials/Brick.uasset
Binary file not shown.
Binary file modified Plugins/SteamAudio/Content/Materials/Carpet.uasset
Binary file not shown.
Binary file modified Plugins/SteamAudio/Content/Materials/Ceramic.uasset
Binary file not shown.
Binary file modified Plugins/SteamAudio/Content/Materials/Concrete.uasset
Binary file not shown.
Binary file modified Plugins/SteamAudio/Content/Materials/Glass.uasset
Binary file not shown.
Binary file modified Plugins/SteamAudio/Content/Materials/Metal.uasset
Binary file not shown.
Binary file modified Plugins/SteamAudio/Content/Materials/Wood.uasset
Binary file not shown.
21 changes: 20 additions & 1 deletion Source/OdinUnrealSample/Private/EosPlayerController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ void AEosPlayerController::Login()

if (NetId != nullptr && Identity->GetLoginStatus(0) == ELoginStatus::LoggedIn)
{
return;
UE_LOG(LogTemp, Log, TEXT("Already logged in. Finding sessions."));
FindSessions();
}

/* This binds a delegate so we can run our function when the callback completes. 0 represents the player number.
Expand Down Expand Up @@ -91,6 +92,23 @@ void AEosPlayerController::Login()
}
}

void AEosPlayerController::Logout()
{
IOnlineSubsystem* Subsystem = Online::GetSubsystem(GetWorld());
auto Session = Subsystem->GetSessionInterface();

DestroySessionDelegateHandle =
Session->AddOnDestroySessionCompleteDelegate_Handle(
FOnDestroySessionCompleteDelegate::CreateUObject(
this,
&ThisClass::HandleLogoutCompleted));

Session->DestroySession(LobbyName);
}

void AEosPlayerController::HandleLogoutCompleted(FName SessionNameD, bool bWasSuccessful)
{
}


void AEosPlayerController::HandleLoginCompleted(int32 LocalUserNum, bool bWasSuccessful, const FUniqueNetId& UserId, const FString& Error)
Expand Down Expand Up @@ -275,6 +293,7 @@ void AEosPlayerController::HandleFindSessionsCompleted(bool bWasSuccessful, TSha
if (Session->GetResolvedConnectString(SessionInSearchResult, NAME_GamePort, ConnectString))
{
SessionToJoin = &SessionInSearchResult;
SessionNameT = FName(SessionInSearchResult.GetSessionIdStr());
}

// For the tutorial we will join the first session found automatically. Usually you would loop through all the sessions and determine which one is best to join.
Expand Down
12 changes: 12 additions & 0 deletions Source/OdinUnrealSample/Private/EosPlayerController.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ class AEosPlayerController : public APlayerController
//Function to sign into EOS Game Services
void Login();

UFUNCTION(BlueprintCallable)
//Function to sign into EOS Game Services
void Logout();

void HandleLogoutCompleted(FName SessionName, bool bWasSuccessful);

FDelegateHandle LogoutDelegateHandle;

//Callback function. This function is ran when signing into EOS Game Services completes.
void HandleLoginCompleted(int32 LocalUserNum, bool bWasSuccessful, const FUniqueNetId& UserId, const FString& Error);

Expand Down Expand Up @@ -78,4 +86,8 @@ class AEosPlayerController : public APlayerController

// Delegate to bind callback event for join session.
FDelegateHandle JoinSessionDelegateHandle;

FDelegateHandle DestroySessionDelegateHandle;

FName SessionNameT;
};

0 comments on commit db6ff9d

Please sign in to comment.