mirror of
https://github.com/mordentral/AdvancedSessionsPlugin.git
synced 2025-10-26 18:04:07 +00:00
Compare commits
27 Commits
4.21_Locke
...
4.26-Locke
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76cf3f6b4c | ||
|
|
9210d88f3f | ||
|
|
f9e794cd4a | ||
|
|
be6f532c1e | ||
|
|
188d5059fc | ||
|
|
e561b92679 | ||
|
|
0cee743c63 | ||
|
|
bfd459b461 | ||
|
|
17228f6bbb | ||
|
|
c32fc3488f | ||
|
|
05497d3226 | ||
|
|
2216aaf041 | ||
|
|
192307b542 | ||
|
|
51cf0acb2e | ||
|
|
3c4ba2af3b | ||
|
|
8744035160 | ||
|
|
71f16cadd2 | ||
|
|
fdfc2d272f | ||
|
|
297848aed8 | ||
|
|
60d1d272a5 | ||
|
|
c3f889c9c5 | ||
|
|
2e93c6095a | ||
|
|
6007506189 | ||
|
|
0952d9b18a | ||
|
|
438d0a69ba | ||
|
|
85e9b54fab | ||
|
|
ba28fccfe0 |
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
.hg/
|
||||||
|
binaries/
|
||||||
|
deriveddatacache/
|
||||||
|
.vs/
|
||||||
|
build/
|
||||||
|
intermediate/
|
||||||
|
PACKPLUGIN/
|
||||||
|
saved/
|
||||||
|
*.orig
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
"FileVersion" : 3,
|
"FileVersion" : 3,
|
||||||
|
|
||||||
"FriendlyName" : "Advanced Sessions",
|
"FriendlyName" : "Advanced Sessions",
|
||||||
"Version" : 4.21,
|
"Version" : 4.26,
|
||||||
"VersionName": "4.21",
|
"VersionName": "4.26",
|
||||||
"Description" : "Adds new blueprint functions to handle more advanced session operations.",
|
"Description" : "Adds new blueprint functions to handle more advanced session operations.",
|
||||||
"Category" : "Advanced Sessions Plugin",
|
"Category" : "Advanced Sessions Plugin",
|
||||||
"CreatedBy" : "Joshua Statzer",
|
"CreatedBy" : "Joshua Statzer",
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
|
#include "Engine/Engine.h"
|
||||||
#include "BlueprintDataDefinitions.h"
|
#include "BlueprintDataDefinitions.h"
|
||||||
#include "Kismet/BlueprintFunctionLibrary.h"
|
#include "Kismet/BlueprintFunctionLibrary.h"
|
||||||
#include "Online.h"
|
#include "Online.h"
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "Engine/Engine.h"
|
||||||
|
#include "Online.h"
|
||||||
|
#include "OnlineSubsystem.h"
|
||||||
|
#include "Engine/GameInstance.h"
|
||||||
|
#include "GameFramework/GameModeBase.h"
|
||||||
|
#include "GameFramework/GameSession.h"
|
||||||
|
#include "GameFramework/PlayerState.h"
|
||||||
|
|
||||||
|
//#include "UObjectIterator.h"
|
||||||
|
|
||||||
|
#include "AdvancedGameSession.generated.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
A quick wrapper around the game session to add a partial ban implementation. Just bans for the duration of the current session
|
||||||
|
*/
|
||||||
|
UCLASS(config = Game, notplaceable)
|
||||||
|
class AAdvancedGameSession : public AGameSession
|
||||||
|
{
|
||||||
|
GENERATED_UCLASS_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
UPROPERTY(Transient)
|
||||||
|
TMap<FUniqueNetIdRepl, FText> BanList;
|
||||||
|
|
||||||
|
virtual bool BanPlayer(class APlayerController* BannedPlayer, const FText& BanReason)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (APlayerState* PlayerState = (BannedPlayer != NULL) ? BannedPlayer->PlayerState : NULL)
|
||||||
|
{
|
||||||
|
FUniqueNetIdRepl UniqueNetID = PlayerState->GetUniqueId();
|
||||||
|
bool bWasKicked = KickPlayer(BannedPlayer, BanReason);
|
||||||
|
|
||||||
|
if (bWasKicked)
|
||||||
|
{
|
||||||
|
BanList.Add(UniqueNetID, BanReason);
|
||||||
|
}
|
||||||
|
|
||||||
|
return bWasKicked;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This should really be handled in the game mode asking game session, but I didn't want to force a custom game session AND game mode
|
||||||
|
// If done in the game mode, we could check prior to actually spooling up any player information in ApproveLogin
|
||||||
|
virtual void PostLogin(APlayerController* NewPlayer) override
|
||||||
|
{
|
||||||
|
if (APlayerState* PlayerState = (NewPlayer != NULL) ? NewPlayer->PlayerState : NULL)
|
||||||
|
{
|
||||||
|
FUniqueNetIdRepl UniqueNetID = PlayerState->GetUniqueId();
|
||||||
|
|
||||||
|
if (BanList.Contains(UniqueNetID))
|
||||||
|
{
|
||||||
|
KickPlayer(NewPlayer, BanList[UniqueNetID]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
AAdvancedGameSession::AAdvancedGameSession(const FObjectInitializer& ObjectInitializer)
|
||||||
|
: Super(ObjectInitializer)
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
|
#include "Engine/Engine.h"
|
||||||
#include "BlueprintDataDefinitions.h"
|
#include "BlueprintDataDefinitions.h"
|
||||||
#include "Kismet/BlueprintFunctionLibrary.h"
|
#include "Kismet/BlueprintFunctionLibrary.h"
|
||||||
#include "Online.h"
|
#include "Online.h"
|
||||||
@@ -13,6 +14,9 @@
|
|||||||
#include "Engine/GameInstance.h"
|
#include "Engine/GameInstance.h"
|
||||||
#include "Interfaces/OnlineSessionInterface.h"
|
#include "Interfaces/OnlineSessionInterface.h"
|
||||||
|
|
||||||
|
#include "GameFramework/GameModeBase.h"
|
||||||
|
#include "GameFramework/GameSession.h"
|
||||||
|
|
||||||
//#include "UObjectIterator.h"
|
//#include "UObjectIterator.h"
|
||||||
|
|
||||||
#include "AdvancedSessionsLibrary.generated.h"
|
#include "AdvancedSessionsLibrary.generated.h"
|
||||||
@@ -27,6 +31,17 @@ class UAdvancedSessionsLibrary : public UBlueprintFunctionLibrary
|
|||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
public:
|
public:
|
||||||
|
//********* Session Admin Functions *************//
|
||||||
|
|
||||||
|
// Kick a player from the currently active game session, only available on the server
|
||||||
|
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions", meta = (WorldContext = "WorldContextObject"))
|
||||||
|
static bool KickPlayer(UObject* WorldContextObject, APlayerController* PlayerToKick, FText KickReason);
|
||||||
|
|
||||||
|
// Ban a player from the currently active game session, only available on the server
|
||||||
|
// Note that the default gamesession class does not implement an actual ban list and just kicks when this is called
|
||||||
|
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions", meta = (WorldContext = "WorldContextObject"))
|
||||||
|
static bool BanPlayer(UObject* WorldContextObject, APlayerController* PlayerToBan, FText BanReason);
|
||||||
|
|
||||||
//********* Session Search Functions *************//
|
//********* Session Search Functions *************//
|
||||||
|
|
||||||
// Adds or modifies session settings in an existing array depending on if they exist already or not
|
// Adds or modifies session settings in an existing array depending on if they exist already or not
|
||||||
@@ -38,16 +53,16 @@ public:
|
|||||||
static void GetExtraSettings(FBlueprintSessionResult SessionResult, TArray<FSessionPropertyKeyPair> & ExtraSettings);
|
static void GetExtraSettings(FBlueprintSessionResult SessionResult, TArray<FSessionPropertyKeyPair> & ExtraSettings);
|
||||||
|
|
||||||
// Get the current session state
|
// Get the current session state
|
||||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo")
|
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (WorldContext = "WorldContextObject"))
|
||||||
static void GetSessionState(EBPOnlineSessionState &SessionState);
|
static void GetSessionState(UObject* WorldContextObject, EBPOnlineSessionState &SessionState);
|
||||||
|
|
||||||
// Get the current session settings
|
// Get the current session settings
|
||||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "Result"))
|
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject"))
|
||||||
static void GetSessionSettings(int32 &NumConnections, int32 &NumPrivateConnections, bool &bIsLAN, bool &bIsDedicated, bool &bAllowInvites, bool &bAllowJoinInProgress, bool &bIsAnticheatEnabled, int32 &BuildUniqueID, TArray<FSessionPropertyKeyPair> &ExtraSettings, EBlueprintResultSwitch &Result);
|
static void GetSessionSettings(UObject* WorldContextObject, int32 &NumConnections, int32 &NumPrivateConnections, bool &bIsLAN, bool &bIsDedicated, bool &bAllowInvites, bool &bAllowJoinInProgress, bool &bIsAnticheatEnabled, int32 &BuildUniqueID, TArray<FSessionPropertyKeyPair> &ExtraSettings, EBlueprintResultSwitch &Result);
|
||||||
|
|
||||||
// Check if someone is in the current session
|
// Check if someone is in the current session
|
||||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo")
|
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (WorldContext = "WorldContextObject"))
|
||||||
static void IsPlayerInSession(const FBPUniqueNetId &PlayerToCheck, bool &bIsInSession);
|
static void IsPlayerInSession(UObject* WorldContextObject, const FBPUniqueNetId &PlayerToCheck, bool &bIsInSession);
|
||||||
|
|
||||||
// Make a literal session search parameter
|
// Make a literal session search parameter
|
||||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo|Literals")
|
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo|Literals")
|
||||||
@@ -60,6 +75,14 @@ public:
|
|||||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo")
|
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo")
|
||||||
static bool IsValidSession(const FBlueprintSessionResult & SessionResult);
|
static bool IsValidSession(const FBlueprintSessionResult & SessionResult);
|
||||||
|
|
||||||
|
// Get a string copy of a session ID
|
||||||
|
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo")
|
||||||
|
static void GetSessionID_AsString(const FBlueprintSessionResult & SessionResult, FString& SessionID);
|
||||||
|
|
||||||
|
// Get a string copy of the current session ID
|
||||||
|
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo", meta = (WorldContext = "WorldContextObject"))
|
||||||
|
static void GetCurrentSessionID_AsString(UObject* WorldContextObject, FString& SessionID);
|
||||||
|
|
||||||
// Get the Unique Current Build ID
|
// Get the Unique Current Build ID
|
||||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo")
|
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo")
|
||||||
static void GetCurrentUniqueBuildID(int32 &UniqueBuildId);
|
static void GetCurrentUniqueBuildID(int32 &UniqueBuildId);
|
||||||
@@ -92,6 +115,7 @@ public:
|
|||||||
static void GetSessionPropertyByte(const TArray<FSessionPropertyKeyPair> & ExtraSettings, FName SettingName, ESessionSettingSearchResult &SearchResult, uint8 &SettingValue);
|
static void GetSessionPropertyByte(const TArray<FSessionPropertyKeyPair> & ExtraSettings, FName SettingName, ESessionSettingSearchResult &SearchResult, uint8 &SettingValue);
|
||||||
|
|
||||||
// Get session custom information key/value as Bool
|
// Get session custom information key/value as Bool
|
||||||
|
// Steam only currently supports Int,Float,String,BYTE values for search filtering!!!
|
||||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "SearchResult"))
|
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "SearchResult"))
|
||||||
static void GetSessionPropertyBool(const TArray<FSessionPropertyKeyPair> & ExtraSettings, FName SettingName, ESessionSettingSearchResult &SearchResult, bool &SettingValue);
|
static void GetSessionPropertyBool(const TArray<FSessionPropertyKeyPair> & ExtraSettings, FName SettingName, ESessionSettingSearchResult &SearchResult, bool &SettingValue);
|
||||||
|
|
||||||
@@ -113,6 +137,7 @@ public:
|
|||||||
static FSessionPropertyKeyPair MakeLiteralSessionPropertyByte(FName Key, uint8 Value);
|
static FSessionPropertyKeyPair MakeLiteralSessionPropertyByte(FName Key, uint8 Value);
|
||||||
|
|
||||||
// Make a literal session custom information key/value pair from Bool
|
// Make a literal session custom information key/value pair from Bool
|
||||||
|
// Steam only currently supports Int,Float,String,BYTE values for search filtering!
|
||||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo|Literals")
|
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo|Literals")
|
||||||
static FSessionPropertyKeyPair MakeLiteralSessionPropertyBool(FName Key, bool Value);
|
static FSessionPropertyKeyPair MakeLiteralSessionPropertyBool(FName Key, bool Value);
|
||||||
|
|
||||||
@@ -174,6 +199,12 @@ public:
|
|||||||
// Checks if the stated session subsystem is active
|
// Checks if the stated session subsystem is active
|
||||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|Misc")
|
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|Misc")
|
||||||
static bool HasOnlineSubsystem(FName SubSystemName);
|
static bool HasOnlineSubsystem(FName SubSystemName);
|
||||||
|
|
||||||
|
//**** Seamless travel Functions ****//
|
||||||
|
|
||||||
|
//Exposes Server travel to blueprint
|
||||||
|
UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category = "Online|AdvancedSessions|Seamless", meta = (HidePin = "WorldContextObject", DefaultToSelf = "WorldContextObject"))
|
||||||
|
static bool ServerTravel(UObject* WorldContextObject, const FString& InURL, bool bAbsolute, bool bShouldSkipGameNotify);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -200,6 +200,17 @@ public:
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Adding in a compare operator so that std functions will work with this struct
|
||||||
|
FORCEINLINE bool operator==(const FBPUniqueNetId& Other) const
|
||||||
|
{
|
||||||
|
return (IsValid() && Other.IsValid() && (*GetUniqueNetId() == *Other.GetUniqueNetId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCEINLINE bool operator!=(const FBPUniqueNetId& Other) const
|
||||||
|
{
|
||||||
|
return !(IsValid() && Other.IsValid() && (*GetUniqueNetId() == *Other.GetUniqueNetId()));
|
||||||
|
}
|
||||||
|
|
||||||
FBPUniqueNetId()
|
FBPUniqueNetId()
|
||||||
{
|
{
|
||||||
bUseDirectPointer = false;
|
bUseDirectPointer = false;
|
||||||
@@ -340,7 +351,7 @@ public:
|
|||||||
//return const_cast<FUniqueNetId*>(UniqueNetIdPtr);
|
//return const_cast<FUniqueNetId*>(UniqueNetIdPtr);
|
||||||
if (APlayerState* PlayerState = (PlayerController != NULL) ? PlayerController->PlayerState : NULL)
|
if (APlayerState* PlayerState = (PlayerController != NULL) ? PlayerController->PlayerState : NULL)
|
||||||
{
|
{
|
||||||
UserID = PlayerState->UniqueId.GetUniqueNetId();
|
UserID = PlayerState->GetUniqueId().GetUniqueNetId();
|
||||||
if (!UserID.IsValid())
|
if (!UserID.IsValid())
|
||||||
{
|
{
|
||||||
FFrame::KismetExecutionMessage(*FString::Printf(TEXT("%s - Cannot map local player to unique net ID"), FunctionContext), ELogVerbosity::Warning);
|
FFrame::KismetExecutionMessage(*FString::Printf(TEXT("%s - Cannot map local player to unique net ID"), FunctionContext), ELogVerbosity::Warning);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
|
#include "Engine/Engine.h"
|
||||||
#include "Interfaces/OnlineSessionInterface.h"
|
#include "Interfaces/OnlineSessionInterface.h"
|
||||||
#include "BlueprintDataDefinitions.h"
|
#include "BlueprintDataDefinitions.h"
|
||||||
#include "CancelFindSessionsCallbackProxy.generated.h"
|
#include "CancelFindSessionsCallbackProxy.generated.h"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
|
#include "Engine/Engine.h"
|
||||||
#include "BlueprintDataDefinitions.h"
|
#include "BlueprintDataDefinitions.h"
|
||||||
#include "CreateSessionCallbackProxyAdvanced.generated.h"
|
#include "CreateSessionCallbackProxyAdvanced.generated.h"
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
|
#include "Engine/Engine.h"
|
||||||
#include "Interfaces/OnlineSessionInterface.h"
|
#include "Interfaces/OnlineSessionInterface.h"
|
||||||
#include "BlueprintDataDefinitions.h"
|
#include "BlueprintDataDefinitions.h"
|
||||||
#include "EndSessionCallbackProxy.generated.h"
|
#include "EndSessionCallbackProxy.generated.h"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
|
#include "Engine/Engine.h"
|
||||||
#include "Interfaces/OnlineSessionInterface.h"
|
#include "Interfaces/OnlineSessionInterface.h"
|
||||||
#include "FindSessionsCallbackProxy.h"
|
#include "FindSessionsCallbackProxy.h"
|
||||||
#include "BlueprintDataDefinitions.h"
|
#include "BlueprintDataDefinitions.h"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
|
#include "Engine/Engine.h"
|
||||||
#include "BlueprintDataDefinitions.h"
|
#include "BlueprintDataDefinitions.h"
|
||||||
#include "UpdateSessionCallbackProxyAdvanced.generated.h"
|
#include "UpdateSessionCallbackProxyAdvanced.generated.h"
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ void UAdvancedExternalUILibrary::ShowInviteUI(APlayerController *PlayerControlle
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExternalUIInterface->ShowInviteUI(Player->GetControllerId(), GameSessionName);
|
ExternalUIInterface->ShowInviteUI(Player->GetControllerId(), NAME_GameSession);
|
||||||
Result = EBlueprintResultSwitch::OnSuccess;
|
Result = EBlueprintResultSwitch::OnSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ UAdvancedFriendsGameInstance::UAdvancedFriendsGameInstance(const FObjectInitiali
|
|||||||
|
|
||||||
void UAdvancedFriendsGameInstance::Shutdown()
|
void UAdvancedFriendsGameInstance::Shutdown()
|
||||||
{
|
{
|
||||||
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface();
|
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(GetWorld());
|
||||||
|
|
||||||
if (!SessionInterface.IsValid())
|
if (!SessionInterface.IsValid())
|
||||||
{
|
{
|
||||||
@@ -39,7 +39,7 @@ void UAdvancedFriendsGameInstance::Shutdown()
|
|||||||
|
|
||||||
if (bEnableTalkingStatusDelegate)
|
if (bEnableTalkingStatusDelegate)
|
||||||
{
|
{
|
||||||
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();
|
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface(GetWorld());
|
||||||
|
|
||||||
if (VoiceInterface.IsValid())
|
if (VoiceInterface.IsValid())
|
||||||
{
|
{
|
||||||
@@ -52,7 +52,7 @@ void UAdvancedFriendsGameInstance::Shutdown()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface();
|
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface(GetWorld());
|
||||||
|
|
||||||
if (IdentityInterface.IsValid())
|
if (IdentityInterface.IsValid())
|
||||||
{
|
{
|
||||||
@@ -69,7 +69,7 @@ void UAdvancedFriendsGameInstance::Shutdown()
|
|||||||
|
|
||||||
void UAdvancedFriendsGameInstance::Init()
|
void UAdvancedFriendsGameInstance::Init()
|
||||||
{
|
{
|
||||||
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface();//OnlineSub->GetSessionInterface();
|
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(GetWorld());//OnlineSub->GetSessionInterface();
|
||||||
|
|
||||||
if (SessionInterface.IsValid())
|
if (SessionInterface.IsValid())
|
||||||
{
|
{
|
||||||
@@ -90,7 +90,7 @@ void UAdvancedFriendsGameInstance::Init()
|
|||||||
// Beginning work on the voice interface
|
// Beginning work on the voice interface
|
||||||
if (bEnableTalkingStatusDelegate)
|
if (bEnableTalkingStatusDelegate)
|
||||||
{
|
{
|
||||||
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();
|
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface(GetWorld());
|
||||||
|
|
||||||
if (VoiceInterface.IsValid())
|
if (VoiceInterface.IsValid())
|
||||||
{
|
{
|
||||||
@@ -103,7 +103,7 @@ void UAdvancedFriendsGameInstance::Init()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface();
|
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface(GetWorld());
|
||||||
|
|
||||||
if (IdentityInterface.IsValid())
|
if (IdentityInterface.IsValid())
|
||||||
{
|
{
|
||||||
@@ -263,7 +263,7 @@ void UAdvancedFriendsGameInstance::OnSessionInviteReceivedMaster(const FUniqueNe
|
|||||||
int32 LocalPlayer = 0;
|
int32 LocalPlayer = 0;
|
||||||
for (int i = 0; i < PlayerList.Num(); i++)
|
for (int i = 0; i < PlayerList.Num(); i++)
|
||||||
{
|
{
|
||||||
if (*PlayerList[i]->PlayerState->UniqueId.GetUniqueNetId() == PersonInvited)
|
if (*PlayerList[i]->PlayerState->GetUniqueId().GetUniqueNetId() == PersonInvited)
|
||||||
{
|
{
|
||||||
LocalPlayer = i;
|
LocalPlayer = i;
|
||||||
Player = PlayerList[i];
|
Player = PlayerList[i];
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ void UAdvancedFriendsLibrary::SendSessionInviteToFriends(APlayerController *Play
|
|||||||
List.Add(val);
|
List.Add(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SessionInterface->SendSessionInviteToFriends(Player->GetControllerId(), GameSessionName, List))
|
if (SessionInterface->SendSessionInviteToFriends(Player->GetControllerId(), NAME_GameSession, List))
|
||||||
{
|
{
|
||||||
Result = EBlueprintResultSwitch::OnSuccess;
|
Result = EBlueprintResultSwitch::OnSuccess;
|
||||||
return;
|
return;
|
||||||
@@ -94,7 +94,7 @@ void UAdvancedFriendsLibrary::SendSessionInviteToFriend(APlayerController *Playe
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SessionInterface->SendSessionInviteToFriend(Player->GetControllerId(), GameSessionName, *FriendUniqueNetId.GetUniqueNetId()))
|
if (SessionInterface->SendSessionInviteToFriend(Player->GetControllerId(), NAME_GameSession, *FriendUniqueNetId.GetUniqueNetId()))
|
||||||
{
|
{
|
||||||
Result = EBlueprintResultSwitch::OnSuccess;
|
Result = EBlueprintResultSwitch::OnSuccess;
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,17 +1,93 @@
|
|||||||
// 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 "AdvancedSessionsLibrary.h"
|
#include "AdvancedSessionsLibrary.h"
|
||||||
|
|
||||||
#include "GameFramework/PlayerState.h"
|
#include "GameFramework/PlayerState.h"
|
||||||
#include "GameFramework/GameStateBase.h"
|
#include "GameFramework/GameStateBase.h"
|
||||||
|
|
||||||
//General Log
|
//General Log
|
||||||
DEFINE_LOG_CATEGORY(AdvancedSessionsLog);
|
DEFINE_LOG_CATEGORY(AdvancedSessionsLog);
|
||||||
|
|
||||||
|
|
||||||
|
bool UAdvancedSessionsLibrary::KickPlayer(UObject* WorldContextObject, APlayerController* PlayerToKick, FText KickReason)
|
||||||
|
{
|
||||||
|
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||||
|
|
||||||
|
if (World)
|
||||||
|
{
|
||||||
|
if (AGameModeBase* GameMode = World->GetAuthGameMode())
|
||||||
|
{
|
||||||
|
if (GameMode->GameSession)
|
||||||
|
{
|
||||||
|
return GameMode->GameSession->KickPlayer(PlayerToKick, KickReason);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UAdvancedSessionsLibrary::BanPlayer(UObject* WorldContextObject, APlayerController* PlayerToBan, FText BanReason)
|
||||||
|
{
|
||||||
|
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||||
|
|
||||||
|
if (World)
|
||||||
|
{
|
||||||
|
if (AGameModeBase* GameMode = World->GetAuthGameMode())
|
||||||
|
{
|
||||||
|
if (GameMode->GameSession)
|
||||||
|
{
|
||||||
|
return GameMode->GameSession->BanPlayer(PlayerToBan, BanReason);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool UAdvancedSessionsLibrary::IsValidSession(const FBlueprintSessionResult & SessionResult)
|
bool UAdvancedSessionsLibrary::IsValidSession(const FBlueprintSessionResult & SessionResult)
|
||||||
{
|
{
|
||||||
return SessionResult.OnlineResult.IsValid();
|
return SessionResult.OnlineResult.IsValid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UAdvancedSessionsLibrary::GetSessionID_AsString(const FBlueprintSessionResult & SessionResult, FString& SessionID)
|
||||||
|
{
|
||||||
|
const TSharedPtr<class FOnlineSessionInfo> SessionInfo = SessionResult.OnlineResult.Session.SessionInfo;
|
||||||
|
if (SessionInfo.IsValid() && SessionInfo->IsValid() && SessionInfo->GetSessionId().IsValid())
|
||||||
|
{
|
||||||
|
SessionID = SessionInfo->GetSessionId().ToString();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Zero the string out if we didn't have a valid one, in case this is called in c++
|
||||||
|
SessionID.Empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UAdvancedSessionsLibrary::GetCurrentSessionID_AsString(UObject* WorldContextObject, FString& SessionID)
|
||||||
|
{
|
||||||
|
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||||
|
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(World);
|
||||||
|
|
||||||
|
if (!SessionInterface.IsValid())
|
||||||
|
{
|
||||||
|
UE_LOG(AdvancedSessionsLog, Warning, TEXT("GetCurrentSessionID_AsString couldn't get the session interface!"));
|
||||||
|
SessionID.Empty();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const FNamedOnlineSession* Session = SessionInterface->GetNamedSession(NAME_GameSession);
|
||||||
|
if (Session != nullptr)
|
||||||
|
{
|
||||||
|
const TSharedPtr<class FOnlineSessionInfo> SessionInfo = Session->SessionInfo;
|
||||||
|
if (SessionInfo.IsValid() && SessionInfo->IsValid() && SessionInfo->GetSessionId().IsValid())
|
||||||
|
{
|
||||||
|
SessionID = SessionInfo->GetSessionId().ToString();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Zero the string out if we didn't have a valid one, in case this is called in c++
|
||||||
|
SessionID.Empty();
|
||||||
|
}
|
||||||
|
|
||||||
void UAdvancedSessionsLibrary::GetCurrentUniqueBuildID(int32 &UniqueBuildId)
|
void UAdvancedSessionsLibrary::GetCurrentUniqueBuildID(int32 &UniqueBuildId)
|
||||||
{
|
{
|
||||||
UniqueBuildId = GetBuildUniqueId();
|
UniqueBuildId = GetBuildUniqueId();
|
||||||
@@ -87,9 +163,10 @@ void UAdvancedSessionsLibrary::GetExtraSettings(FBlueprintSessionResult SessionR
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UAdvancedSessionsLibrary::GetSessionState(EBPOnlineSessionState &SessionState)
|
void UAdvancedSessionsLibrary::GetSessionState(UObject* WorldContextObject, EBPOnlineSessionState &SessionState)
|
||||||
{
|
{
|
||||||
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface();
|
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||||
|
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(World);
|
||||||
|
|
||||||
if (!SessionInterface.IsValid())
|
if (!SessionInterface.IsValid())
|
||||||
{
|
{
|
||||||
@@ -97,12 +174,13 @@ void UAdvancedSessionsLibrary::GetSessionState(EBPOnlineSessionState &SessionSta
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SessionState = ((EBPOnlineSessionState)SessionInterface->GetSessionState(GameSessionName));
|
SessionState = ((EBPOnlineSessionState)SessionInterface->GetSessionState(NAME_GameSession));
|
||||||
}
|
}
|
||||||
|
|
||||||
void UAdvancedSessionsLibrary::GetSessionSettings(int32 &NumConnections, int32 &NumPrivateConnections, bool &bIsLAN, bool &bIsDedicated, bool &bAllowInvites, bool &bAllowJoinInProgress, bool &bIsAnticheatEnabled, int32 &BuildUniqueID, TArray<FSessionPropertyKeyPair> &ExtraSettings, EBlueprintResultSwitch &Result)
|
void UAdvancedSessionsLibrary::GetSessionSettings(UObject* WorldContextObject, int32 &NumConnections, int32 &NumPrivateConnections, bool &bIsLAN, bool &bIsDedicated, bool &bAllowInvites, bool &bAllowJoinInProgress, bool &bIsAnticheatEnabled, int32 &BuildUniqueID, TArray<FSessionPropertyKeyPair> &ExtraSettings, EBlueprintResultSwitch &Result)
|
||||||
{
|
{
|
||||||
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface();
|
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||||
|
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(World);
|
||||||
|
|
||||||
if (!SessionInterface.IsValid())
|
if (!SessionInterface.IsValid())
|
||||||
{
|
{
|
||||||
@@ -111,7 +189,7 @@ void UAdvancedSessionsLibrary::GetSessionSettings(int32 &NumConnections, int32 &
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FOnlineSessionSettings* settings = SessionInterface->GetSessionSettings(GameSessionName);
|
FOnlineSessionSettings* settings = SessionInterface->GetSessionSettings(NAME_GameSession);
|
||||||
if (!settings)
|
if (!settings)
|
||||||
{
|
{
|
||||||
UE_LOG(AdvancedSessionsLog, Warning, TEXT("GetSessionSettings couldn't get the session settings!"));
|
UE_LOG(AdvancedSessionsLog, Warning, TEXT("GetSessionSettings couldn't get the session settings!"));
|
||||||
@@ -140,9 +218,10 @@ void UAdvancedSessionsLibrary::GetSessionSettings(int32 &NumConnections, int32 &
|
|||||||
Result = EBlueprintResultSwitch::OnSuccess;
|
Result = EBlueprintResultSwitch::OnSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UAdvancedSessionsLibrary::IsPlayerInSession(const FBPUniqueNetId &PlayerToCheck, bool &bIsInSession)
|
void UAdvancedSessionsLibrary::IsPlayerInSession(UObject* WorldContextObject, const FBPUniqueNetId &PlayerToCheck, bool &bIsInSession)
|
||||||
{
|
{
|
||||||
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface();
|
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||||
|
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(World);
|
||||||
|
|
||||||
if (!SessionInterface.IsValid())
|
if (!SessionInterface.IsValid())
|
||||||
{
|
{
|
||||||
@@ -151,7 +230,7 @@ void UAdvancedSessionsLibrary::IsPlayerInSession(const FBPUniqueNetId &PlayerToC
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bIsInSession = SessionInterface->IsPlayerInSession(GameSessionName, *PlayerToCheck.GetUniqueNetId());
|
bIsInSession = SessionInterface->IsPlayerInSession(NAME_GameSession, *PlayerToCheck.GetUniqueNetId());
|
||||||
}
|
}
|
||||||
|
|
||||||
FSessionsSearchSetting UAdvancedSessionsLibrary::MakeLiteralSessionSearchProperty(FSessionPropertyKeyPair SessionSearchProperty, EOnlineComparisonOpRedux ComparisonOp)
|
FSessionsSearchSetting UAdvancedSessionsLibrary::MakeLiteralSessionSearchProperty(FSessionPropertyKeyPair SessionSearchProperty, EOnlineComparisonOpRedux ComparisonOp)
|
||||||
@@ -363,7 +442,7 @@ void UAdvancedSessionsLibrary::GetUniqueNetID(APlayerController *PlayerControlle
|
|||||||
|
|
||||||
if (APlayerState* PlayerState = (PlayerController != NULL) ? PlayerController->PlayerState : NULL)
|
if (APlayerState* PlayerState = (PlayerController != NULL) ? PlayerController->PlayerState : NULL)
|
||||||
{
|
{
|
||||||
UniqueNetId.SetUniqueNetId(PlayerState->UniqueId.GetUniqueNetId());
|
UniqueNetId.SetUniqueNetId(PlayerState->GetUniqueId().GetUniqueNetId());
|
||||||
if (!UniqueNetId.IsValid())
|
if (!UniqueNetId.IsValid())
|
||||||
{
|
{
|
||||||
UE_LOG(AdvancedSessionsLog, Warning, TEXT("GetUniqueNetIdFromController couldn't get the player uniquenetid!"));
|
UE_LOG(AdvancedSessionsLog, Warning, TEXT("GetUniqueNetIdFromController couldn't get the player uniquenetid!"));
|
||||||
@@ -380,7 +459,7 @@ void UAdvancedSessionsLibrary::GetUniqueNetIDFromPlayerState(APlayerState *Playe
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UniqueNetId.SetUniqueNetId(PlayerState->UniqueId.GetUniqueNetId());
|
UniqueNetId.SetUniqueNetId(PlayerState->GetUniqueId().GetUniqueNetId());
|
||||||
if (!UniqueNetId.IsValid())
|
if (!UniqueNetId.IsValid())
|
||||||
{
|
{
|
||||||
UE_LOG(AdvancedSessionsLog, Warning, TEXT("GetUniqueNetIdFromPlayerState couldn't get the player uniquenetid!"));
|
UE_LOG(AdvancedSessionsLog, Warning, TEXT("GetUniqueNetIdFromPlayerState couldn't get the player uniquenetid!"));
|
||||||
@@ -449,3 +528,14 @@ void UAdvancedSessionsLibrary::GetNumberOfNetworkPlayers(UObject* WorldContextOb
|
|||||||
|
|
||||||
NumNetPlayers = TheWorld->GetGameState()->PlayerArray.Num();
|
NumNetPlayers = TheWorld->GetGameState()->PlayerArray.Num();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool UAdvancedSessionsLibrary::ServerTravel(UObject* WorldContextObject, const FString& FURL, bool bAbsolute, bool bShouldSkipGameNotify)
|
||||||
|
{
|
||||||
|
if (!WorldContextObject) return false;
|
||||||
|
|
||||||
|
//using a context object to get the world
|
||||||
|
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::ReturnNull);
|
||||||
|
if (!World) return false;
|
||||||
|
World->ServerTravel(FURL,bAbsolute,bShouldSkipGameNotify);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||||||
|
|
||||||
#include "CancelFindSessionsCallbackProxy.h"
|
#include "CancelFindSessionsCallbackProxy.h"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ void UCreateSessionCallbackProxyAdvanced::Activate()
|
|||||||
Settings.bShouldAdvertise = true;
|
Settings.bShouldAdvertise = true;
|
||||||
Settings.bAllowJoinInProgress = true;
|
Settings.bAllowJoinInProgress = true;
|
||||||
Settings.bIsLANMatch = bUseLAN;
|
Settings.bIsLANMatch = bUseLAN;
|
||||||
Settings.bAllowJoinViaPresence = true;
|
Settings.bAllowJoinViaPresence = bAllowJoinViaPresence;
|
||||||
Settings.bIsDedicated = bDedicatedServer;
|
Settings.bIsDedicated = bDedicatedServer;
|
||||||
|
|
||||||
if (bDedicatedServer)
|
if (bDedicatedServer)
|
||||||
@@ -83,7 +83,7 @@ void UCreateSessionCallbackProxyAdvanced::Activate()
|
|||||||
{
|
{
|
||||||
if (PlayerControllerWeakPtr.IsValid() && Helper.UserID.IsValid())
|
if (PlayerControllerWeakPtr.IsValid() && Helper.UserID.IsValid())
|
||||||
{
|
{
|
||||||
Sessions->CreateSession(*Helper.UserID, GameSessionName, Settings);
|
Sessions->CreateSession(*Helper.UserID, NAME_GameSession, Settings);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -95,7 +95,7 @@ void UCreateSessionCallbackProxyAdvanced::Activate()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Sessions->CreateSession(0, GameSessionName, Settings);
|
Sessions->CreateSession(0, NAME_GameSession, Settings);
|
||||||
|
|
||||||
// OnCreateCompleted will get called, nothing more to do now
|
// OnCreateCompleted will get called, nothing more to do now
|
||||||
return;
|
return;
|
||||||
@@ -125,7 +125,7 @@ void UCreateSessionCallbackProxyAdvanced::OnCreateCompleted(FName SessionName, b
|
|||||||
if (bWasSuccessful)
|
if (bWasSuccessful)
|
||||||
{
|
{
|
||||||
StartCompleteDelegateHandle = Sessions->AddOnStartSessionCompleteDelegate_Handle(StartCompleteDelegate);
|
StartCompleteDelegateHandle = Sessions->AddOnStartSessionCompleteDelegate_Handle(StartCompleteDelegate);
|
||||||
Sessions->StartSession(GameSessionName);
|
Sessions->StartSession(NAME_GameSession);
|
||||||
|
|
||||||
// OnStartCompleted will get called, nothing more to do now
|
// OnStartCompleted will get called, nothing more to do now
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||||||
|
|
||||||
#include "EndSessionCallbackProxy.h"
|
#include "EndSessionCallbackProxy.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -30,12 +29,12 @@ void UEndSessionCallbackProxy::Activate()
|
|||||||
auto Sessions = Helper.OnlineSub->GetSessionInterface();
|
auto Sessions = Helper.OnlineSub->GetSessionInterface();
|
||||||
if (Sessions.IsValid())
|
if (Sessions.IsValid())
|
||||||
{
|
{
|
||||||
FNamedOnlineSession* Session = Sessions->GetNamedSession(GameSessionName);
|
FNamedOnlineSession* Session = Sessions->GetNamedSession(NAME_GameSession);
|
||||||
if (Session &&
|
if (Session &&
|
||||||
Session->SessionState == EOnlineSessionState::InProgress)
|
Session->SessionState == EOnlineSessionState::InProgress)
|
||||||
{
|
{
|
||||||
DelegateHandle = Sessions->AddOnEndSessionCompleteDelegate_Handle(Delegate);
|
DelegateHandle = Sessions->AddOnEndSessionCompleteDelegate_Handle(Delegate);
|
||||||
Sessions->EndSession(GameSessionName);
|
Sessions->EndSession(NAME_GameSession);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ void UFindFriendSessionCallbackProxy::Activate()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IOnlineSessionPtr Sessions = Online::GetSessionInterface();
|
IOnlineSessionPtr Sessions = Online::GetSessionInterface(GetWorld());
|
||||||
|
|
||||||
if (Sessions.IsValid())
|
if (Sessions.IsValid())
|
||||||
{
|
{
|
||||||
@@ -71,7 +71,7 @@ void UFindFriendSessionCallbackProxy::Activate()
|
|||||||
|
|
||||||
void UFindFriendSessionCallbackProxy::OnFindFriendSessionCompleted(int32 LocalPlayer, bool bWasSuccessful, const TArray<FOnlineSessionSearchResult>& SessionInfo)
|
void UFindFriendSessionCallbackProxy::OnFindFriendSessionCompleted(int32 LocalPlayer, bool bWasSuccessful, const TArray<FOnlineSessionSearchResult>& SessionInfo)
|
||||||
{
|
{
|
||||||
IOnlineSessionPtr Sessions = Online::GetSessionInterface();
|
IOnlineSessionPtr Sessions = Online::GetSessionInterface(GetWorld());
|
||||||
|
|
||||||
if (Sessions.IsValid())
|
if (Sessions.IsValid())
|
||||||
Sessions->ClearOnFindFriendSessionCompleteDelegate_Handle(LocalPlayer, FindFriendSessionCompleteDelegateHandle);
|
Sessions->ClearOnFindFriendSessionCompleteDelegate_Handle(LocalPlayer, FindFriendSessionCompleteDelegateHandle);
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||||||
|
|
||||||
#include "FindSessionsCallbackProxyAdvanced.h"
|
#include "FindSessionsCallbackProxyAdvanced.h"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ UUpdateSessionCallbackProxyAdvanced* UUpdateSessionCallbackProxyAdvanced::Update
|
|||||||
void UUpdateSessionCallbackProxyAdvanced::Activate()
|
void UUpdateSessionCallbackProxyAdvanced::Activate()
|
||||||
{
|
{
|
||||||
|
|
||||||
IOnlineSessionPtr Sessions = Online::GetSessionInterface();
|
IOnlineSessionPtr Sessions = Online::GetSessionInterface(GetWorld());
|
||||||
|
|
||||||
if (Sessions.IsValid())
|
if (Sessions.IsValid())
|
||||||
{
|
{
|
||||||
@@ -42,8 +42,8 @@ void UUpdateSessionCallbackProxyAdvanced::Activate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This gets the actual session itself
|
// This gets the actual session itself
|
||||||
//FNamedOnlineSession * curSession = Sessions->GetNamedSession(GameSessionName);
|
//FNamedOnlineSession * curSession = Sessions->GetNamedSession(NAME_GameSession);
|
||||||
FOnlineSessionSettings* Settings = Sessions->GetSessionSettings(GameSessionName);
|
FOnlineSessionSettings* Settings = Sessions->GetSessionSettings(NAME_GameSession);
|
||||||
|
|
||||||
if (!Settings)
|
if (!Settings)
|
||||||
{
|
{
|
||||||
@@ -85,7 +85,7 @@ void UUpdateSessionCallbackProxyAdvanced::Activate()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Sessions->UpdateSession(GameSessionName, *Settings, bRefreshOnlineData);
|
Sessions->UpdateSession(NAME_GameSession, *Settings, bRefreshOnlineData);
|
||||||
|
|
||||||
// OnUpdateCompleted will get called, nothing more to do now
|
// OnUpdateCompleted will get called, nothing more to do now
|
||||||
return;
|
return;
|
||||||
@@ -101,7 +101,7 @@ void UUpdateSessionCallbackProxyAdvanced::Activate()
|
|||||||
|
|
||||||
void UUpdateSessionCallbackProxyAdvanced::OnUpdateCompleted(FName SessionName, bool bWasSuccessful)
|
void UUpdateSessionCallbackProxyAdvanced::OnUpdateCompleted(FName SessionName, bool bWasSuccessful)
|
||||||
{
|
{
|
||||||
IOnlineSessionPtr Sessions = Online::GetSessionInterface();
|
IOnlineSessionPtr Sessions = Online::GetSessionInterface(GetWorld());
|
||||||
if (Sessions.IsValid())
|
if (Sessions.IsValid())
|
||||||
{
|
{
|
||||||
Sessions->ClearOnUpdateSessionCompleteDelegate_Handle(OnUpdateSessionCompleteDelegateHandle);
|
Sessions->ClearOnUpdateSessionCompleteDelegate_Handle(OnUpdateSessionCompleteDelegateHandle);
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
"FileVersion" : 3,
|
"FileVersion" : 3,
|
||||||
|
|
||||||
"FriendlyName" : "Advanced Steam Sessions",
|
"FriendlyName" : "Advanced Steam Sessions",
|
||||||
"Version" : 4.21,
|
"Version" : 4.26,
|
||||||
"VersionName": "4.21",
|
"VersionName": "4.26",
|
||||||
"Description" : "Adds new blueprint functions to handle more advanced session operations in Steam. REQUIRES ADVANCED SESSIONS",
|
"Description" : "Adds new blueprint functions to handle more advanced session operations in Steam. REQUIRES ADVANCED SESSIONS",
|
||||||
"Category" : "Advanced Sessions Plugin",
|
"Category" : "Advanced Sessions Plugin",
|
||||||
"CreatedBy" : "Joshua Statzer",
|
"CreatedBy" : "Joshua Statzer",
|
||||||
|
|||||||
@@ -242,6 +242,7 @@ DECLARE_LOG_CATEGORY_EXTERN(AdvancedSteamFriendsLog, Log, All);
|
|||||||
UENUM(Blueprintable)
|
UENUM(Blueprintable)
|
||||||
enum class SteamAvatarSize : uint8
|
enum class SteamAvatarSize : uint8
|
||||||
{
|
{
|
||||||
|
SteamAvatar_INVALID = 0,
|
||||||
SteamAvatar_Small = 1,
|
SteamAvatar_Small = 1,
|
||||||
SteamAvatar_Medium = 2,
|
SteamAvatar_Medium = 2,
|
||||||
SteamAvatar_Large = 3
|
SteamAvatar_Large = 3
|
||||||
@@ -304,6 +305,19 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
UENUM(Blueprintable)
|
||||||
|
enum class EBPTextFilteringContext : uint8
|
||||||
|
{
|
||||||
|
/*Unknown context.*/
|
||||||
|
FContext_Unknown = 0,
|
||||||
|
/*Game content, only legally required filtering is performed.*/
|
||||||
|
FContext_GameContent = 1,
|
||||||
|
/*Char from another player.*/
|
||||||
|
FContext_Chat = 2,
|
||||||
|
/*Character or item name.*/
|
||||||
|
FContext_Name = 3
|
||||||
|
};
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UAdvancedSteamFriendsLibrary : public UBlueprintFunctionLibrary
|
class UAdvancedSteamFriendsLibrary : public UBlueprintFunctionLibrary
|
||||||
{
|
{
|
||||||
@@ -324,6 +338,10 @@ public:
|
|||||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI")
|
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI")
|
||||||
static bool OpenSteamUserOverlay(const FBPUniqueNetId UniqueNetId, ESteamUserOverlayType DialogType);
|
static bool OpenSteamUserOverlay(const FBPUniqueNetId UniqueNetId, ESteamUserOverlayType DialogType);
|
||||||
|
|
||||||
|
// Returns if the steam overlay is currently active (this can return false during initial overlay hooking)
|
||||||
|
UFUNCTION(BlueprintPure, Category = "Online|AdvancedFriends|SteamAPI")
|
||||||
|
static bool IsOverlayEnabled();
|
||||||
|
|
||||||
// Gets the level of a friends steam account, STEAM ONLY, Returns -1 if the steam level is not known, might need RequestSteamFriendInfo called first.
|
// Gets the level of a friends steam account, STEAM ONLY, Returns -1 if the steam level is not known, might need RequestSteamFriendInfo called first.
|
||||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI")
|
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI")
|
||||||
static int32 GetFriendSteamLevel(const FBPUniqueNetId UniqueNetId);
|
static int32 GetFriendSteamLevel(const FBPUniqueNetId UniqueNetId);
|
||||||
@@ -349,4 +367,21 @@ public:
|
|||||||
// Get a full list of steam groups
|
// Get a full list of steam groups
|
||||||
UFUNCTION(BlueprintCallable, Category = "Online|SteamAPI|SteamGroups")
|
UFUNCTION(BlueprintCallable, Category = "Online|SteamAPI|SteamGroups")
|
||||||
static void GetSteamGroups(TArray<FBPSteamGroupInfo> & SteamGroups);
|
static void GetSteamGroups(TArray<FBPSteamGroupInfo> & SteamGroups);
|
||||||
|
|
||||||
|
// Initializes text filtering (pre-loading dictonaries)
|
||||||
|
// Returns if it succeeded, false if filtering is unavailable for the games language
|
||||||
|
UFUNCTION(BlueprintCallable, Category = "Online|SteamAPI|TextFiltering")
|
||||||
|
static bool InitTextFiltering();
|
||||||
|
|
||||||
|
// Attempts to filter a string with the given filtering context
|
||||||
|
// Returns true if the text has been filtered, false if it hasn't (no filtering required or operation failed)
|
||||||
|
// If false it will still output the original text
|
||||||
|
// Textsource is the steam id that is the source of the text (player name / chat)
|
||||||
|
// Requires that InitTextFiltering be called first!!
|
||||||
|
UFUNCTION(BlueprintCallable, Category = "Online|SteamAPI|TextFiltering")
|
||||||
|
static bool FilterText(FString TextToFilter, EBPTextFilteringContext Context, const FBPUniqueNetId TextSourceID, FString& FilteredText);
|
||||||
|
|
||||||
|
// Returns if steam is running in big picture mode
|
||||||
|
UFUNCTION(BlueprintPure, Category = "Online|SteamAPI")
|
||||||
|
static bool IsSteamInBigPictureMode();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
#include "Online.h"
|
#include "Online.h"
|
||||||
#include "OnlineSubsystem.h"
|
#include "OnlineSubsystem.h"
|
||||||
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
||||||
|
#include "steam/isteamugc.h"
|
||||||
|
#include "steam/isteamremotestorage.h"
|
||||||
#endif
|
#endif
|
||||||
#include "Interfaces/OnlineSessionInterface.h"
|
#include "Interfaces/OnlineSessionInterface.h"
|
||||||
|
|
||||||
@@ -24,16 +26,16 @@
|
|||||||
#pragma push_macro("ARRAY_COUNT")
|
#pragma push_macro("ARRAY_COUNT")
|
||||||
#undef ARRAY_COUNT
|
#undef ARRAY_COUNT
|
||||||
|
|
||||||
#if USING_CODE_ANALYSIS
|
#if USING_CODE_ANALYSIS
|
||||||
MSVC_PRAGMA(warning(push))
|
MSVC_PRAGMA(warning(push))
|
||||||
MSVC_PRAGMA(warning(disable : ALL_CODE_ANALYSIS_WARNINGS))
|
MSVC_PRAGMA(warning(disable : ALL_CODE_ANALYSIS_WARNINGS))
|
||||||
#endif // USING_CODE_ANALYSIS
|
#endif // USING_CODE_ANALYSIS
|
||||||
|
|
||||||
#include <steam/steam_api.h>
|
#include <steam/steam_api.h>
|
||||||
|
|
||||||
#if USING_CODE_ANALYSIS
|
#if USING_CODE_ANALYSIS
|
||||||
MSVC_PRAGMA(warning(pop))
|
MSVC_PRAGMA(warning(pop))
|
||||||
#endif // USING_CODE_ANALYSIS
|
#endif // USING_CODE_ANALYSIS
|
||||||
|
|
||||||
|
|
||||||
#pragma pop_macro("ARRAY_COUNT")
|
#pragma pop_macro("ARRAY_COUNT")
|
||||||
@@ -81,6 +83,7 @@ public:
|
|||||||
UENUM(BlueprintType)
|
UENUM(BlueprintType)
|
||||||
enum class FBPSteamResult : uint8
|
enum class FBPSteamResult : uint8
|
||||||
{
|
{
|
||||||
|
K_EResultInvalid = 0,
|
||||||
k_EResultOK = 1, // success
|
k_EResultOK = 1, // success
|
||||||
k_EResultFail = 2, // generic failure
|
k_EResultFail = 2, // generic failure
|
||||||
k_EResultNoConnection = 3, // no/failed network connection
|
k_EResultNoConnection = 3, // no/failed network connection
|
||||||
|
|||||||
@@ -255,6 +255,19 @@ bool UAdvancedSteamFriendsLibrary::OpenSteamUserOverlay(const FBPUniqueNetId Uni
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool UAdvancedSteamFriendsLibrary::IsOverlayEnabled()
|
||||||
|
{
|
||||||
|
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
||||||
|
if (SteamAPI_Init())
|
||||||
|
{
|
||||||
|
return SteamUtils()->IsOverlayEnabled();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("OpenSteamUserOverlay Couldn't init steamAPI!"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
UTexture2D * UAdvancedSteamFriendsLibrary::GetSteamFriendAvatar(const FBPUniqueNetId UniqueNetId, EBlueprintAsyncResultSwitch &Result, SteamAvatarSize AvatarSize)
|
UTexture2D * UAdvancedSteamFriendsLibrary::GetSteamFriendAvatar(const FBPUniqueNetId UniqueNetId, EBlueprintAsyncResultSwitch &Result, SteamAvatarSize AvatarSize)
|
||||||
{
|
{
|
||||||
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
||||||
@@ -328,7 +341,7 @@ UTexture2D * UAdvancedSteamFriendsLibrary::GetSteamFriendAvatar(const FBPUniqueN
|
|||||||
delete[] oAvatarRGBA;
|
delete[] oAvatarRGBA;
|
||||||
|
|
||||||
//Setting some Parameters for the Texture and finally returning it
|
//Setting some Parameters for the Texture and finally returning it
|
||||||
Avatar->PlatformData->NumSlices = 1;
|
Avatar->PlatformData->SetNumSlices(1);
|
||||||
Avatar->NeverStream = true;
|
Avatar->NeverStream = true;
|
||||||
//Avatar->CompressionSettings = TC_EditorIcon;
|
//Avatar->CompressionSettings = TC_EditorIcon;
|
||||||
|
|
||||||
@@ -350,4 +363,66 @@ UTexture2D * UAdvancedSteamFriendsLibrary::GetSteamFriendAvatar(const FBPUniqueN
|
|||||||
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("STEAM Couldn't be verified as initialized"));
|
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("STEAM Couldn't be verified as initialized"));
|
||||||
Result = EBlueprintAsyncResultSwitch::OnFailure;
|
Result = EBlueprintAsyncResultSwitch::OnFailure;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UAdvancedSteamFriendsLibrary::InitTextFiltering()
|
||||||
|
{
|
||||||
|
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
||||||
|
|
||||||
|
if (SteamAPI_Init())
|
||||||
|
{
|
||||||
|
return SteamUtils()->InitFilterText();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UAdvancedSteamFriendsLibrary::FilterText(FString TextToFilter, EBPTextFilteringContext Context, const FBPUniqueNetId TextSourceID, FString& FilteredText)
|
||||||
|
{
|
||||||
|
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
||||||
|
|
||||||
|
if (SteamAPI_Init())
|
||||||
|
{
|
||||||
|
uint32 BufferLen = TextToFilter.Len() + 10; // Docs say 1 byte excess min, going with 10
|
||||||
|
char* OutText = new char[BufferLen];
|
||||||
|
|
||||||
|
uint64 id = 0;
|
||||||
|
|
||||||
|
if (TextSourceID.IsValid())
|
||||||
|
{
|
||||||
|
id = *((uint64*)TextSourceID.UniqueNetId->GetBytes());
|
||||||
|
}
|
||||||
|
|
||||||
|
int FilterCount = SteamUtils()->FilterText(OutText, BufferLen, TCHAR_TO_ANSI(*TextToFilter), Context == EBPTextFilteringContext::FContext_GameContent);
|
||||||
|
|
||||||
|
if (FilterCount > 0)
|
||||||
|
{
|
||||||
|
FilteredText = FString(UTF8_TO_TCHAR(OutText));
|
||||||
|
delete[] OutText;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete[] OutText;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
FilteredText = TextToFilter;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UAdvancedSteamFriendsLibrary::IsSteamInBigPictureMode()
|
||||||
|
{
|
||||||
|
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
||||||
|
|
||||||
|
if (SteamAPI_Init())
|
||||||
|
{
|
||||||
|
return SteamUtils()->IsSteamInBigPictureMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "AdvancedSteamFriendsLibrary.h"
|
#include "AdvancedSteamFriendsLibrary.h"
|
||||||
#include "OnlineSubSystemHeader.h"
|
#include "OnlineSubSystemHeader.h"
|
||||||
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
||||||
|
#include "steam/isteamfriends.h"
|
||||||
#endif
|
#endif
|
||||||
//#include "OnlineSubsystemSteamTypes.h"
|
//#include "OnlineSubsystemSteamTypes.h"
|
||||||
|
|
||||||
@@ -29,13 +30,13 @@ USteamRequestGroupOfficersCallbackProxy* USteamRequestGroupOfficersCallbackProxy
|
|||||||
}
|
}
|
||||||
|
|
||||||
void USteamRequestGroupOfficersCallbackProxy::Activate()
|
void USteamRequestGroupOfficersCallbackProxy::Activate()
|
||||||
{
|
{
|
||||||
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
||||||
if (SteamAPI_Init())
|
if (SteamAPI_Init())
|
||||||
{
|
{
|
||||||
uint64 id = *((uint64*)GroupUniqueID.UniqueNetId->GetBytes());
|
uint64 id = *((uint64*)GroupUniqueID.UniqueNetId->GetBytes());
|
||||||
SteamAPICall_t hSteamAPICall = SteamFriends()->RequestClanOfficerList(id);
|
SteamAPICall_t hSteamAPICall = SteamFriends()->RequestClanOfficerList(id);
|
||||||
|
|
||||||
m_callResultGroupOfficerRequestDetails.Set(hSteamAPICall, this, &USteamRequestGroupOfficersCallbackProxy::OnRequestGroupOfficerDetails);
|
m_callResultGroupOfficerRequestDetails.Set(hSteamAPICall, this, &USteamRequestGroupOfficersCallbackProxy::OnRequestGroupOfficerDetails);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -45,76 +46,76 @@ void USteamRequestGroupOfficersCallbackProxy::Activate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
||||||
void USteamRequestGroupOfficersCallbackProxy::OnRequestGroupOfficerDetails(ClanOfficerListResponse_t *pResult, bool bIOFailure)
|
void USteamRequestGroupOfficersCallbackProxy::OnRequestGroupOfficerDetails(ClanOfficerListResponse_t *pResult, bool bIOFailure)
|
||||||
{
|
{
|
||||||
TArray<FBPSteamGroupOfficer> OfficerArray;
|
TArray<FBPSteamGroupOfficer> OfficerArray;
|
||||||
|
|
||||||
FOnlineSubsystemSteam* SteamSubsystem = (FOnlineSubsystemSteam*)(IOnlineSubsystem::Get(STEAM_SUBSYSTEM));
|
FOnlineSubsystemSteam* SteamSubsystem = (FOnlineSubsystemSteam*)(IOnlineSubsystem::Get(STEAM_SUBSYSTEM));
|
||||||
|
|
||||||
if (bIOFailure || !pResult || !pResult->m_bSuccess)
|
if (bIOFailure || !pResult || !pResult->m_bSuccess)
|
||||||
{
|
{
|
||||||
if (SteamSubsystem != nullptr)
|
if (SteamSubsystem != nullptr)
|
||||||
{
|
{
|
||||||
SteamSubsystem->ExecuteNextTick([this]()
|
SteamSubsystem->ExecuteNextTick([this]()
|
||||||
{
|
{
|
||||||
TArray<FBPSteamGroupOfficer> FailureArray;
|
TArray<FBPSteamGroupOfficer> FailureArray;
|
||||||
OnFailure.Broadcast(FailureArray);
|
OnFailure.Broadcast(FailureArray);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//OnFailure.Broadcast(OfficerArray);
|
//OnFailure.Broadcast(OfficerArray);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SteamAPI_Init())
|
if (SteamAPI_Init())
|
||||||
{
|
{
|
||||||
uint64 id = *((uint64*)GroupUniqueID.UniqueNetId->GetBytes());
|
uint64 id = *((uint64*)GroupUniqueID.UniqueNetId->GetBytes());
|
||||||
|
|
||||||
FBPSteamGroupOfficer Officer;
|
FBPSteamGroupOfficer Officer;
|
||||||
CSteamID ClanOwner = SteamFriends()->GetClanOwner(id);
|
CSteamID ClanOwner = SteamFriends()->GetClanOwner(id);
|
||||||
|
|
||||||
Officer.bIsOwner = true;
|
Officer.bIsOwner = true;
|
||||||
|
|
||||||
TSharedPtr<const FUniqueNetId> ValueID(new const FUniqueNetIdSteam2(ClanOwner));
|
TSharedPtr<const FUniqueNetId> ValueID(new const FUniqueNetIdSteam2(ClanOwner));
|
||||||
Officer.OfficerUniqueNetID.SetUniqueNetId(ValueID);
|
Officer.OfficerUniqueNetID.SetUniqueNetId(ValueID);
|
||||||
OfficerArray.Add(Officer);
|
OfficerArray.Add(Officer);
|
||||||
|
|
||||||
for (int i = 0; i < pResult->m_cOfficers; i++)
|
for (int i = 0; i < pResult->m_cOfficers; i++)
|
||||||
{
|
{
|
||||||
CSteamID OfficerSteamID = SteamFriends()->GetClanOfficerByIndex(id, i);
|
CSteamID OfficerSteamID = SteamFriends()->GetClanOfficerByIndex(id, i);
|
||||||
|
|
||||||
Officer.bIsOwner = false;
|
Officer.bIsOwner = false;
|
||||||
|
|
||||||
TSharedPtr<const FUniqueNetId> newValueID(new const FUniqueNetIdSteam2(OfficerSteamID));
|
TSharedPtr<const FUniqueNetId> newValueID(new const FUniqueNetIdSteam2(OfficerSteamID));
|
||||||
Officer.OfficerUniqueNetID.SetUniqueNetId(newValueID);
|
Officer.OfficerUniqueNetID.SetUniqueNetId(newValueID);
|
||||||
|
|
||||||
OfficerArray.Add(Officer);
|
OfficerArray.Add(Officer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SteamSubsystem != nullptr)
|
if (SteamSubsystem != nullptr)
|
||||||
{
|
{
|
||||||
SteamSubsystem->ExecuteNextTick([OfficerArray, this]()
|
SteamSubsystem->ExecuteNextTick([OfficerArray, this]()
|
||||||
{
|
{
|
||||||
OnSuccess.Broadcast(OfficerArray);
|
OnSuccess.Broadcast(OfficerArray);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//OnSuccess.Broadcast(OfficerArray);
|
//OnSuccess.Broadcast(OfficerArray);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (SteamSubsystem != nullptr)
|
if (SteamSubsystem != nullptr)
|
||||||
{
|
{
|
||||||
SteamSubsystem->ExecuteNextTick([this]()
|
SteamSubsystem->ExecuteNextTick([this]()
|
||||||
{
|
{
|
||||||
TArray<FBPSteamGroupOfficer> FailureArray;
|
TArray<FBPSteamGroupOfficer> FailureArray;
|
||||||
OnFailure.Broadcast(FailureArray);
|
OnFailure.Broadcast(FailureArray);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should never hit this anyway
|
// Should never hit this anyway
|
||||||
//OnFailure.Broadcast(OfficerArray);
|
//OnFailure.Broadcast(OfficerArray);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "SteamWSRequestUGCDetailsCallbackProxy.h"
|
#include "SteamWSRequestUGCDetailsCallbackProxy.h"
|
||||||
#include "OnlineSubSystemHeader.h"
|
#include "OnlineSubSystemHeader.h"
|
||||||
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
||||||
|
#include "steam/isteamugc.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
@@ -23,13 +24,13 @@ USteamWSRequestUGCDetailsCallbackProxy* USteamWSRequestUGCDetailsCallbackProxy::
|
|||||||
}
|
}
|
||||||
|
|
||||||
void USteamWSRequestUGCDetailsCallbackProxy::Activate()
|
void USteamWSRequestUGCDetailsCallbackProxy::Activate()
|
||||||
{
|
{
|
||||||
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
||||||
if (SteamAPI_Init())
|
if (SteamAPI_Init())
|
||||||
{
|
{
|
||||||
// #TODO: Support arrays instead in the future?
|
// #TODO: Support arrays instead in the future?
|
||||||
UGCQueryHandle_t hQueryHandle = SteamUGC()->CreateQueryUGCDetailsRequest((PublishedFileId_t *)&WorkShopID.SteamWorkshopID, 1);
|
UGCQueryHandle_t hQueryHandle = SteamUGC()->CreateQueryUGCDetailsRequest((PublishedFileId_t *)&WorkShopID.SteamWorkshopID, 1);
|
||||||
// #TODO: add search settings here by calling into the handle?
|
// #TODO: add search settings here by calling into the handle?
|
||||||
SteamAPICall_t hSteamAPICall = SteamUGC()->SendQueryUGCRequest(hQueryHandle);
|
SteamAPICall_t hSteamAPICall = SteamUGC()->SendQueryUGCRequest(hQueryHandle);
|
||||||
|
|
||||||
// Need to release the query
|
// Need to release the query
|
||||||
@@ -49,52 +50,52 @@ void USteamWSRequestUGCDetailsCallbackProxy::Activate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
||||||
void USteamWSRequestUGCDetailsCallbackProxy::OnUGCRequestUGCDetails(SteamUGCQueryCompleted_t *pResult, bool bIOFailure)
|
void USteamWSRequestUGCDetailsCallbackProxy::OnUGCRequestUGCDetails(SteamUGCQueryCompleted_t *pResult, bool bIOFailure)
|
||||||
{
|
{
|
||||||
FOnlineSubsystemSteam* SteamSubsystem = (FOnlineSubsystemSteam*)(IOnlineSubsystem::Get(STEAM_SUBSYSTEM));
|
FOnlineSubsystemSteam* SteamSubsystem = (FOnlineSubsystemSteam*)(IOnlineSubsystem::Get(STEAM_SUBSYSTEM));
|
||||||
|
|
||||||
if (bIOFailure || !pResult || pResult->m_unNumResultsReturned <= 0)
|
if (bIOFailure || !pResult || pResult->m_unNumResultsReturned <= 0)
|
||||||
{
|
{
|
||||||
if (SteamSubsystem != nullptr)
|
if (SteamSubsystem != nullptr)
|
||||||
{
|
{
|
||||||
SteamSubsystem->ExecuteNextTick([this]()
|
SteamSubsystem->ExecuteNextTick([this]()
|
||||||
{
|
{
|
||||||
OnFailure.Broadcast(FBPSteamWorkshopItemDetails());
|
OnFailure.Broadcast(FBPSteamWorkshopItemDetails());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//OnFailure.Broadcast(FBPSteamWorkshopItemDetails());
|
//OnFailure.Broadcast(FBPSteamWorkshopItemDetails());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (SteamAPI_Init())
|
if (SteamAPI_Init())
|
||||||
{
|
{
|
||||||
SteamUGCDetails_t Details;
|
SteamUGCDetails_t Details;
|
||||||
if (SteamUGC()->GetQueryUGCResult(pResult->m_handle, 0, &Details))
|
if (SteamUGC()->GetQueryUGCResult(pResult->m_handle, 0, &Details))
|
||||||
{
|
{
|
||||||
if (SteamSubsystem != nullptr)
|
if (SteamSubsystem != nullptr)
|
||||||
{
|
{
|
||||||
SteamSubsystem->ExecuteNextTick([Details, this]()
|
SteamSubsystem->ExecuteNextTick([Details, this]()
|
||||||
{
|
{
|
||||||
OnSuccess.Broadcast(FBPSteamWorkshopItemDetails(Details));
|
OnSuccess.Broadcast(FBPSteamWorkshopItemDetails(Details));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//OnSuccess.Broadcast(FBPSteamWorkshopItemDetails(Details));
|
//OnSuccess.Broadcast(FBPSteamWorkshopItemDetails(Details));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (SteamSubsystem != nullptr)
|
if (SteamSubsystem != nullptr)
|
||||||
{
|
{
|
||||||
SteamSubsystem->ExecuteNextTick([this]()
|
SteamSubsystem->ExecuteNextTick([this]()
|
||||||
{
|
{
|
||||||
OnFailure.Broadcast(FBPSteamWorkshopItemDetails());
|
OnFailure.Broadcast(FBPSteamWorkshopItemDetails());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not needed, should never hit here
|
// Not needed, should never hit here
|
||||||
//OnFailure.Broadcast(FBPSteamWorkshopItemDetails());
|
//OnFailure.Broadcast(FBPSteamWorkshopItemDetails());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
**KantanDocGen Automatic Documentation ([KantanDocGen](http://kantandev.com/free/kantan-doc-gen))**
|
**KantanDocGen Automatic Documentation ([KantanDocGen](http://kantandev.com/free/kantan-doc-gen))**
|
||||||
|
|
||||||
**[AdvancedSessions](https://mordentral.bitbucket.io/AdvancedSessions/Advanced)**
|
**[AdvancedSessions](https://vreue4.com/generated-node-documentation?section=advanced-sessions-plugin)**
|
||||||
|
|
||||||
**[AdvancedSteamSessions](https://mordentral.bitbucket.io/AdvancedSteamSessions/Advanced)**
|
**[AdvancedSteamSessions](https://vreue4.com/generated-node-documentation?section=advanced-steam-sessions-plugin)**
|
||||||
|
|||||||
Reference in New Issue
Block a user