39 - Seamless Travel and lobby

This commit is contained in:
Kingsmedia 2022-04-29 01:33:04 +02:00
parent 88ae3da92e
commit 712fdb652e
10 changed files with 45 additions and 1 deletions

View File

@ -9,7 +9,8 @@
"Type": "Runtime", "Type": "Runtime",
"LoadingPhase": "Default", "LoadingPhase": "Default",
"AdditionalDependencies": [ "AdditionalDependencies": [
"Engine" "Engine",
"UMG"
] ]
} }
], ],

View File

@ -3,6 +3,7 @@
[/Script/EngineSettings.GameMapsSettings] [/Script/EngineSettings.GameMapsSettings]
GameDefaultMap=/Game/Maps/GameStartupMap.GameStartupMap GameDefaultMap=/Game/Maps/GameStartupMap.GameStartupMap
EditorStartupMap=/Game/Maps/GameStartupMap.GameStartupMap EditorStartupMap=/Game/Maps/GameStartupMap.GameStartupMap
TransitionMap=/Game/Maps/TransitionMap.TransitionMap
[/Script/HardwareTargeting.HardwareTargetingSettings] [/Script/HardwareTargeting.HardwareTargetingSettings]
TargetedHardwareClass=Desktop TargetedHardwareClass=Desktop

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,22 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "LobbyGameMode.h"
#include "GameFramework/GameStateBase.h"
void ALobbyGameMode::PostLogin(APlayerController* NewPlayer)
{
Super::PostLogin(NewPlayer);
int32 NumberOfPlayers = GameState.Get()->PlayerArray.Num();
if (NumberOfPlayers == 2)
{
UWorld* World = GetWorld();
if (World)
{
bUseSeamlessTravel = true;
World->ServerTravel(FString("/Game/Maps/BlasterMap?listen"));
}
}
}

View File

@ -0,0 +1,20 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/GameMode.h"
#include "LobbyGameMode.generated.h"
/**
*
*/
UCLASS()
class BLASTER_API ALobbyGameMode : public AGameMode
{
GENERATED_BODY()
public:
virtual void PostLogin(APlayerController* NewPlayer) override;
};