-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
get both with/without forking working
- Loading branch information
Showing
10 changed files
with
268 additions
and
80 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
SDKDemo/Content/ThirdPerson/Blueprints/B_MatchGameState.uasset
Git LFS file not shown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...emo/Plugins/HathoraSDK/Source/HathoraSDK/Private/LatentActions/HathoraGetServerRoomId.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2023 Hathora, Inc. | ||
|
||
#include "LatentActions/HathoraGetServerRoomId.h" | ||
#include "HathoraSDK.h" | ||
#include "HathoraSDKModule.h" | ||
|
||
UHathoraGetServerRoomId *UHathoraGetServerRoomId::GetServerRoomId( | ||
UObject *WorldContextObject, | ||
float PollingInterval | ||
) { | ||
UHathoraGetServerRoomId *Action = NewObject<UHathoraGetServerRoomId>(); | ||
Action->PollingInterval = PollingInterval; | ||
Action->RegisterWithGameInstance(WorldContextObject); | ||
return Action; | ||
} | ||
|
||
void UHathoraGetServerRoomId::Activate() | ||
{ | ||
if (!IsValid(this)) | ||
{ | ||
UE_LOG(LogHathoraSDK, Error, TEXT("GetServerRoomId failed because the underlying Hathora API is not valid.")); | ||
return; | ||
} | ||
|
||
UHathoraSDK::GetServerRoomId( | ||
PollingInterval, | ||
UHathoraSDK::FOnGetRoomId::CreateLambda( | ||
[this](const FString& RoomId) | ||
{ | ||
OnComplete.Broadcast(RoomId); | ||
SetReadyToDestroy(); | ||
} | ||
) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
SDKDemo/Plugins/HathoraSDK/Source/HathoraSDK/Public/LatentActions/HathoraGetServerRoomId.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright 2023 Hathora, Inc. | ||
|
||
#pragma once | ||
|
||
#include "CoreMinimal.h" | ||
#include "Kismet/BlueprintAsyncActionBase.h" | ||
#include "HathoraTypes.h" | ||
#include "HathoraGetServerRoomId.generated.h" | ||
|
||
UDELEGATE() | ||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam( | ||
FHathoraGetServerRoomIdComplete, FString, RoomId | ||
); | ||
|
||
UCLASS() | ||
class HATHORASDK_API UHathoraGetServerRoomId : public UBlueprintAsyncActionBase | ||
{ | ||
GENERATED_BODY() | ||
|
||
public: | ||
virtual void Activate() override; | ||
|
||
// Get the current Room ID for this Unreal process. Call this from a server. | ||
// @param PollingInterval The number of seconds to wait between polling to retrieve the Room ID. | ||
UFUNCTION( | ||
BlueprintCallable, | ||
meta = | ||
(BlueprintInternalUseOnly = "true", | ||
Category = "HathoraSDK", | ||
WorldContext = "WorldContextObject") | ||
) | ||
static UHathoraGetServerRoomId *GetServerRoomId( | ||
UObject *WorldContextObject, | ||
float PollingInterval = 1.0f | ||
); | ||
|
||
UPROPERTY(BlueprintAssignable) | ||
FHathoraGetServerRoomIdComplete OnComplete; | ||
|
||
float PollingInterval; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.