Lesson 55 - Dedicated Servers Game Mode
This commit is contained in:
50
Source/DedicatedServers/Public/Game/DS_GameMode.h
Normal file
50
Source/DedicatedServers/Public/Game/DS_GameMode.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 "DedicatedServers/Public/GameLiftClpTypes.h"
|
||||
#include "GameFramework/GameMode.h"
|
||||
#include "DS_GameMode.generated.h"
|
||||
|
||||
DECLARE_LOG_CATEGORY_EXTERN(LogDS_GameMode, Log, All);
|
||||
|
||||
struct FProcessParameters;
|
||||
struct FServerParameters;
|
||||
|
||||
struct FGameLiftConfig
|
||||
{
|
||||
bool bIsAnywhereFleet = false;
|
||||
bool bAllOptionsFound = false;
|
||||
|
||||
int32 ServerPort = 7777;
|
||||
|
||||
cmdlineparser::details::FParseResult AuthTokenResult;
|
||||
cmdlineparser::details::FParseResult FleetIdResult;
|
||||
cmdlineparser::details::FParseResult HostIdResult;
|
||||
cmdlineparser::details::FParseResult WebSocketUrlResult;
|
||||
};
|
||||
|
||||
|
||||
UCLASS()
|
||||
class DEDICATEDSERVERS_API ADS_GameMode : public AGameMode
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
protected:
|
||||
virtual void BeginPlay() override;
|
||||
virtual void InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage) override;
|
||||
|
||||
private:
|
||||
FGameLiftConfig GameLiftConfig;
|
||||
FString CachedCommandLine;
|
||||
TSharedPtr<FProcessParameters> ProcessParameters;
|
||||
|
||||
static FString GetSHA256Hash(const FString& InString);
|
||||
void InitGameLift();
|
||||
|
||||
bool GetAnywhereFleetParameters(const FString& CommandLineString);
|
||||
void LogAnywhereFleetParameters();
|
||||
static void LogServerParameters(const FServerParameters& InServerParameters);
|
||||
static FString GetValueOrHash(const FString& Value);
|
||||
};
|
||||
Reference in New Issue
Block a user