Add Editor Preference to control server selection
This commit is contained in:
@@ -5,9 +5,9 @@
|
||||
// When an error message gets written to UE_LOG, we can
|
||||
// optionally trigger the blueprint debugger.
|
||||
//
|
||||
// This only affects UE_LOG messages that are generated
|
||||
// during blueprint execution. Log messages from other
|
||||
// threads do not trigger the debugger.
|
||||
// This only affects UE_LOG messages that are generated by
|
||||
// the blueprint thread, during blueprint execution. Log
|
||||
// messages from other threads do not trigger the debugger.
|
||||
//
|
||||
// The following explains how we trigger the blueprint
|
||||
// debugger on UE_LOG messages. Log messages are sent to a
|
||||
|
||||
@@ -23,10 +23,6 @@
|
||||
//
|
||||
// FInputDeviceTrackerProcessor
|
||||
//
|
||||
// Slate input preprocessor. Updates the device-class
|
||||
// static on each button-down event. Never consumes
|
||||
// events (always returns false).
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
class FInputDeviceTrackerProcessor : public IInputProcessor
|
||||
|
||||
@@ -19,7 +19,8 @@ public class Integration : ModuleRules
|
||||
"Networking",
|
||||
"EnhancedInput",
|
||||
"UMG",
|
||||
"RenderCore"
|
||||
"RenderCore",
|
||||
"DeveloperSettings"
|
||||
});
|
||||
|
||||
PrivateDependencyModuleNames.AddRange(new string[] {
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "Blueprint/WidgetBlueprintLibrary.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "Engine/GameInstance.h"
|
||||
#include "ProjectSettings.h"
|
||||
|
||||
#include "Common.h"
|
||||
#include "AnimQueue.h"
|
||||
@@ -214,14 +215,13 @@ void ALuprexGameModeBase::InitializeGlobalState()
|
||||
|
||||
// Possibly tell the engine to connect to a server.
|
||||
if (Playing) {
|
||||
FString LuprexServer;
|
||||
FParse::Value(FCommandLine::Get(), TEXT("-LuprexServer="), LuprexServer);
|
||||
LuprexServer = LuprexServer.ToLower();
|
||||
UE_LOG(LogTemp, Display, TEXT("LuprexServer = %s"), *LuprexServer)
|
||||
if (LuprexServer != TEXT("standalone"))
|
||||
{
|
||||
FTCHARToUTF8 utf8server(LuprexServer);
|
||||
w->play_access(w.Get(), AccessKind::CONNECT_TO_SERVER, 0, utf8server.Length(), utf8server.Get(), nullptr, nullptr);
|
||||
UlxServerSelection* Server = GetDefault<UlxProjectSettings>()->ActiveServer.LoadSynchronous();
|
||||
if (Server) {
|
||||
FString Host = Server->Host.TrimStartAndEnd();
|
||||
if (!Host.IsEmpty()) {
|
||||
FTCHARToUTF8 utf8server(*Server->Host);
|
||||
w->play_access(w.Get(), AccessKind::CONNECT_TO_SERVER, 0, utf8server.Length(), utf8server.Get(), nullptr, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1
Source/Integration/ProjectSettings.cpp
Normal file
1
Source/Integration/ProjectSettings.cpp
Normal file
@@ -0,0 +1 @@
|
||||
#include "ProjectSettings.h"
|
||||
34
Source/Integration/ProjectSettings.h
Normal file
34
Source/Integration/ProjectSettings.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Engine/DataAsset.h"
|
||||
#include "Engine/DeveloperSettings.h"
|
||||
#include "ProjectSettings.generated.h"
|
||||
|
||||
UCLASS(BlueprintType)
|
||||
class INTEGRATION_API UlxServerSelection : public UPrimaryDataAsset
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Server")
|
||||
FString Description;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Server")
|
||||
FString Host;
|
||||
};
|
||||
|
||||
UCLASS(Config=EditorPerProjectUserSettings, DefaultConfig, meta=(DisplayName="Server Settings"))
|
||||
class INTEGRATION_API UlxProjectSettings : public UDeveloperSettings
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
virtual FName GetContainerName() const override { return TEXT("Editor"); }
|
||||
virtual FName GetCategoryName() const override { return TEXT("Luprex"); }
|
||||
virtual FName GetSectionName() const override { return TEXT("Server"); }
|
||||
|
||||
UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category="Server",
|
||||
meta=(AllowedClasses="/Script/Integration.lxServerSelection"))
|
||||
TSoftObjectPtr<UlxServerSelection> ActiveServer;
|
||||
};
|
||||
Reference in New Issue
Block a user