Lesson 59 - Game Sessions API Data Asset

This commit is contained in:
Norman Lansing
2026-03-29 19:56:25 -04:00
parent a487c71b44
commit 62243acf46
9 changed files with 103 additions and 23 deletions

View File

@@ -13,6 +13,7 @@ public class DedicatedServers : ModuleRules
"CoreUObject",
"Engine",
"OpenSSL",
"GameplayTags"
});
PrivateDependencyModuleNames.AddRange(new string[]

View File

@@ -0,0 +1,10 @@
// 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;
}

View File

@@ -0,0 +1,9 @@
#include "GameplayTags/DedicatedServerTags.h"
namespace DedicatedServersTags
{
namespace GameSessionsAPI
{
UE_DEFINE_GAMEPLAY_TAG_COMMENT(ListFleets, "DedicatedServersTags.GameSessionsAPI.ListFleets", "List Fleets resource on the GameSessions API")
}
}

View 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/DedicatedServerTags.h"
#include "APIData.generated.h"
/**
*
*/
UCLASS()
class DEDICATEDSERVERS_API UAPIData : public UDataAsset
{
GENERATED_BODY()
public:
FString GetAPIEndPoint(const FGameplayTag& APIEndPoint);
protected:
// Name of this API - for labeling in the Data Asset; This is nto used by any code.
UPROPERTY(EditDefaultsOnly)
FString Name;
UPROPERTY(EditDefaultsOnly)
FString InvokeUrl;
UPROPERTY(EditDefaultsOnly)
FString Stage;
UPROPERTY(EditDefaultsOnly)
TMap<FGameplayTag, FString> Resources;
};

View File

@@ -0,0 +1,12 @@
#pragma once
#include "CoreMinimal.h"
#include "NativeGameplayTags.h"
namespace DedicatedServersTags
{
namespace GameSessionsAPI
{
UE_DECLARE_GAMEPLAY_TAG_EXTERN(ListFleets);
}
}

View File

@@ -6,6 +6,8 @@
#include "UObject/Object.h"
#include "HTTPRequestManager.generated.h"
class UAPIData;
/**
*
*/
@@ -13,4 +15,9 @@ UCLASS(Blueprintable)
class DEDICATEDSERVERS_API UHTTPRequestManager : public UObject
{
GENERATED_BODY()
protected:
UPROPERTY(EditDefaultsOnly)
TObjectPtr<UAPIData> APIData;
};