Compare commits
11 Commits
b26e9eb576
...
new/API_Ga
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9fb60888ba | ||
|
|
acc105c84d | ||
|
|
d9eb52c047 | ||
|
|
e95360489b | ||
|
|
6f3e1d1f86 | ||
|
|
30c1e42379 | ||
|
|
7f154aa6f9 | ||
|
|
8d6f3f68f1 | ||
|
|
3912fe52c6 | ||
|
|
d989960b41 | ||
|
|
3407b94731 |
Binary file not shown.
Binary file not shown.
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.
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.
@@ -14,7 +14,9 @@ public class DedicatedServers : ModuleRules
|
|||||||
{
|
{
|
||||||
"Core",
|
"Core",
|
||||||
"CoreUObject",
|
"CoreUObject",
|
||||||
"Engine"
|
"Engine",
|
||||||
|
"GameplayTags",
|
||||||
|
"HTTP"
|
||||||
});
|
});
|
||||||
|
|
||||||
PrivateDependencyModuleNames.AddRange(new string[]
|
PrivateDependencyModuleNames.AddRange(new string[]
|
||||||
@@ -22,7 +24,9 @@ public class DedicatedServers : ModuleRules
|
|||||||
"Slate",
|
"Slate",
|
||||||
"SlateCore",
|
"SlateCore",
|
||||||
"OpenSSL",
|
"OpenSSL",
|
||||||
"UMG"
|
"UMG",
|
||||||
|
"Json",
|
||||||
|
"JsonUtilities"
|
||||||
});
|
});
|
||||||
|
|
||||||
// Adds in the plugin for GameLiftServerSDK if it is the server build.
|
// Adds in the plugin for GameLiftServerSDK if it is the server build.
|
||||||
|
|||||||
@@ -4,3 +4,5 @@
|
|||||||
#include "Modules/ModuleManager.h"
|
#include "Modules/ModuleManager.h"
|
||||||
|
|
||||||
IMPLEMENT_MODULE( FDefaultModuleImpl, DedicateServers );
|
IMPLEMENT_MODULE( FDefaultModuleImpl, DedicateServers );
|
||||||
|
|
||||||
|
DEFINE_LOG_CATEGORY(LogDedicatedServers);
|
||||||
|
|||||||
@@ -3,3 +3,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#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;
|
||||||
|
}
|
||||||
@@ -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,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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,60 @@
|
|||||||
// 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 "UI/API_Test/APITestOverlay.h"
|
#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);
|
||||||
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
@@ -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;
|
||||||
|
};
|
||||||
@@ -18,6 +18,6 @@ class DEDICATEDSERVERS_API UFleetId : public UUserWidget
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
UPROPERTY(meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget), BlueprintReadWrite)
|
||||||
TObjectPtr<UTextBlock> TextBlock_FleetId;
|
TObjectPtr<UTextBlock> TextBlock_FleetId;
|
||||||
};
|
};
|
||||||
|
|||||||
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);
|
||||||
|
};
|
||||||
@@ -6,6 +6,11 @@
|
|||||||
#include "Blueprint/UserWidget.h"
|
#include "Blueprint/UserWidget.h"
|
||||||
#include "APITestOverlay.generated.h"
|
#include "APITestOverlay.generated.h"
|
||||||
|
|
||||||
|
class UAPITestManager;
|
||||||
|
class UListFleetsBox;
|
||||||
|
struct FDS_ListFleetsResponse;
|
||||||
|
class UFleetId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -13,4 +18,33 @@ UCLASS()
|
|||||||
class DEDICATEDSERVERS_API UAPITestOverlay : public UUserWidget
|
class DEDICATEDSERVERS_API UAPITestOverlay : public UUserWidget
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
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;
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user