Compare commits
16 Commits
new/API_Ga
...
new/API_Ga
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9fb60888ba | ||
|
|
acc105c84d | ||
|
|
d9eb52c047 | ||
|
|
e95360489b | ||
|
|
6f3e1d1f86 | ||
|
|
30c1e42379 | ||
|
|
7f154aa6f9 | ||
|
|
8d6f3f68f1 | ||
|
|
3912fe52c6 | ||
|
|
d989960b41 | ||
|
|
3407b94731 | ||
|
|
b26e9eb576 | ||
|
|
898fba8153 | ||
|
|
f52a4225c3 | ||
|
|
2ec989d34a | ||
|
|
3e61d4cec0 |
@@ -2,9 +2,9 @@
|
|||||||
CommonUI.Debug.CheckGameViewportClientValid=0
|
CommonUI.Debug.CheckGameViewportClientValid=0
|
||||||
|
|
||||||
[/Script/EngineSettings.GameMapsSettings]
|
[/Script/EngineSettings.GameMapsSettings]
|
||||||
GameDefaultMap=/Game/ThirdPerson/Maps/ThirdPersonMap.ThirdPersonMap
|
GameDefaultMap=/Game/Maps/StartupMap.StartupMap
|
||||||
EditorStartupMap=/Game/ThirdPerson/Maps/ThirdPersonMap.ThirdPersonMap
|
EditorStartupMap=/Game/Maps/StartupMap.StartupMap
|
||||||
GlobalDefaultGameMode=/Game/Blueprints/Game/BP_ShooterGameMode.BP_ShooterGameMode_C
|
GlobalDefaultGameMode=/Game/Blueprints/Game/BP_ShooterGameModeBase.BP_ShooterGameModeBase_C
|
||||||
ServerDefaultMap=/Game/ThirdPerson/Maps/ThirdPersonMap.ThirdPersonMap
|
ServerDefaultMap=/Game/ThirdPerson/Maps/ThirdPersonMap.ThirdPersonMap
|
||||||
|
|
||||||
[/Script/WindowsTargetPlatform.WindowsTargetSettings]
|
[/Script/WindowsTargetPlatform.WindowsTargetSettings]
|
||||||
@@ -185,4 +185,5 @@ DefaultPort=7777
|
|||||||
[CoreRedirects]
|
[CoreRedirects]
|
||||||
+EnumRedirects=(OldName="/Script/FPSTemplate.EvalidationError",NewName="/Script/FPSTemplate.EValidationError")
|
+EnumRedirects=(OldName="/Script/FPSTemplate.EvalidationError",NewName="/Script/FPSTemplate.EValidationError")
|
||||||
+FunctionRedirects=(OldName="/Script/FPSTemplate.GameLiftValidators.LogValidataErrorMessage",NewName="/Script/FPSTemplate.GameLiftValidators.LogValidationErrorMessage")
|
+FunctionRedirects=(OldName="/Script/FPSTemplate.GameLiftValidators.LogValidataErrorMessage",NewName="/Script/FPSTemplate.GameLiftValidators.LogValidationErrorMessage")
|
||||||
;+PropertyRedirects=(OldName="/Script/FPSTemplate.CommandLineArgs.Arguments",NewName="/Script/FPSTemplate.CommandLineArgs.CmdArguments")
|
;+PropertyRedirects=(OldName="/Script/FPSTemplate.CommandLineArgs.Arguments",NewName="/Script/FPSTemplate.CommandLineArgs.CmdArguments")
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
BIN
Content/Blueprints/Game/BP_ShooterGameModeBase.uasset
Normal file
BIN
Content/Blueprints/Game/BP_ShooterGameModeBase.uasset
Normal file
Binary file not shown.
BIN
Content/DedicatedServers/API/ListFleets/WBP_FleetId.uasset
Normal file
BIN
Content/DedicatedServers/API/ListFleets/WBP_FleetId.uasset
Normal file
Binary file not shown.
BIN
Content/DedicatedServers/API/ListFleets/WBP_ListFleetsBox.uasset
Normal file
BIN
Content/DedicatedServers/API/ListFleets/WBP_ListFleetsBox.uasset
Normal file
Binary file not shown.
BIN
Content/DedicatedServers/APITest/BP_APITestManager.uasset
Normal file
BIN
Content/DedicatedServers/APITest/BP_APITestManager.uasset
Normal file
Binary file not shown.
BIN
Content/DedicatedServers/APITest/UI/BP_APITestHUD.uasset
Normal file
BIN
Content/DedicatedServers/APITest/UI/BP_APITestHUD.uasset
Normal file
Binary file not shown.
BIN
Content/DedicatedServers/APITest/UI/WBP_APITestOverlay.uasset
Normal file
BIN
Content/DedicatedServers/APITest/UI/WBP_APITestOverlay.uasset
Normal file
Binary file not shown.
BIN
Content/DedicatedServers/Data/DA_GameSessionsAPIData.uasset
Normal file
BIN
Content/DedicatedServers/Data/DA_GameSessionsAPIData.uasset
Normal file
Binary file not shown.
BIN
Content/DedicatedServers/Portal/BP_PortalHUD.uasset
Normal file
BIN
Content/DedicatedServers/Portal/BP_PortalHUD.uasset
Normal file
Binary file not shown.
BIN
Content/DedicatedServers/Portal/BP_PortalManager.uasset
Normal file
BIN
Content/DedicatedServers/Portal/BP_PortalManager.uasset
Normal file
Binary file not shown.
BIN
Content/DedicatedServers/Portal/WBP_JoinGame.uasset
Normal file
BIN
Content/DedicatedServers/Portal/WBP_JoinGame.uasset
Normal file
Binary file not shown.
BIN
Content/DedicatedServers/Portal/WBP_SignInOverlay.uasset
Normal file
BIN
Content/DedicatedServers/Portal/WBP_SignInOverlay.uasset
Normal file
Binary file not shown.
Binary file not shown.
@@ -12,6 +12,11 @@
|
|||||||
"Engine",
|
"Engine",
|
||||||
"UMG"
|
"UMG"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "DedicatedServers",
|
||||||
|
"Type": "Runtime",
|
||||||
|
"LoadingPhase": "Default"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"Plugins": [
|
"Plugins": [
|
||||||
@@ -53,10 +58,6 @@
|
|||||||
{
|
{
|
||||||
"Name": "PerforceSourceControl",
|
"Name": "PerforceSourceControl",
|
||||||
"Enabled": false
|
"Enabled": false
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "GameLiftPlugin",
|
|
||||||
"Enabled": true
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
44
Source/DedicatedServers/DedicatedServers.Build.cs
Normal file
44
Source/DedicatedServers/DedicatedServers.Build.cs
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||||
|
|
||||||
|
using System.IO;
|
||||||
|
using UnrealBuildTool;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
public class DedicatedServers : ModuleRules
|
||||||
|
{
|
||||||
|
public DedicatedServers(ReadOnlyTargetRules Target) : base(Target)
|
||||||
|
{
|
||||||
|
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||||
|
|
||||||
|
PublicDependencyModuleNames.AddRange(new string[]
|
||||||
|
{
|
||||||
|
"Core",
|
||||||
|
"CoreUObject",
|
||||||
|
"Engine",
|
||||||
|
"GameplayTags",
|
||||||
|
"HTTP"
|
||||||
|
});
|
||||||
|
|
||||||
|
PrivateDependencyModuleNames.AddRange(new string[]
|
||||||
|
{
|
||||||
|
"Slate",
|
||||||
|
"SlateCore",
|
||||||
|
"OpenSSL",
|
||||||
|
"UMG",
|
||||||
|
"Json",
|
||||||
|
"JsonUtilities"
|
||||||
|
});
|
||||||
|
|
||||||
|
// Adds in the plugin for GameLiftServerSDK if it is the server build.
|
||||||
|
|
||||||
|
if (Target.Type == TargetType.Server)
|
||||||
|
{
|
||||||
|
PublicDependencyModuleNames.Add("GameLiftServerSDK");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PublicDefinitions.Add("WITH_GAMELIFT=0");
|
||||||
|
}
|
||||||
|
bEnableExceptions = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
8
Source/DedicatedServers/DedicatedServers.cpp
Normal file
8
Source/DedicatedServers/DedicatedServers.cpp
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||||
|
|
||||||
|
#include "DedicatedServers.h"
|
||||||
|
#include "Modules/ModuleManager.h"
|
||||||
|
|
||||||
|
IMPLEMENT_MODULE( FDefaultModuleImpl, DedicateServers );
|
||||||
|
|
||||||
|
DEFINE_LOG_CATEGORY(LogDedicatedServers);
|
||||||
7
Source/DedicatedServers/DedicatedServers.h
Normal file
7
Source/DedicatedServers/DedicatedServers.h
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
|
||||||
|
DECLARE_LOG_CATEGORY_EXTERN(LogDedicatedServers, Log, All)
|
||||||
11
Source/DedicatedServers/Private/Data/API/APIData.cpp
Normal file
11
Source/DedicatedServers/Private/Data/API/APIData.cpp
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "Data/API/APIData.h"
|
||||||
|
|
||||||
|
FString UAPIData::GetAPIEndpoint(const FGameplayTag& APIEndpoint)
|
||||||
|
{
|
||||||
|
const FString ResourceName = Resources.FindChecked(APIEndpoint);
|
||||||
|
|
||||||
|
return InvokeUrl + "/" + Stage + "/" + ResourceName;
|
||||||
|
}
|
||||||
@@ -1,61 +1,54 @@
|
|||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
#include "Game/ShooterGameMode.h"
|
|
||||||
#include "GenericPlatform/GenericPlatformMisc.h"
|
#include "DedicatedServers/Public/Game/DS_GameMode.h"
|
||||||
#include "Containers/UnrealString.h"
|
|
||||||
#include "GameLiftClpTypes.h"
|
|
||||||
#include "GameLift/GameLiftClp.h"
|
|
||||||
#include "openssl/sha.h"
|
#include "openssl/sha.h"
|
||||||
|
#include "GameLift/GameLiftClp.h"
|
||||||
|
#if WITH_GAMELIFT
|
||||||
#include "GameLiftServerSDK.h"
|
#include "GameLiftServerSDK.h"
|
||||||
#include "GameLiftServerSDKModels.h"
|
#endif
|
||||||
|
|
||||||
|
DEFINE_LOG_CATEGORY(LogDS_GameMode);
|
||||||
|
|
||||||
|
void ADS_GameMode::BeginPlay()
|
||||||
DEFINE_LOG_CATEGORY(LogShooterGameMode);
|
|
||||||
|
|
||||||
// Function implementations.
|
|
||||||
|
|
||||||
AShooterGameMode::AShooterGameMode()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void AShooterGameMode::BeginPlay()
|
|
||||||
{
|
{
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
#if WITH_GAMELIFT
|
|
||||||
InitGameLift();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AShooterGameMode::InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage)
|
void ADS_GameMode::InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage)
|
||||||
{
|
{
|
||||||
Super::InitGame(MapName, Options, ErrorMessage);
|
Super::InitGame(MapName, Options, ErrorMessage);
|
||||||
|
|
||||||
|
#if WITH_GAMELIFT
|
||||||
|
|
||||||
CachedCommandLine = FCommandLine::Get();
|
CachedCommandLine = FCommandLine::Get();
|
||||||
|
|
||||||
const FPortResult PortResult = cmdlineparser::details::GetConfiguredOrDefaultPort(CachedCommandLine, TEXT("port"));;
|
const FPortResult PortResult = cmdlineparser::details::GetConfiguredOrDefaultPort(CachedCommandLine, TEXT("port"));;
|
||||||
if (PortResult.bUsedDefaultPort)
|
if (PortResult.bUsedDefaultPort)
|
||||||
{
|
{
|
||||||
UE_LOGFMT (LogShooterGameMode, Warning, "{0}", PortResult.WarningMessage);
|
UE_LOGFMT (LogDS_GameMode, Warning, "{0}", PortResult.WarningMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
GameLiftConfig.ServerPort = PortResult.Port;
|
GameLiftConfig.ServerPort = PortResult.Port;
|
||||||
if (FParse::Param(*CachedCommandLine, TEXT("glAnywhereFleet")))
|
if (FParse::Param(*CachedCommandLine, TEXT("glAnywhereFleet")))
|
||||||
{
|
{
|
||||||
UE_LOGFMT(LogShooterGameMode, Log, "Fleet type: Anywhere");
|
UE_LOGFMT(LogDS_GameMode, Log, "Fleet type: Anywhere");
|
||||||
GameLiftConfig.bIsAnywhereFleet = true;
|
GameLiftConfig.bIsAnywhereFleet = true;
|
||||||
GameLiftConfig.bAllOptionsFound = GetAnywhereFleetParameters(CachedCommandLine);
|
GameLiftConfig.bAllOptionsFound = GetAnywhereFleetParameters(CachedCommandLine);
|
||||||
LogAnywhereFleetParameters();
|
LogAnywhereFleetParameters();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UE_LOGFMT(LogShooterGameMode, Log, "Fleet type: EC2");
|
UE_LOGFMT(LogDS_GameMode, Log, "Fleet type: EC2");
|
||||||
// TODO: EC2 configuration
|
// TODO: EC2 configuration
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
FString AShooterGameMode::GetSHA256Hash(const FString& InString)
|
FString ADS_GameMode::GetSHA256Hash(const FString& InString)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (InString.IsEmpty())
|
if (InString.IsEmpty())
|
||||||
return TEXT("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855");
|
return TEXT("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855");
|
||||||
|
|
||||||
@@ -76,16 +69,16 @@ FString AShooterGameMode::GetSHA256Hash(const FString& InString)
|
|||||||
return Hash.ToString();
|
return Hash.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AShooterGameMode::InitGameLift()
|
void ADS_GameMode::InitGameLift()
|
||||||
{
|
{
|
||||||
#if WITH_GAMELIFT
|
#if WITH_GAMELIFT
|
||||||
UE_LOGFMT(LogShooterGameMode, Log, "Calling InitGameLift...");
|
UE_LOGFMT(LogDS_GameMode, Log, "Calling InitGameLift...");
|
||||||
|
|
||||||
// Get the module first
|
// Get the module first
|
||||||
FGameLiftServerSDKModule* GameLiftSdkModule = &FModuleManager::LoadModuleChecked<FGameLiftServerSDKModule>("GameLiftServerSDK");
|
FGameLiftServerSDKModule* GameLiftSdkModule = &FModuleManager::LoadModuleChecked<FGameLiftServerSDKModule>("GameLiftServerSDK");
|
||||||
FGameLiftGenericOutcome InitSdkOutcome;
|
FGameLiftGenericOutcome InitSdkOutcome;
|
||||||
|
|
||||||
UE_LOGFMT(LogShooterGameMode, Log, "Initializing the GameLift Server...");
|
UE_LOGFMT(LogDS_GameMode, Log, "Initializing the GameLift Server...");
|
||||||
if (GameLiftConfig.bIsAnywhereFleet)
|
if (GameLiftConfig.bIsAnywhereFleet)
|
||||||
{
|
{
|
||||||
// Define the server parameters for an Anywhere fleet. These are not needed for a GameLift managed EC2 fleet.
|
// Define the server parameters for an Anywhere fleet. These are not needed for a GameLift managed EC2 fleet.
|
||||||
@@ -94,7 +87,7 @@ void AShooterGameMode::InitGameLift()
|
|||||||
uint32 PID = FPlatformProcess::GetCurrentProcessId();
|
uint32 PID = FPlatformProcess::GetCurrentProcessId();
|
||||||
FString PIDString = FString::FromInt(static_cast<int32>(PID));
|
FString PIDString = FString::FromInt(static_cast<int32>(PID));
|
||||||
|
|
||||||
UE_LOGFMT(LogShooterGameMode, Log, "Configuring server parameters for Anywhere...");
|
UE_LOGFMT(LogDS_GameMode, Log, "Configuring server parameters for Anywhere...");
|
||||||
// If AnywhereFleets are being used load the command line arguments parsed earlier.
|
// If AnywhereFleets are being used load the command line arguments parsed earlier.
|
||||||
ServerParametersForAnywhere.m_webSocketUrl = TCHAR_TO_UTF8(*GameLiftConfig.WebSocketUrlResult.Value);
|
ServerParametersForAnywhere.m_webSocketUrl = TCHAR_TO_UTF8(*GameLiftConfig.WebSocketUrlResult.Value);
|
||||||
ServerParametersForAnywhere.m_fleetId = TCHAR_TO_UTF8((*GameLiftConfig.FleetIdResult.Value));
|
ServerParametersForAnywhere.m_fleetId = TCHAR_TO_UTF8((*GameLiftConfig.FleetIdResult.Value));
|
||||||
@@ -113,17 +106,17 @@ void AShooterGameMode::InitGameLift()
|
|||||||
|
|
||||||
if (InitSdkOutcome.IsSuccess())
|
if (InitSdkOutcome.IsSuccess())
|
||||||
{
|
{
|
||||||
UE_LOG(LogShooterGameMode, SetColor, TEXT("%s"), COLOR_GREEN);
|
UE_LOG(LogDS_GameMode, SetColor, TEXT("%s"), COLOR_GREEN);
|
||||||
UE_LOG(LogShooterGameMode, Log, TEXT("GameLift InitSDK succeeded!"));
|
UE_LOG(LogDS_GameMode, Log, TEXT("GameLift InitSDK succeeded!"));
|
||||||
UE_LOG(LogShooterGameMode, SetColor, TEXT("%s"), COLOR_NONE);
|
UE_LOG(LogDS_GameMode, SetColor, TEXT("%s"), COLOR_NONE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UE_LOG(LogShooterGameMode, SetColor, TEXT("%s"), COLOR_RED);
|
UE_LOG(LogDS_GameMode, SetColor, TEXT("%s"), COLOR_RED);
|
||||||
UE_LOG(LogShooterGameMode, Log, TEXT("ERROR: InitSDK failed : ("));
|
UE_LOG(LogDS_GameMode, Log, TEXT("ERROR: InitSDK failed : ("));
|
||||||
FGameLiftError GameLiftError = InitSdkOutcome.GetError();
|
FGameLiftError GameLiftError = InitSdkOutcome.GetError();
|
||||||
UE_LOG(LogShooterGameMode, Log, TEXT("ERROR: %s"), *GameLiftError.m_errorMessage);
|
UE_LOG(LogDS_GameMode, Log, TEXT("ERROR: %s"), *GameLiftError.m_errorMessage);
|
||||||
UE_LOG(LogShooterGameMode, SetColor, TEXT("%s"), COLOR_NONE);
|
UE_LOG(LogDS_GameMode, SetColor, TEXT("%s"), COLOR_NONE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,7 +128,7 @@ void AShooterGameMode::InitGameLift()
|
|||||||
ProcessParameters->OnStartGameSession.BindLambda([=](Aws::GameLift::Server::Model::GameSession InGameSession)
|
ProcessParameters->OnStartGameSession.BindLambda([=](Aws::GameLift::Server::Model::GameSession InGameSession)
|
||||||
{
|
{
|
||||||
const FString GameSessionId = FString(InGameSession.GetGameSessionId());
|
const FString GameSessionId = FString(InGameSession.GetGameSessionId());
|
||||||
UE_LOG(LogShooterGameMode, Log, TEXT("GameSession Initializing: %s"), *GameSessionId);
|
UE_LOG(LogDS_GameMode, Log, TEXT("GameSession Initializing: %s"), *GameSessionId);
|
||||||
GameLiftSdkModule->ActivateGameSession();
|
GameLiftSdkModule->ActivateGameSession();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -144,24 +137,24 @@ void AShooterGameMode::InitGameLift()
|
|||||||
//In this case, we simply tell Amazon GameLift Servers we are indeed going to shut down.
|
//In this case, we simply tell Amazon GameLift Servers we are indeed going to shut down.
|
||||||
ProcessParameters->OnTerminate.BindLambda([=]()
|
ProcessParameters->OnTerminate.BindLambda([=]()
|
||||||
{
|
{
|
||||||
UE_LOG(LogShooterGameMode, Log, TEXT("Game Server Process is terminating"));
|
UE_LOG(LogDS_GameMode, Log, TEXT("Game Server Process is terminating"));
|
||||||
// First call ProcessEnding()
|
// First call ProcessEnding()
|
||||||
FGameLiftGenericOutcome processEndingOutcome = GameLiftSdkModule->ProcessEnding();
|
FGameLiftGenericOutcome processEndingOutcome = GameLiftSdkModule->ProcessEnding();
|
||||||
// Then call Destroy() to free the SDK from memory
|
// Then call Destroy() to free the SDK from memory
|
||||||
FGameLiftGenericOutcome destroyOutcome = GameLiftSdkModule->Destroy();
|
FGameLiftGenericOutcome destroyOutcome = GameLiftSdkModule->Destroy();
|
||||||
// Exit the process with success or failure
|
// Exit the process with success or failure
|
||||||
if (processEndingOutcome.IsSuccess() && destroyOutcome.IsSuccess()) {
|
if (processEndingOutcome.IsSuccess() && destroyOutcome.IsSuccess()) {
|
||||||
UE_LOG(LogShooterGameMode, Log, TEXT("Server process ending successfully"));
|
UE_LOG(LogDS_GameMode, Log, TEXT("Server process ending successfully"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!processEndingOutcome.IsSuccess()) {
|
if (!processEndingOutcome.IsSuccess()) {
|
||||||
const FGameLiftError& error = processEndingOutcome.GetError();
|
const FGameLiftError& error = processEndingOutcome.GetError();
|
||||||
UE_LOG(LogShooterGameMode, Error, TEXT("ProcessEnding() failed. Error: %s"),
|
UE_LOG(LogDS_GameMode, Error, TEXT("ProcessEnding() failed. Error: %s"),
|
||||||
error.m_errorMessage.IsEmpty() ? TEXT("Unknown error") : *error.m_errorMessage);
|
error.m_errorMessage.IsEmpty() ? TEXT("Unknown error") : *error.m_errorMessage);
|
||||||
}
|
}
|
||||||
if (!destroyOutcome.IsSuccess()) {
|
if (!destroyOutcome.IsSuccess()) {
|
||||||
const FGameLiftError& error = destroyOutcome.GetError();
|
const FGameLiftError& error = destroyOutcome.GetError();
|
||||||
UE_LOG(LogShooterGameMode, Error, TEXT("Destroy() failed. Error: %s"),
|
UE_LOG(LogDS_GameMode, Error, TEXT("Destroy() failed. Error: %s"),
|
||||||
error.m_errorMessage.IsEmpty() ? TEXT("Unknown error") : *error.m_errorMessage);
|
error.m_errorMessage.IsEmpty() ? TEXT("Unknown error") : *error.m_errorMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -177,7 +170,7 @@ void AShooterGameMode::InitGameLift()
|
|||||||
//In this case, we're always healthy!
|
//In this case, we're always healthy!
|
||||||
ProcessParameters->OnHealthCheck.BindLambda([]()
|
ProcessParameters->OnHealthCheck.BindLambda([]()
|
||||||
{
|
{
|
||||||
UE_LOG(LogShooterGameMode, Log, TEXT("Performing Health Check"));
|
UE_LOG(LogDS_GameMode, Log, TEXT("Performing Health Check"));
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -187,31 +180,31 @@ void AShooterGameMode::InitGameLift()
|
|||||||
Logfiles.Add(TEXT("FPSTemplate/Saved/Log/server.log"));
|
Logfiles.Add(TEXT("FPSTemplate/Saved/Log/server.log"));
|
||||||
ProcessParameters->logParameters = Logfiles;
|
ProcessParameters->logParameters = Logfiles;
|
||||||
|
|
||||||
UE_LOGFMT(LogShooterGameMode, Log, "Calling Process Ready...");
|
UE_LOGFMT(LogDS_GameMode, Log, "Calling Process Ready...");
|
||||||
FGameLiftGenericOutcome ProcessReadyOutcome = GameLiftSdkModule->ProcessReady(*ProcessParameters);
|
FGameLiftGenericOutcome ProcessReadyOutcome = GameLiftSdkModule->ProcessReady(*ProcessParameters);
|
||||||
|
|
||||||
if (ProcessReadyOutcome.IsSuccess())
|
if (ProcessReadyOutcome.IsSuccess())
|
||||||
{
|
{
|
||||||
UE_LOG(LogShooterGameMode, SetColor, TEXT("%s"), COLOR_GREEN);
|
UE_LOG(LogDS_GameMode, SetColor, TEXT("%s"), COLOR_GREEN);
|
||||||
UE_LOG(LogShooterGameMode, Log, TEXT("Process Ready!"));
|
UE_LOG(LogDS_GameMode, Log, TEXT("Process Ready!"));
|
||||||
UE_LOG(LogShooterGameMode, SetColor, TEXT("%s"), COLOR_NONE);
|
UE_LOG(LogDS_GameMode, SetColor, TEXT("%s"), COLOR_NONE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UE_LOG(LogShooterGameMode, SetColor, TEXT("%s"), COLOR_RED);
|
UE_LOG(LogDS_GameMode, SetColor, TEXT("%s"), COLOR_RED);
|
||||||
UE_LOG(LogShooterGameMode, Log, TEXT("ERROR: Process Ready Failed!"));
|
UE_LOG(LogDS_GameMode, Log, TEXT("ERROR: Process Ready Failed!"));
|
||||||
FGameLiftError ProcessReadyError = ProcessReadyOutcome.GetError();
|
FGameLiftError ProcessReadyError = ProcessReadyOutcome.GetError();
|
||||||
UE_LOG(LogShooterGameMode, Log, TEXT("ERROR: %s"), *ProcessReadyError.m_errorMessage);
|
UE_LOG(LogDS_GameMode, Log, TEXT("ERROR: %s"), *ProcessReadyError.m_errorMessage);
|
||||||
UE_LOG(LogShooterGameMode, SetColor, TEXT("%s"), COLOR_NONE);
|
UE_LOG(LogDS_GameMode, SetColor, TEXT("%s"), COLOR_NONE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UE_LOGFMT(LogShooterGameMode, Log, "InitGameLift completed!");
|
UE_LOGFMT(LogDS_GameMode, Log, "InitGameLift completed!");
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AShooterGameMode::GetAnywhereFleetParameters(const FString& CommandLineString)
|
bool ADS_GameMode::GetAnywhereFleetParameters(const FString& CommandLineString)
|
||||||
{
|
{
|
||||||
bool bAllAnywhereFleetParametersValid = true;
|
bool bAllAnywhereFleetParametersValid = true;
|
||||||
GameLiftConfig.AuthTokenResult = cmdlineparser::GetValueOfToken(CommandLineString, cmdlineparser::details::EAvailableTokens::AuthToken);
|
GameLiftConfig.AuthTokenResult = cmdlineparser::GetValueOfToken(CommandLineString, cmdlineparser::details::EAvailableTokens::AuthToken);
|
||||||
@@ -229,23 +222,23 @@ bool AShooterGameMode::GetAnywhereFleetParameters(const FString& CommandLineStri
|
|||||||
return bAllAnywhereFleetParametersValid;
|
return bAllAnywhereFleetParametersValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AShooterGameMode::LogAnywhereFleetParameters()
|
void ADS_GameMode::LogAnywhereFleetParameters()
|
||||||
{
|
{
|
||||||
// Lambda for getting the token name from token
|
// Lambda for getting the token name from token
|
||||||
auto GetTokenName = [](const cmdlineparser::details::FParseResult& Result) -> FString
|
auto GetTokenName = [](const cmdlineparser::details::FParseResult& Result) -> FString
|
||||||
{
|
{
|
||||||
return cmdlineparser::details::CLI_TOKENS[static_cast<int32>(Result.Token)];
|
return cmdlineparser::details::CLI_TOKENS[static_cast<int32>(Result.Token)];
|
||||||
};
|
};
|
||||||
|
|
||||||
UE_LOGFMT(LogShooterGameMode, Log, "Anywhere Fleet Parameters:");
|
UE_LOGFMT(LogDS_GameMode, Log, "Anywhere Fleet Parameters:");
|
||||||
if (GameLiftConfig.AuthTokenResult.bIsValid)
|
if (GameLiftConfig.AuthTokenResult.bIsValid)
|
||||||
{
|
{
|
||||||
UE_LOGFMT(LogShooterGameMode, Log, "AuthToken: {0}", GetValueOrHash(GameLiftConfig.AuthTokenResult.Value));
|
UE_LOGFMT(LogDS_GameMode, Log, "AuthToken: {0}", GetValueOrHash(GameLiftConfig.AuthTokenResult.Value));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UE_LOGFMT(
|
UE_LOGFMT(
|
||||||
LogShooterGameMode,
|
LogDS_GameMode,
|
||||||
Error,
|
Error,
|
||||||
"AuthToken: {0}",
|
"AuthToken: {0}",
|
||||||
FString::Format(
|
FString::Format(
|
||||||
@@ -260,12 +253,12 @@ void AShooterGameMode::LogAnywhereFleetParameters()
|
|||||||
|
|
||||||
if (GameLiftConfig.FleetIdResult.bIsValid)
|
if (GameLiftConfig.FleetIdResult.bIsValid)
|
||||||
{
|
{
|
||||||
UE_LOGFMT(LogShooterGameMode, Log, "FleetId: {0}", GameLiftConfig.FleetIdResult.Value);
|
UE_LOGFMT(LogDS_GameMode, Log, "FleetId: {0}", GameLiftConfig.FleetIdResult.Value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UE_LOGFMT(
|
UE_LOGFMT(
|
||||||
LogShooterGameMode,
|
LogDS_GameMode,
|
||||||
Error,
|
Error,
|
||||||
"FleetId: {0}",
|
"FleetId: {0}",
|
||||||
FString::Format(
|
FString::Format(
|
||||||
@@ -280,12 +273,12 @@ void AShooterGameMode::LogAnywhereFleetParameters()
|
|||||||
|
|
||||||
if (GameLiftConfig.HostIdResult.bIsValid)
|
if (GameLiftConfig.HostIdResult.bIsValid)
|
||||||
{
|
{
|
||||||
UE_LOGFMT(LogShooterGameMode, Log, "HostId: {0}", GameLiftConfig.HostIdResult.Value);
|
UE_LOGFMT(LogDS_GameMode, Log, "HostId: {0}", GameLiftConfig.HostIdResult.Value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UE_LOGFMT(
|
UE_LOGFMT(
|
||||||
LogShooterGameMode,
|
LogDS_GameMode,
|
||||||
Error,
|
Error,
|
||||||
"HostId: {0}",
|
"HostId: {0}",
|
||||||
FString::Format(
|
FString::Format(
|
||||||
@@ -300,12 +293,12 @@ void AShooterGameMode::LogAnywhereFleetParameters()
|
|||||||
|
|
||||||
if (GameLiftConfig.WebSocketUrlResult.bIsValid)
|
if (GameLiftConfig.WebSocketUrlResult.bIsValid)
|
||||||
{
|
{
|
||||||
UE_LOGFMT(LogShooterGameMode, Log, "WebSocketUrl: {0}", GameLiftConfig.WebSocketUrlResult.Value);
|
UE_LOGFMT(LogDS_GameMode, Log, "WebSocketUrl: {0}", GameLiftConfig.WebSocketUrlResult.Value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UE_LOGFMT(
|
UE_LOGFMT(
|
||||||
LogShooterGameMode,
|
LogDS_GameMode,
|
||||||
Error,
|
Error,
|
||||||
"WebSocketUrl: {0}",
|
"WebSocketUrl: {0}",
|
||||||
FString::Format(
|
FString::Format(
|
||||||
@@ -318,49 +311,50 @@ void AShooterGameMode::LogAnywhereFleetParameters()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
UE_LOGFMT(LogShooterGameMode, Log, "Server Port: {0}", GameLiftConfig.ServerPort);
|
UE_LOGFMT(LogDS_GameMode, Log, "Server Port: {0}", GameLiftConfig.ServerPort);
|
||||||
|
|
||||||
if (GameLiftConfig.bAllOptionsFound)
|
if (GameLiftConfig.bAllOptionsFound)
|
||||||
{
|
{
|
||||||
UE_LOGFMT(LogShooterGameMode, Log, "Anywhere Fleet Parameters Loaded Successfully....");
|
UE_LOGFMT(LogDS_GameMode, Log, "Anywhere Fleet Parameters Loaded Successfully....");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UE_LOGFMT(LogShooterGameMode, Error, "Anywhere Fleet Parameters Load FAILED....");
|
UE_LOGFMT(LogDS_GameMode, Error, "Anywhere Fleet Parameters Load FAILED....");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AShooterGameMode::LogServerParameters(const FServerParameters& InServerParameters)
|
void ADS_GameMode::LogServerParameters(const FServerParameters& InServerParameters)
|
||||||
{
|
{
|
||||||
|
#if WITH_GAMELIFT
|
||||||
UE_LOGFMT(LogShooterGameMode, Log, ">>>> WebSocket URL: {WebSocketUrl}", InServerParameters.m_webSocketUrl);
|
UE_LOGFMT(LogDS_GameMode, Log, ">>>> WebSocket URL: {WebSocketUrl}", InServerParameters.m_webSocketUrl);
|
||||||
UE_LOGFMT(LogShooterGameMode, Log, ">>>> Fleet ID: {FleetId}", InServerParameters.m_fleetId);
|
UE_LOGFMT(LogDS_GameMode, Log, ">>>> Fleet ID: {FleetId}", InServerParameters.m_fleetId);
|
||||||
UE_LOGFMT(LogShooterGameMode, Log, ">>>> Process ID: {ProcessId}", InServerParameters.m_processId);
|
UE_LOGFMT(LogDS_GameMode, Log, ">>>> Process ID: {ProcessId}", InServerParameters.m_processId);
|
||||||
UE_LOGFMT(LogShooterGameMode, Log, ">>>> Host ID (Compute Name): {HostId}", InServerParameters.m_hostId);
|
UE_LOGFMT(LogDS_GameMode, Log, ">>>> Host ID (Compute Name): {HostId}", InServerParameters.m_hostId);
|
||||||
UE_LOGFMT(LogShooterGameMode, Log, ">>>> Auth Token: {AuthToken}", GetValueOrHash(InServerParameters.m_authToken));
|
UE_LOGFMT(LogDS_GameMode, Log, ">>>> Auth Token: {AuthToken}", GetValueOrHash(InServerParameters.m_authToken));
|
||||||
|
|
||||||
if (!InServerParameters.m_awsRegion.IsEmpty())
|
if (!InServerParameters.m_awsRegion.IsEmpty())
|
||||||
{
|
{
|
||||||
UE_LOGFMT(LogShooterGameMode, Log, ">>>> Aws Region: {AwsRegion}", InServerParameters.m_awsRegion);
|
UE_LOGFMT(LogDS_GameMode, Log, ">>>> Aws Region: {AwsRegion}", InServerParameters.m_awsRegion);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!InServerParameters.m_accessKey.IsEmpty())
|
if (!InServerParameters.m_accessKey.IsEmpty())
|
||||||
{
|
{
|
||||||
UE_LOGFMT(LogShooterGameMode, Log, ">>>> Access Key: {AccessKey}", GetValueOrHash(InServerParameters.m_accessKey));
|
UE_LOGFMT(LogDS_GameMode, Log, ">>>> Access Key: {AccessKey}", GetValueOrHash(InServerParameters.m_accessKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!InServerParameters.m_secretKey.IsEmpty())
|
if (!InServerParameters.m_secretKey.IsEmpty())
|
||||||
{
|
{
|
||||||
UE_LOGFMT(LogShooterGameMode, Log, ">>>> Secret Key: {SecretKey}", GetValueOrHash(InServerParameters.m_secretKey));
|
UE_LOGFMT(LogDS_GameMode, Log, ">>>> Secret Key: {SecretKey}", GetValueOrHash(InServerParameters.m_secretKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!InServerParameters.m_sessionToken.IsEmpty())
|
if (!InServerParameters.m_sessionToken.IsEmpty())
|
||||||
{
|
{
|
||||||
UE_LOGFMT(LogShooterGameMode, Log, ">>>> Session Token: {SessionToken}", GetValueOrHash(InServerParameters.m_sessionToken));
|
UE_LOGFMT(LogDS_GameMode, Log, ">>>> Session Token: {SessionToken}", GetValueOrHash(InServerParameters.m_sessionToken));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
FString AShooterGameMode::GetValueOrHash(const FString& Value)
|
FString ADS_GameMode::GetValueOrHash(const FString& Value)
|
||||||
{
|
{
|
||||||
#if UE_BUILD_DEBUG || UE_BUILD_DEVELOPMENT
|
#if UE_BUILD_DEBUG || UE_BUILD_DEVELOPMENT
|
||||||
return Value;
|
return Value;
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#include "GameplayTags/DedicatedServersTags.h"
|
||||||
|
|
||||||
|
namespace DedicatedServersTags
|
||||||
|
{
|
||||||
|
namespace GameSessionsAPI
|
||||||
|
{
|
||||||
|
UE_DEFINE_GAMEPLAY_TAG_COMMENT(ListFleets, "DedicatedServersTags.GameSessionsAPI.ListFleets", "List Fleets resource on the Game Session Resource")
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "UI/API/GameSessions/JoinGame.h"
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "UI/API/ListFleets/FleetId.h"
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "UI/API/ListFleets/ListFleetsBox.h"
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "UI/API_Test/APITestManager.h"
|
||||||
|
#include "HttpModule.h"
|
||||||
|
#include "JsonObjectConverter.h"
|
||||||
|
#include "Data/API/APIData.h"
|
||||||
|
#include "DedicatedServers/DedicatedServers.h"
|
||||||
|
#include "GameplayTags/DedicatedServersTags.h"
|
||||||
|
#include "Interfaces/IHttpResponse.h"
|
||||||
|
#include "UI/HTTP/HTTPRequestTypes.h"
|
||||||
|
|
||||||
|
void UAPITestManager::ListFleets()
|
||||||
|
{
|
||||||
|
check(APIData);
|
||||||
|
TSharedRef<IHttpRequest> Request = FHttpModule::Get().CreateRequest();
|
||||||
|
Request->OnProcessRequestComplete().BindUObject(this, &UAPITestManager::ListFleets_Response);
|
||||||
|
const FString APIUrl = APIData->GetAPIEndpoint(DedicatedServersTags::GameSessionsAPI::ListFleets);
|
||||||
|
Request->SetURL(APIUrl);
|
||||||
|
Request->SetVerb(TEXT("GET"));
|
||||||
|
Request->SetHeader(TEXT("Content-Type"), TEXT("application/json"));
|
||||||
|
Request->ProcessRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UAPITestManager::ListFleets_Response(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)
|
||||||
|
{
|
||||||
|
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, "List Fleets Response Received");
|
||||||
|
|
||||||
|
TSharedPtr<FJsonObject> JsonObject;
|
||||||
|
TSharedRef<TJsonReader<>> JsonReader = TJsonReaderFactory<>::Create(Response->GetContentAsString());
|
||||||
|
|
||||||
|
if (FJsonSerializer::Deserialize(JsonReader, JsonObject))
|
||||||
|
{
|
||||||
|
const TSharedPtr<FJsonObject>* ErrorObjPtr = nullptr;;
|
||||||
|
|
||||||
|
if (ContainsErrors(JsonObject, false))
|
||||||
|
{
|
||||||
|
OnListFleetsResponseReceived.Broadcast(FDS_ListFleetsResponse(), false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
DumpMetaData(JsonObject);
|
||||||
|
|
||||||
|
FDS_ListFleetsResponse ListFleetsResponse;
|
||||||
|
FJsonObjectConverter::JsonObjectToUStruct(JsonObject.ToSharedRef(), &ListFleetsResponse);
|
||||||
|
ListFleetsResponse.Dump();
|
||||||
|
OnListFleetsResponseReceived.Broadcast(ListFleetsResponse, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#include "UI/API_Test/APITestOverlay.h"
|
||||||
|
#include "UI/API_Test/APITestManager.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "Components/Button.h"
|
||||||
|
#include "Components/ScrollBox.h"
|
||||||
|
#include "Components/TextBlock.h"
|
||||||
|
#include "UI/API/ListFleets/FleetId.h"
|
||||||
|
#include "UI/API/ListFleets/ListFleetsBox.h"
|
||||||
|
#include "UI/HTTP/HTTPRequestTypes.h"
|
||||||
|
|
||||||
|
|
||||||
|
void UAPITestOverlay::NativeConstruct()
|
||||||
|
{
|
||||||
|
Super::NativeConstruct();
|
||||||
|
|
||||||
|
check(APITestManagerClass);
|
||||||
|
APITestManager = NewObject<UAPITestManager>(this, APITestManagerClass);
|
||||||
|
|
||||||
|
check (ListFleetsBox)
|
||||||
|
check (ListFleetsBox->Button_ListFleets)
|
||||||
|
ListFleetsBox->Button_ListFleets->OnClicked.AddDynamic(this, &UAPITestOverlay::ListFleetsButtonClicked);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UAPITestOverlay::ListFleetsButtonClicked()
|
||||||
|
{
|
||||||
|
check(APITestManager);
|
||||||
|
APITestManager->OnListFleetsResponseReceived.AddDynamic(this, &UAPITestOverlay::OnListFleetsResponseReceived);
|
||||||
|
APITestManager->ListFleets();
|
||||||
|
|
||||||
|
ListFleetsBox->Button_ListFleets->SetIsEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UAPITestOverlay::OnListFleetsResponseReceived(const FDS_ListFleetsResponse& ListFleetResponse, bool bWasSuccessful)
|
||||||
|
{
|
||||||
|
if (APITestManager->OnListFleetsResponseReceived.IsAlreadyBound(this, &UAPITestOverlay::OnListFleetsResponseReceived))
|
||||||
|
{
|
||||||
|
APITestManager->OnListFleetsResponseReceived.RemoveDynamic(this, &UAPITestOverlay::OnListFleetsResponseReceived);
|
||||||
|
}
|
||||||
|
check(FleetIdWidgetClass);
|
||||||
|
ListFleetsBox->ScrollBox_ListFleets->ClearChildren();
|
||||||
|
if (bWasSuccessful)
|
||||||
|
{
|
||||||
|
for (const FString& FleetId : ListFleetResponse.FleetIds)
|
||||||
|
{
|
||||||
|
UFleetId* FleetIdWidget = CreateWidget<UFleetId>(this, FleetIdWidgetClass);
|
||||||
|
FleetIdWidget->TextBlock_FleetId->SetText(FText::FromString(FleetId));
|
||||||
|
ListFleetsBox->ScrollBox_ListFleets->AddChild(FleetIdWidget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UFleetId* FleetIdWidget = CreateWidget<UFleetId>(this, FleetIdWidgetClass);
|
||||||
|
FleetIdWidget->TextBlock_FleetId->SetText(FText::FromString("Something went wrong!"));
|
||||||
|
ListFleetsBox->ScrollBox_ListFleets->AddChild(FleetIdWidget);
|
||||||
|
}
|
||||||
|
ListFleetsBox->Button_ListFleets->SetIsEnabled(true);
|
||||||
|
}
|
||||||
17
Source/DedicatedServers/Private/UI/API_Test/API_TestHUD.cpp
Normal file
17
Source/DedicatedServers/Private/UI/API_Test/API_TestHUD.cpp
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "UI/API_Test/API_TestHUD.h"
|
||||||
|
#include "UI/API_Test/APITestOverlay.h"
|
||||||
|
|
||||||
|
void AAPI_TestHUD::BeginPlay()
|
||||||
|
{
|
||||||
|
Super::BeginPlay();
|
||||||
|
|
||||||
|
APlayerController* PlayerController = GetOwningPlayerController();
|
||||||
|
if (IsValid(PlayerController) && APITestOverlayClass)
|
||||||
|
{
|
||||||
|
APITestOverlay = CreateWidget<UAPITestOverlay>(PlayerController, APITestOverlayClass);
|
||||||
|
APITestOverlay->AddToViewport();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "UI/HTTP/HTTPRequestManager.h"
|
||||||
|
|
||||||
|
#include "HTTPRequestTypes.h"
|
||||||
|
#include "JsonObjectConverter.h"
|
||||||
|
#include "DedicatedServers/DedicatedServers.h"
|
||||||
|
|
||||||
|
bool UHTTPRequestManager::ContainsErrors(TSharedPtr<FJsonObject> JsonObject, bool bSuppressLog)
|
||||||
|
{
|
||||||
|
if (JsonObject->HasField(TEXT("errorType")) || JsonObject->HasField(TEXT("errorMessage")))
|
||||||
|
{
|
||||||
|
if (!bSuppressLog)
|
||||||
|
{
|
||||||
|
FString ErrorType = JsonObject->HasField(TEXT("errorType")) ? JsonObject->GetStringField(TEXT("errorType")) : TEXT("Unknown Error");
|
||||||
|
FString ErrorMessage = JsonObject->HasField(TEXT("errorMessage")) ? JsonObject->GetStringField(TEXT("errorMessage")) : TEXT("Unknown Error Message");
|
||||||
|
|
||||||
|
UE_LOGFMT(LogDedicatedServers, Error, "Error Type: {ErrorType}", ErrorType);
|
||||||
|
UE_LOGFMT(LogDedicatedServers, Error, "Error Message: {ErrorMessage}", ErrorMessage);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (JsonObject->HasField(TEXT("$fault")))
|
||||||
|
{
|
||||||
|
if (!bSuppressLog)
|
||||||
|
{
|
||||||
|
FString ErrorType = JsonObject->HasField(TEXT("name")) ? JsonObject->GetStringField(TEXT("name")) : TEXT("Unknown Error");
|
||||||
|
UE_LOGFMT(LogDedicatedServers, Error, "Error Type: {ErrorType}", ErrorType);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UHTTPRequestManager::DumpMetaData(TSharedPtr<FJsonObject> JsonObject)
|
||||||
|
{
|
||||||
|
if (JsonObject->HasField(TEXT("$metadata")))
|
||||||
|
{
|
||||||
|
TSharedPtr<FJsonObject> MetaDataJsonObject = JsonObject->GetObjectField(TEXT("$metadata"));
|
||||||
|
FDS_MetaData DSMetaData;
|
||||||
|
FJsonObjectConverter::JsonObjectToUStruct(MetaDataJsonObject.ToSharedRef(), &DSMetaData);
|
||||||
|
DSMetaData.Dump();
|
||||||
|
}
|
||||||
|
}
|
||||||
24
Source/DedicatedServers/Private/UI/HTTP/HTTPRequestTypes.cpp
Normal file
24
Source/DedicatedServers/Private/UI/HTTP/HTTPRequestTypes.cpp
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#include "UI/HTTP/HTTPRequestTypes.h"
|
||||||
|
#include "DedicatedServers/DedicatedServers.h"
|
||||||
|
|
||||||
|
void FDS_MetaData::Dump() const
|
||||||
|
{
|
||||||
|
UE_LOGFMT(LogDedicatedServers, Log, "MetaData:");
|
||||||
|
UE_LOGFMT(LogDedicatedServers, Log, "httpStatusCode: {httpStatusCode}", httpStatusCode);
|
||||||
|
UE_LOGFMT(LogDedicatedServers, Log, "requestId: {requestId}", requestId);
|
||||||
|
UE_LOGFMT(LogDedicatedServers, Log, "attemps: {attempts}", attempts);
|
||||||
|
UE_LOGFMT(LogDedicatedServers, Log, "totalRetryDelay: {totalRetryDelay}", totalRetryDelay);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FDS_ListFleetsResponse::Dump() const
|
||||||
|
{
|
||||||
|
UE_LOGFMT(LogDedicatedServers, Log, "ListFleetsResponse:");
|
||||||
|
for (const FString& FleetId : FleetIds)
|
||||||
|
{
|
||||||
|
UE_LOGFMT(LogDedicatedServers, Log, "FleetId: {FleetId}", FleetId);
|
||||||
|
}
|
||||||
|
if (!NextToken.IsEmpty())
|
||||||
|
{
|
||||||
|
UE_LOGFMT(LogDedicatedServers, Log, "NextToken: {NextToken}", NextToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
43
Source/DedicatedServers/Private/UI/HTTP/HTTPRequestTypes.h
Normal file
43
Source/DedicatedServers/Private/UI/HTTP/HTTPRequestTypes.h
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
// Because this is in the private section is is still usable by the DedicatedServer Module, but not outside of the module.
|
||||||
|
|
||||||
|
#include "HTTPRequestTypes.generated.h"
|
||||||
|
|
||||||
|
USTRUCT()
|
||||||
|
struct FDS_MetaData
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
|
int32 httpStatusCode{};
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
|
FString requestId{};
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
|
int32 attempts{};
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
|
double totalRetryDelay{};
|
||||||
|
|
||||||
|
void Dump() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
USTRUCT()
|
||||||
|
struct FDS_ListFleetsResponse
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
|
TArray<FString> FleetIds{};
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
|
FString NextToken{};
|
||||||
|
|
||||||
|
void Dump() const;
|
||||||
|
};
|
||||||
23
Source/DedicatedServers/Private/UI/Portal/PortalHUD.cpp
Normal file
23
Source/DedicatedServers/Private/UI/Portal/PortalHUD.cpp
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "UI/Portal/PortalHUD.h"
|
||||||
|
#include "UI/Portal/SignIn/SignInOverlay.h"
|
||||||
|
#include "Blueprint/UserWidget.h"
|
||||||
|
|
||||||
|
void APortalHUD::BeginPlay()
|
||||||
|
{
|
||||||
|
Super::BeginPlay();
|
||||||
|
|
||||||
|
APlayerController* OwningPlayerController = GetOwningPlayerController();
|
||||||
|
SignInOverlay = CreateWidget<USignInOverlay>(OwningPlayerController, SignInOverlayClass);
|
||||||
|
if (IsValid(SignInOverlay))
|
||||||
|
{
|
||||||
|
SignInOverlay->AddToViewport();
|
||||||
|
}
|
||||||
|
|
||||||
|
const FInputModeGameAndUI InputModeData;
|
||||||
|
OwningPlayerController->SetInputMode(InputModeData);
|
||||||
|
OwningPlayerController->SetShowMouseCursor(true);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "UI/Portal/PortalManager.h"
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "UI/Portal/SignIn/SignInOverlay.h"
|
||||||
|
|
||||||
|
#include "UI/Portal/PortalManager.h"
|
||||||
|
|
||||||
|
void USignInOverlay::NativeConstruct()
|
||||||
|
{
|
||||||
|
Super::NativeConstruct();
|
||||||
|
check(PortalManagerClass);
|
||||||
|
|
||||||
|
PortalManager = NewObject<UPortalManager>(PortalManagerClass);
|
||||||
|
}
|
||||||
38
Source/DedicatedServers/Public/Data/API/APIData.h
Normal file
38
Source/DedicatedServers/Public/Data/API/APIData.h
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "Engine/DataAsset.h"
|
||||||
|
#include "GameplayTags/DedicatedServersTags.h"
|
||||||
|
#include "APIData.generated.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class DEDICATEDSERVERS_API UAPIData : public UDataAsset
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
FString GetAPIEndpoint(const FGameplayTag& APIEndpoint);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Name of the API - for labeling in the Data Asset; this is not used by any code.
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere)
|
||||||
|
FString Name;
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly)
|
||||||
|
FString InvokeUrl;
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly)
|
||||||
|
FString Stage;
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly)
|
||||||
|
TMap<FGameplayTag, FString> Resources;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
@@ -3,11 +3,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "GameLiftClpTypes.h"
|
#include "DedicatedServers/Public/GameLiftClpTypes.h"
|
||||||
#include "ShooterGameModeBase.h"
|
#include "GameFramework/GameMode.h"
|
||||||
#include "ShooterGameMode.generated.h"
|
#include "DS_GameMode.generated.h"
|
||||||
|
|
||||||
DECLARE_LOG_CATEGORY_EXTERN(LogShooterGameMode, Log, All);
|
DECLARE_LOG_CATEGORY_EXTERN(LogDS_GameMode, Log, All);
|
||||||
|
|
||||||
struct FProcessParameters;
|
struct FProcessParameters;
|
||||||
struct FServerParameters;
|
struct FServerParameters;
|
||||||
@@ -25,16 +25,11 @@ struct FGameLiftConfig
|
|||||||
cmdlineparser::details::FParseResult WebSocketUrlResult;
|
cmdlineparser::details::FParseResult WebSocketUrlResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class FPSTEMPLATE_API AShooterGameMode : public AShooterGameModeBase
|
class DEDICATEDSERVERS_API ADS_GameMode : public AGameMode
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
public:
|
|
||||||
|
|
||||||
AShooterGameMode();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
||||||
@@ -43,14 +38,13 @@ protected:
|
|||||||
private:
|
private:
|
||||||
FGameLiftConfig GameLiftConfig;
|
FGameLiftConfig GameLiftConfig;
|
||||||
FString CachedCommandLine;
|
FString CachedCommandLine;
|
||||||
|
TSharedPtr<FProcessParameters> ProcessParameters;
|
||||||
|
|
||||||
static FString GetSHA256Hash(const FString& CommandLineString);
|
static FString GetSHA256Hash(const FString& InString);
|
||||||
void InitGameLift();
|
void InitGameLift();
|
||||||
|
|
||||||
bool GetAnywhereFleetParameters(const FString& CommandLineString);
|
bool GetAnywhereFleetParameters(const FString& CommandLineString);
|
||||||
void LogAnywhereFleetParameters();
|
void LogAnywhereFleetParameters();
|
||||||
static void LogServerParameters(const FServerParameters& InServerParameters);
|
static void LogServerParameters(const FServerParameters& InServerParameters);
|
||||||
static FString GetValueOrHash(const FString& Value);
|
static FString GetValueOrHash(const FString& Value);
|
||||||
|
|
||||||
TSharedPtr<FProcessParameters> ProcessParameters;
|
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "NativeGameplayTags.h"
|
||||||
|
|
||||||
|
namespace DedicatedServersTags
|
||||||
|
{
|
||||||
|
namespace GameSessionsAPI
|
||||||
|
{
|
||||||
|
UE_DECLARE_GAMEPLAY_TAG_EXTERN(ListFleets)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "Blueprint/UserWidget.h"
|
||||||
|
#include "JoinGame.generated.h"
|
||||||
|
|
||||||
|
class UButton;
|
||||||
|
class UTextBlock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class DEDICATEDSERVERS_API UJoinGame : public UUserWidget
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
UPROPERTY(meta = (BindWidget))
|
||||||
|
TObjectPtr<UButton> Button_JoinGame;
|
||||||
|
|
||||||
|
UPROPERTY(meta = (BindWidget))
|
||||||
|
TObjectPtr<UTextBlock> TextBlock_StatusMessage;
|
||||||
|
};
|
||||||
23
Source/DedicatedServers/Public/UI/API/ListFleets/FleetId.h
Normal file
23
Source/DedicatedServers/Public/UI/API/ListFleets/FleetId.h
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "Blueprint/UserWidget.h"
|
||||||
|
#include "FleetId.generated.h"
|
||||||
|
|
||||||
|
class UTextBlock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class DEDICATEDSERVERS_API UFleetId : public UUserWidget
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
UPROPERTY(meta = (BindWidget), BlueprintReadWrite)
|
||||||
|
TObjectPtr<UTextBlock> TextBlock_FleetId;
|
||||||
|
};
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "Blueprint/UserWidget.h"
|
||||||
|
#include "ListFleetsBox.generated.h"
|
||||||
|
|
||||||
|
class UButton;
|
||||||
|
class UScrollBox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class DEDICATEDSERVERS_API UListFleetsBox : public UUserWidget
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
UPROPERTY(meta = (BindWidget))
|
||||||
|
TObjectPtr<UScrollBox> ScrollBox_ListFleets;
|
||||||
|
|
||||||
|
UPROPERTY(meta = (BindWidget))
|
||||||
|
TObjectPtr<UButton> Button_ListFleets;
|
||||||
|
};
|
||||||
29
Source/DedicatedServers/Public/UI/API_Test/APITestManager.h
Normal file
29
Source/DedicatedServers/Public/UI/API_Test/APITestManager.h
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "Interfaces/IHttpRequest.h"
|
||||||
|
#include "UI/HTTP/HTTPRequestManager.h"
|
||||||
|
#include "APITestManager.generated.h"
|
||||||
|
|
||||||
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnListFleetsResponseReceived, const FDS_ListFleetsResponse&, ListFleetResponse, bool, bWasSuccessful);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class DEDICATEDSERVERS_API UAPITestManager : public UHTTPRequestManager
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
UFUNCTION()
|
||||||
|
void ListFleets();
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
|
FOnListFleetsResponseReceived OnListFleetsResponseReceived;
|
||||||
|
|
||||||
|
void ListFleets_Response(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful);
|
||||||
|
};
|
||||||
50
Source/DedicatedServers/Public/UI/API_Test/APITestOverlay.h
Normal file
50
Source/DedicatedServers/Public/UI/API_Test/APITestOverlay.h
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "Blueprint/UserWidget.h"
|
||||||
|
#include "APITestOverlay.generated.h"
|
||||||
|
|
||||||
|
class UAPITestManager;
|
||||||
|
class UListFleetsBox;
|
||||||
|
struct FDS_ListFleetsResponse;
|
||||||
|
class UFleetId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class DEDICATEDSERVERS_API UAPITestOverlay : public UUserWidget
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly)
|
||||||
|
TSubclassOf<UAPITestManager> APITestManagerClass;
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly)
|
||||||
|
TSubclassOf<UFleetId> FleetIdWidgetClass;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void NativeConstruct() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
UPROPERTY(meta = (BindWidget))
|
||||||
|
TObjectPtr<UListFleetsBox> ListFleetsBox;
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
|
TObjectPtr<UAPITestManager> APITestManager;
|
||||||
|
|
||||||
|
UFUNCTION()
|
||||||
|
void ListFleetsButtonClicked();
|
||||||
|
|
||||||
|
UFUNCTION()
|
||||||
|
void OnListFleetsResponseReceived(const FDS_ListFleetsResponse& ListFleetResponse, bool bWasSuccessful);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
29
Source/DedicatedServers/Public/UI/API_Test/API_TestHUD.h
Normal file
29
Source/DedicatedServers/Public/UI/API_Test/API_TestHUD.h
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "GameFramework/HUD.h"
|
||||||
|
#include "API_TestHUD.generated.h"
|
||||||
|
|
||||||
|
class UAPITestOverlay;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class DEDICATEDSERVERS_API AAPI_TestHUD : public AHUD
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
UPROPERTY(EditDefaultsOnly)
|
||||||
|
TSubclassOf<UAPITestOverlay> APITestOverlayClass;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void BeginPlay() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
UPROPERTY()
|
||||||
|
TObjectPtr<UAPITestOverlay> APITestOverlay;
|
||||||
|
|
||||||
|
};
|
||||||
28
Source/DedicatedServers/Public/UI/HTTP/HTTPRequestManager.h
Normal file
28
Source/DedicatedServers/Public/UI/HTTP/HTTPRequestManager.h
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "UObject/Object.h"
|
||||||
|
#include "HTTPRequestManager.generated.h"
|
||||||
|
|
||||||
|
class UAPIData;
|
||||||
|
class FJsonObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS(Blueprintable)
|
||||||
|
class DEDICATEDSERVERS_API UHTTPRequestManager : public UObject
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly)
|
||||||
|
TObjectPtr<UAPIData> APIData;
|
||||||
|
|
||||||
|
bool ContainsErrors(TSharedPtr<FJsonObject> JsonObject, bool bSuppressLog = true);
|
||||||
|
void DumpMetaData(TSharedPtr<FJsonObject> JsonObject);
|
||||||
|
|
||||||
|
};
|
||||||
32
Source/DedicatedServers/Public/UI/Portal/PortalHUD.h
Normal file
32
Source/DedicatedServers/Public/UI/Portal/PortalHUD.h
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "GameFramework/HUD.h"
|
||||||
|
#include "PortalHUD.generated.h"
|
||||||
|
|
||||||
|
class USignInOverlay;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class DEDICATEDSERVERS_API APortalHUD : public AHUD
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly)
|
||||||
|
TSubclassOf<USignInOverlay> SignInOverlayClass;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
virtual void BeginPlay() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
|
TObjectPtr<USignInOverlay> SignInOverlay;
|
||||||
|
};
|
||||||
16
Source/DedicatedServers/Public/UI/Portal/PortalManager.h
Normal file
16
Source/DedicatedServers/Public/UI/Portal/PortalManager.h
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "UI/HTTP/HTTPRequestManager.h"
|
||||||
|
#include "PortalManager.generated.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class DEDICATEDSERVERS_API UPortalManager : public UHTTPRequestManager
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
};
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "Blueprint/UserWidget.h"
|
||||||
|
#include "SignInOverlay.generated.h"
|
||||||
|
|
||||||
|
class UJoinGame;
|
||||||
|
class UPortalManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class DEDICATEDSERVERS_API USignInOverlay : public UUserWidget
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
UPROPERTY(meta = (BindWidget))
|
||||||
|
TObjectPtr<UJoinGame> JoinGameWidget;
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly)
|
||||||
|
TSubclassOf<UPortalManager> PortalManagerClass;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
virtual void NativeConstruct() override;
|
||||||
|
private:
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
|
TObjectPtr<UPortalManager> PortalManager;
|
||||||
|
};
|
||||||
@@ -11,5 +11,6 @@ public class FPSTemplateTarget : TargetRules
|
|||||||
DefaultBuildSettings = BuildSettingsVersion.V6;
|
DefaultBuildSettings = BuildSettingsVersion.V6;
|
||||||
IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_7;
|
IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_7;
|
||||||
ExtraModuleNames.Add("FPSTemplate");
|
ExtraModuleNames.Add("FPSTemplate");
|
||||||
|
ExtraModuleNames.Add("DedicatedServers");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ public class FPSTemplate : ModuleRules
|
|||||||
"InputCore",
|
"InputCore",
|
||||||
"EnhancedInput",
|
"EnhancedInput",
|
||||||
"PhysicsCore",
|
"PhysicsCore",
|
||||||
"OpenSSL"
|
"OpenSSL",
|
||||||
|
"DedicatedServers"
|
||||||
});
|
});
|
||||||
|
|
||||||
PrivateDependencyModuleNames.AddRange(new string[]
|
PrivateDependencyModuleNames.AddRange(new string[]
|
||||||
@@ -29,18 +30,6 @@ public class FPSTemplate : ModuleRules
|
|||||||
"OpenSSL",
|
"OpenSSL",
|
||||||
});
|
});
|
||||||
|
|
||||||
// Adds in the plugin for GameLiftServerSDK if it is the server build.
|
|
||||||
|
|
||||||
if (Target.Type == TargetType.Server)
|
|
||||||
{
|
|
||||||
PublicDependencyModuleNames.Add("GameLiftServerSDK");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PublicDefinitions.Add("WITH_GAMELIFT=0");
|
|
||||||
}
|
|
||||||
bEnableExceptions = true;
|
|
||||||
|
|
||||||
// Uncomment if you are using Slate UI
|
// Uncomment if you are using Slate UI
|
||||||
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
|
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
|
||||||
|
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "GameFramework/GameMode.h"
|
#include "Game/DS_GameMode.h"
|
||||||
#include "ShooterGameModeBase.generated.h"
|
#include "ShooterGameModeBase.generated.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class FPSTEMPLATE_API AShooterGameModeBase : public AGameMode
|
class FPSTEMPLATE_API AShooterGameModeBase : public ADS_GameMode
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -11,5 +11,6 @@ public class FPSTemplateClientTarget : TargetRules
|
|||||||
DefaultBuildSettings = BuildSettingsVersion.V6;
|
DefaultBuildSettings = BuildSettingsVersion.V6;
|
||||||
IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_7;
|
IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_7;
|
||||||
ExtraModuleNames.Add("FPSTemplate");
|
ExtraModuleNames.Add("FPSTemplate");
|
||||||
|
ExtraModuleNames.Add("DedicatedServers");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,5 +11,6 @@ public class FPSTemplateEditorTarget : TargetRules
|
|||||||
DefaultBuildSettings = BuildSettingsVersion.V6;
|
DefaultBuildSettings = BuildSettingsVersion.V6;
|
||||||
IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_7;
|
IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_7;
|
||||||
ExtraModuleNames.Add("FPSTemplate");
|
ExtraModuleNames.Add("FPSTemplate");
|
||||||
|
ExtraModuleNames.Add("DedicatedServers");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,5 +11,6 @@ public class FPSTemplateServerTarget : TargetRules
|
|||||||
DefaultBuildSettings = BuildSettingsVersion.V6;
|
DefaultBuildSettings = BuildSettingsVersion.V6;
|
||||||
IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_7;
|
IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_7;
|
||||||
ExtraModuleNames.Add("FPSTemplate");
|
ExtraModuleNames.Add("FPSTemplate");
|
||||||
|
ExtraModuleNames.Add("DedicatedServers");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user