mirror of
https://github.com/mordentral/AdvancedSessionsPlugin.git
synced 2025-10-26 18:04:07 +00:00
Compare commits
61 Commits
4.26-Locke
...
5.0-Locked
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76e08581f5 | ||
|
|
382ed08217 | ||
|
|
f760855494 | ||
|
|
fe76b60b2e | ||
|
|
7f1b47f42d | ||
|
|
3ac5d6c664 | ||
|
|
fd33fc34a5 | ||
|
|
bc26be2a12 | ||
|
|
936532f1a0 | ||
|
|
64710df075 | ||
|
|
ab9de1b344 | ||
|
|
bf4d99cba8 | ||
|
|
f7f56e7038 | ||
|
|
90fff579ba | ||
|
|
2520d15e54 | ||
|
|
fbbb39c06c | ||
|
|
4922cd2154 | ||
|
|
36cb58ea15 | ||
|
|
e9747ff440 | ||
|
|
e1ed0f22b6 | ||
|
|
0de641f7d9 | ||
|
|
295ab98a91 | ||
|
|
18475eb2ef | ||
|
|
9784cd2f01 | ||
|
|
ee9252a0df | ||
|
|
b3cc471bf3 | ||
|
|
9bb2c553cd | ||
|
|
56639eb4a7 | ||
|
|
31c4be3629 | ||
|
|
2e43a65acd | ||
|
|
09bbe211a8 | ||
|
|
fded4d065b | ||
|
|
b0ae86b017 | ||
|
|
4d913be381 | ||
|
|
b986d7be2d | ||
|
|
82b2f9f594 | ||
|
|
ec634238f8 | ||
|
|
21b5b139d9 | ||
|
|
7b8bebac66 | ||
|
|
444b632a72 | ||
|
|
8192f73ca7 | ||
|
|
f2a33fe1c6 | ||
|
|
c59f4bba43 | ||
|
|
7b21ee2344 | ||
|
|
94fb993ad7 | ||
|
|
b72b0d59fe | ||
|
|
5b2260079c | ||
|
|
c4df122248 | ||
|
|
6065bd9a36 | ||
|
|
d67c039088 | ||
|
|
6c392ee1fb | ||
|
|
4b7cffc1c0 | ||
|
|
0be6427845 | ||
|
|
816b701963 | ||
|
|
e9bea6cac0 | ||
|
|
a63bb0916a | ||
|
|
1f6b7dbb3b | ||
|
|
c391737812 | ||
|
|
156025af2d | ||
|
|
ce25430643 | ||
|
|
dfb5ad544a |
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
* text=auto
|
||||
*.bat eol=crlf
|
||||
@@ -1,20 +1,17 @@
|
||||
{
|
||||
"FileVersion" : 3,
|
||||
|
||||
"FriendlyName" : "Advanced Sessions",
|
||||
"Version" : 4.26,
|
||||
"VersionName": "4.26",
|
||||
"Description" : "Adds new blueprint functions to handle more advanced session operations.",
|
||||
"Category" : "Advanced Sessions Plugin",
|
||||
"CreatedBy" : "Joshua Statzer",
|
||||
"CreatedByURL" : "N/A",
|
||||
|
||||
"Modules" :
|
||||
[
|
||||
"FileVersion": 3,
|
||||
"FriendlyName": "Advanced Sessions",
|
||||
"Version": 4,
|
||||
"VersionName": "5.0",
|
||||
"Description": "Adds new blueprint functions to handle more advanced session operations.",
|
||||
"Category": "Advanced Sessions Plugin",
|
||||
"CreatedBy": "Joshua Statzer",
|
||||
"CreatedByURL": "N/A",
|
||||
"Modules": [
|
||||
{
|
||||
"Name" : "AdvancedSessions",
|
||||
"Type" : "RunTime",
|
||||
"LoadingPhase" : "PreDefault"
|
||||
"Name": "AdvancedSessions",
|
||||
"Type": "Runtime",
|
||||
"LoadingPhase": "PreDefault"
|
||||
}
|
||||
],
|
||||
"Plugins": [
|
||||
@@ -26,5 +23,12 @@
|
||||
"Name": "OnlineSubsystemUtils",
|
||||
"Enabled": true
|
||||
}
|
||||
]
|
||||
],
|
||||
"DocsURL": "",
|
||||
"MarketplaceURL": "",
|
||||
"SupportURL": "",
|
||||
"CanContainContent": false,
|
||||
"IsBetaVersion": false,
|
||||
"IsExperimentalVersion": false,
|
||||
"Installed": false
|
||||
}
|
||||
8
AdvancedSessions/Config/FilterPlugin.ini
Normal file
8
AdvancedSessions/Config/FilterPlugin.ini
Normal file
@@ -0,0 +1,8 @@
|
||||
[FilterPlugin]
|
||||
; This section lists additional files which will be packaged along with your plugin. Paths should be listed relative to the root plugin directory, and
|
||||
; may include "...", "*", and "?" wildcards to match directories, files, and individual characters respectively.
|
||||
;
|
||||
; Examples:
|
||||
; /README.txt
|
||||
; /Extras/...
|
||||
; /Binaries/ThirdParty/*.dll
|
||||
@@ -160,6 +160,10 @@ public:
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|PlayerID")
|
||||
static void GetUniqueNetID(APlayerController *PlayerController, FBPUniqueNetId &UniqueNetId);
|
||||
|
||||
// Get the unique net id of a network player attached to the given controller
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|PlayerID")
|
||||
static void GetUniqueNetIdOfSessionOwner(FBlueprintSessionResult SessionResult, FBPUniqueNetId& UniqueNetId);
|
||||
|
||||
// Get the unique net id of a network player who is assigned the the given player state
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|PlayerID")
|
||||
static void GetUniqueNetIDFromPlayerState(APlayerState *PlayerState, FBPUniqueNetId &UniqueNetId);
|
||||
@@ -200,5 +204,10 @@ public:
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|Misc")
|
||||
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);
|
||||
|
||||
};
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "BlueprintDataDefinitions.h"
|
||||
#include "Interfaces/OnlineIdentityInterface.h"
|
||||
#include "Engine/LocalPlayer.h"
|
||||
#include "AutoLoginUserCallbackProxy.generated.h"
|
||||
|
||||
UCLASS(MinimalAPI)
|
||||
class UAutoLoginUserCallbackProxy : public UOnlineBlueprintCallProxyBase
|
||||
{
|
||||
GENERATED_UCLASS_BODY()
|
||||
|
||||
// Called when there is a successful destroy
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FEmptyOnlineDelegate OnSuccess;
|
||||
|
||||
// Called when there is an unsuccessful destroy
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FEmptyOnlineDelegate OnFailure;
|
||||
|
||||
/**
|
||||
* Logs the player into the online service using parameters passed on the
|
||||
* command line. Expects -AUTH_LOGIN=<UserName> -AUTH_PASSWORD=<password>. If either
|
||||
* are missing, the function returns false and doesn't start the login
|
||||
* process
|
||||
*
|
||||
* @param LocalUserNum the controller number of the associated user
|
||||
*
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedIdentity")
|
||||
static UAutoLoginUserCallbackProxy* AutoLoginUser(UObject* WorldContextObject, int32 LocalUserNum);
|
||||
|
||||
// UOnlineBlueprintCallProxyBase interface
|
||||
virtual void Activate() override;
|
||||
// End of UOnlineBlueprintCallProxyBase interface
|
||||
|
||||
private:
|
||||
// Internal callback when the operation completes, calls out to the public success/failure callbacks
|
||||
void OnCompleted(int32 LocalUserNum, bool bWasSuccessful, const FUniqueNetId& UserId, const FString& ErrorVal);
|
||||
|
||||
private:
|
||||
// The controller number of the associated user
|
||||
int32 LocalUserNumber;
|
||||
|
||||
// The delegate executed by the online subsystem
|
||||
FOnLoginCompleteDelegate Delegate;
|
||||
|
||||
// Handle to the registered OnDestroySessionComplete delegate
|
||||
FDelegateHandle DelegateHandle;
|
||||
|
||||
// The world context object in which this call is taking place
|
||||
UObject* WorldContextObject;
|
||||
};
|
||||
@@ -251,23 +251,31 @@ struct FBPFriendPresenceInfo
|
||||
public:
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
||||
bool bIsOnline;
|
||||
bool bIsOnline = false;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
||||
bool bIsPlaying;
|
||||
bool bIsPlaying = false;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
||||
bool bIsPlayingThisGame;
|
||||
bool bIsPlayingThisGame = false;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
||||
bool bIsJoinable;
|
||||
bool bIsJoinable = false;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
||||
bool bHasVoiceSupport;
|
||||
bool bHasVoiceSupport = false;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
||||
EBPOnlinePresenceState PresenceState;
|
||||
EBPOnlinePresenceState PresenceState = EBPOnlinePresenceState::Offline;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
||||
FString StatusString;
|
||||
|
||||
FBPFriendPresenceInfo()
|
||||
{
|
||||
bIsOnline = false;
|
||||
bIsPlaying = false;
|
||||
bIsPlayingThisGame = false;
|
||||
bIsJoinable = false;
|
||||
bHasVoiceSupport = false;
|
||||
PresenceState = EBPOnlinePresenceState::Offline;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FBPFriendInfo
|
||||
{
|
||||
@@ -280,15 +288,22 @@ public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
||||
FString RealName;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
||||
EBPOnlinePresenceState OnlineState;
|
||||
EBPOnlinePresenceState OnlineState = EBPOnlinePresenceState::Offline;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
||||
FBPUniqueNetId UniqueNetId;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
||||
bool bIsPlayingSameGame;
|
||||
bool bIsPlayingSameGame = false;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
||||
FBPFriendPresenceInfo PresenceInfo;
|
||||
|
||||
FBPFriendInfo()
|
||||
{
|
||||
OnlineState = EBPOnlinePresenceState::Offline;
|
||||
bIsPlayingSameGame = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/** The types of comparison operations for a given search query */
|
||||
// Used to compare session properties
|
||||
UENUM(BlueprintType)
|
||||
|
||||
@@ -24,20 +24,23 @@ class UCreateSessionCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase
|
||||
* @param PublicConnections When doing a 'listen' server, this must be >=2 (ListenServer itself counts as a connection)
|
||||
* @param bUseLAN When you want to play LAN, the level to play on must be loaded with option 'bIsLanMatch'
|
||||
* @param bUsePresence Must be true for a 'listen' server (Map must be loaded with option 'listen'), false for a 'dedicated' server.
|
||||
* @param bUseLobbiesIfAvailable Used to flag the subsystem to use a lobby api instead of general hosting if the API supports it, generally true on steam for listen servers and false for dedicated
|
||||
* @param bShouldAdvertise Set to true when the OnlineSubsystem should list your server when someone is searching for servers. Otherwise the server is hidden and only join via invite is possible.
|
||||
* @param bUseLobbiesVoiceChatIfAvailable Set to true to setup voice chat lobbies if the API supports it
|
||||
* @param bStartAfterCreate Set to true to start the session after it's created. If false you need to manually call StartSession when ready.
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject",AutoCreateRefTerm="ExtraSettings"), Category = "Online|AdvancedSessions")
|
||||
static UCreateSessionCallbackProxyAdvanced* CreateAdvancedSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair> &ExtraSettings, class APlayerController* PlayerController = NULL, int32 PublicConnections = 100, int32 PrivateConnections = 0, bool bUseLAN = false, bool bAllowInvites = true, bool bIsDedicatedServer = false, bool bUsePresence = true, bool bAllowJoinViaPresence = true, bool bAllowJoinViaPresenceFriendsOnly = false, bool bAntiCheatProtected = false, bool bUsesStats = false, bool bShouldAdvertise = true);
|
||||
static UCreateSessionCallbackProxyAdvanced* CreateAdvancedSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair>& ExtraSettings, class APlayerController* PlayerController = NULL, int32 PublicConnections = 100, int32 PrivateConnections = 0, bool bUseLAN = false, bool bAllowInvites = true, bool bIsDedicatedServer = false, bool bUsePresence = true, bool bUseLobbiesIfAvailable = true, bool bAllowJoinViaPresence = true, bool bAllowJoinViaPresenceFriendsOnly = false, bool bAntiCheatProtected = false, bool bUsesStats = false, bool bShouldAdvertise = true, bool bUseLobbiesVoiceChatIfAvailable = false, bool bStartAfterCreate = true);
|
||||
|
||||
// UOnlineBlueprintCallProxyBase interface
|
||||
virtual void Activate() override;
|
||||
// End of UOnlineBlueprintCallProxyBase interface
|
||||
|
||||
private:
|
||||
// Internal callback when session creation completes, calls StartSession
|
||||
// Internal callback when session creation completes, optionally calls StartSession
|
||||
void OnCreateCompleted(FName SessionName, bool bWasSuccessful);
|
||||
|
||||
// Internal callback when session creation completes, calls StartSession
|
||||
// Internal callback when session start completes
|
||||
void OnStartCompleted(FName SessionName, bool bWasSuccessful);
|
||||
|
||||
// The player controller triggering things
|
||||
@@ -71,6 +74,9 @@ private:
|
||||
// Whether to use the presence option
|
||||
bool bUsePresence;
|
||||
|
||||
// Whether to prefer the use of lobbies for hosting if the api supports them
|
||||
bool bUseLobbiesIfAvailable;
|
||||
|
||||
// Whether to allow joining via presence
|
||||
bool bAllowJoinViaPresence;
|
||||
|
||||
@@ -86,6 +92,12 @@ private:
|
||||
// Should advertise server?
|
||||
bool bShouldAdvertise;
|
||||
|
||||
// Whether to prefer the use of voice chat lobbies if the api supports them
|
||||
bool bUseLobbiesVoiceChatIfAvailable;
|
||||
|
||||
// Whether to start the session automatically after it is created
|
||||
bool bStartAfterCreate;
|
||||
|
||||
// Store extra settings
|
||||
TArray<FSessionPropertyKeyPair> ExtraSettings;
|
||||
|
||||
|
||||
@@ -19,8 +19,11 @@ class UEndSessionCallbackProxy : public UOnlineBlueprintCallProxyBase
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FEmptyOnlineDelegate OnFailure;
|
||||
|
||||
// Ends the current session
|
||||
UFUNCTION(BlueprintCallable, meta=(DeprecatedFunction,DeprecationMessage = "This function is deprecated, I realized that people have been using it wrong and it doesn't have much use in blueprints. Use Destroy Session only instead.",BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedSessions|Deprecated")
|
||||
/**
|
||||
* Ends the current sessions, Generally for almost all uses you should be using the engines native Destroy Session node instead.
|
||||
* This exists for people using StartSession and optionally hand managing the session state.
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedSessions")
|
||||
static UEndSessionCallbackProxy* EndSession(UObject* WorldContextObject, class APlayerController* PlayerController);
|
||||
|
||||
// UOnlineBlueprintCallProxyBase interface
|
||||
|
||||
@@ -22,7 +22,7 @@ class UFindSessionsCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase
|
||||
|
||||
// Searches for advertised sessions with the default online subsystem and includes an array of filters
|
||||
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject", AutoCreateRefTerm="Filters"), Category = "Online|AdvancedSessions")
|
||||
static UFindSessionsCallbackProxyAdvanced* FindSessionsAdvanced(UObject* WorldContextObject, class APlayerController* PlayerController, int32 MaxResults, bool bUseLAN, EBPServerPresenceSearchType ServerTypeToSearch, const TArray<FSessionsSearchSetting> &Filters, bool bEmptyServersOnly = false, bool bNonEmptyServersOnly = false, bool bSecureServersOnly = false, int MinSlotsAvailable = 0);
|
||||
static UFindSessionsCallbackProxyAdvanced* FindSessionsAdvanced(UObject* WorldContextObject, class APlayerController* PlayerController, int32 MaxResults, bool bUseLAN, EBPServerPresenceSearchType ServerTypeToSearch, const TArray<FSessionsSearchSetting> &Filters, bool bEmptyServersOnly = false, bool bNonEmptyServersOnly = false, bool bSecureServersOnly = false, bool bSearchLobbies = true, int MinSlotsAvailable = 0);
|
||||
|
||||
static bool CompareVariants(const FVariantData &A, const FVariantData &B, EOnlineComparisonOpRedux Comparator);
|
||||
|
||||
@@ -92,6 +92,9 @@ private:
|
||||
// Search for secure servers only
|
||||
bool bSecureServersOnly;
|
||||
|
||||
// Search through lobbies
|
||||
bool bSearchLobbies;
|
||||
|
||||
// Min slots requires to search
|
||||
int MinSlotsAvailable;
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@ class ULoginUserCallbackProxy : public UOnlineBlueprintCallProxyBase
|
||||
FEmptyOnlineDelegate OnFailure;
|
||||
|
||||
// Logs into the identity interface
|
||||
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedIdentity")
|
||||
static ULoginUserCallbackProxy* LoginUser(UObject* WorldContextObject, class APlayerController* PlayerController, FString UserID, FString UserToken);
|
||||
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject", AdvancedDisplay = "AuthType"), Category = "Online|AdvancedIdentity")
|
||||
static ULoginUserCallbackProxy* LoginUser(UObject* WorldContextObject, class APlayerController* PlayerController, FString UserID, FString UserToken, FString AuthType);
|
||||
|
||||
// UOnlineBlueprintCallProxyBase interface
|
||||
virtual void Activate() override;
|
||||
@@ -42,6 +42,8 @@ private:
|
||||
// The user pass / token
|
||||
FString UserToken;
|
||||
|
||||
FString AuthType;
|
||||
|
||||
// The delegate executed by the online subsystem
|
||||
FOnLoginCompleteDelegate Delegate;
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "BlueprintDataDefinitions.h"
|
||||
#include "StartSessionCallbackProxyAdvanced.generated.h"
|
||||
|
||||
UCLASS(MinimalAPI)
|
||||
class UStartSessionCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase
|
||||
{
|
||||
GENERATED_UCLASS_BODY()
|
||||
// Called when the session starts successfully
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FEmptyOnlineDelegate OnSuccess;
|
||||
|
||||
// Called when there is an error starting the session
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FEmptyOnlineDelegate OnFailure;
|
||||
|
||||
/**
|
||||
* Starts a session with the default online subsystem. The session needs to be previously created by calling the "CreateAdvancedSession" node.
|
||||
* @param WorldContextObject
|
||||
*/
|
||||
UFUNCTION(
|
||||
BlueprintCallable
|
||||
, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject")
|
||||
, Category = "Online|AdvancedSessions"
|
||||
)
|
||||
static UStartSessionCallbackProxyAdvanced* StartAdvancedSession(const UObject* WorldContextObject);
|
||||
|
||||
// UOnlineBlueprintCallProxyBase interface
|
||||
virtual void Activate() override;
|
||||
// End of UOnlineBlueprintCallProxyBase interface
|
||||
|
||||
private:
|
||||
// Internal callback when session start completes
|
||||
void OnStartCompleted(FName SessionName, bool bWasSuccessful);
|
||||
|
||||
// The delegate executed by the online subsystem
|
||||
FOnStartSessionCompleteDelegate StartCompleteDelegate;
|
||||
|
||||
// Handles to the registered delegates above
|
||||
FDelegateHandle StartCompleteDelegateHandle;
|
||||
|
||||
// The world context object in which this call is taking place
|
||||
const UObject* WorldContextObject;
|
||||
};
|
||||
@@ -451,6 +451,17 @@ void UAdvancedSessionsLibrary::GetUniqueNetID(APlayerController *PlayerControlle
|
||||
}
|
||||
}
|
||||
|
||||
void UAdvancedSessionsLibrary::GetUniqueNetIdOfSessionOwner(FBlueprintSessionResult SessionResult, FBPUniqueNetId& UniqueNetId)
|
||||
{
|
||||
FBPUniqueNetId ReturnID;
|
||||
if (SessionResult.OnlineResult.IsValid())
|
||||
{
|
||||
ReturnID.SetUniqueNetId(SessionResult.OnlineResult.Session.OwningUserId);
|
||||
}
|
||||
|
||||
UniqueNetId = ReturnID;
|
||||
}
|
||||
|
||||
void UAdvancedSessionsLibrary::GetUniqueNetIDFromPlayerState(APlayerState *PlayerState, FBPUniqueNetId &UniqueNetId)
|
||||
{
|
||||
if (!PlayerState)
|
||||
@@ -528,3 +539,20 @@ void UAdvancedSessionsLibrary::GetNumberOfNetworkPlayers(UObject* WorldContextOb
|
||||
|
||||
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 World->ServerTravel(FURL, bAbsolute, bShouldSkipGameNotify);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#include "AutoLoginUserCallbackProxy.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ULoginUserCallbackProxy
|
||||
|
||||
UAutoLoginUserCallbackProxy::UAutoLoginUserCallbackProxy(const FObjectInitializer& ObjectInitializer)
|
||||
: Super(ObjectInitializer)
|
||||
, Delegate(FOnLoginCompleteDelegate::CreateUObject(this, &ThisClass::OnCompleted))
|
||||
{
|
||||
}
|
||||
|
||||
UAutoLoginUserCallbackProxy* UAutoLoginUserCallbackProxy::AutoLoginUser(UObject* WorldContextObject, int32 LocalUserNum)
|
||||
{
|
||||
UAutoLoginUserCallbackProxy* Proxy = NewObject<UAutoLoginUserCallbackProxy>();
|
||||
Proxy->LocalUserNumber = LocalUserNum;
|
||||
Proxy->WorldContextObject = WorldContextObject;
|
||||
return Proxy;
|
||||
}
|
||||
|
||||
void UAutoLoginUserCallbackProxy::Activate()
|
||||
{
|
||||
auto Identity = Online::GetIdentityInterface();
|
||||
|
||||
if (Identity.IsValid())
|
||||
{
|
||||
DelegateHandle = Identity->AddOnLoginCompleteDelegate_Handle(LocalUserNumber, Delegate);
|
||||
Identity->AutoLogin(LocalUserNumber);
|
||||
return;
|
||||
}
|
||||
|
||||
// Fail immediately
|
||||
OnFailure.Broadcast();
|
||||
}
|
||||
|
||||
void UAutoLoginUserCallbackProxy::OnCompleted(int32 LocalUserNum, bool bWasSuccessful, const FUniqueNetId& UserId, const FString& ErrorVal)
|
||||
{
|
||||
auto Identity = Online::GetIdentityInterface();
|
||||
|
||||
if (Identity.IsValid())
|
||||
{
|
||||
Identity->ClearOnLoginCompleteDelegate_Handle(LocalUserNum, DelegateHandle);
|
||||
}
|
||||
|
||||
if(APlayerController* PController = UGameplayStatics::GetPlayerController(WorldContextObject->GetWorld(), LocalUserNum))
|
||||
{
|
||||
ULocalPlayer* Player = Cast<ULocalPlayer>(PController->Player);
|
||||
|
||||
FUniqueNetIdRepl uniqueId(UserId.AsShared());
|
||||
|
||||
if (Player)
|
||||
{
|
||||
Player->SetCachedUniqueNetId(uniqueId);
|
||||
}
|
||||
|
||||
if (APlayerState* State = PController->PlayerState)
|
||||
{
|
||||
// Update UniqueId. See also ShowLoginUICallbackProxy.cpp
|
||||
State->SetUniqueId(uniqueId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (bWasSuccessful)
|
||||
{
|
||||
OnSuccess.Broadcast();
|
||||
}
|
||||
else
|
||||
{
|
||||
OnFailure.Broadcast();
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ UCreateSessionCallbackProxyAdvanced::UCreateSessionCallbackProxyAdvanced(const F
|
||||
{
|
||||
}
|
||||
|
||||
UCreateSessionCallbackProxyAdvanced* UCreateSessionCallbackProxyAdvanced::CreateAdvancedSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair> &ExtraSettings, class APlayerController* PlayerController, int32 PublicConnections, int32 PrivateConnections, bool bUseLAN, bool bAllowInvites, bool bIsDedicatedServer, bool bUsePresence, bool bAllowJoinViaPresence, bool bAllowJoinViaPresenceFriendsOnly, bool bAntiCheatProtected, bool bUsesStats, bool bShouldAdvertise)
|
||||
UCreateSessionCallbackProxyAdvanced* UCreateSessionCallbackProxyAdvanced::CreateAdvancedSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair>& ExtraSettings, class APlayerController* PlayerController, int32 PublicConnections, int32 PrivateConnections, bool bUseLAN, bool bAllowInvites, bool bIsDedicatedServer, bool bUsePresence, bool bUseLobbiesIfAvailable, bool bAllowJoinViaPresence, bool bAllowJoinViaPresenceFriendsOnly, bool bAntiCheatProtected, bool bUsesStats, bool bShouldAdvertise, bool bUseLobbiesVoiceChatIfAvailable, bool bStartAfterCreate)
|
||||
{
|
||||
UCreateSessionCallbackProxyAdvanced* Proxy = NewObject<UCreateSessionCallbackProxyAdvanced>();
|
||||
Proxy->PlayerControllerWeakPtr = PlayerController;
|
||||
@@ -25,11 +25,14 @@ UCreateSessionCallbackProxyAdvanced* UCreateSessionCallbackProxyAdvanced::Create
|
||||
Proxy->ExtraSettings = ExtraSettings;
|
||||
Proxy->bDedicatedServer = bIsDedicatedServer;
|
||||
Proxy->bUsePresence = bUsePresence;
|
||||
Proxy->bUseLobbiesIfAvailable = bUseLobbiesIfAvailable;
|
||||
Proxy->bAllowJoinViaPresence = bAllowJoinViaPresence;
|
||||
Proxy->bAllowJoinViaPresenceFriendsOnly = bAllowJoinViaPresenceFriendsOnly;
|
||||
Proxy->bAntiCheatProtected = bAntiCheatProtected;
|
||||
Proxy->bUsesStats = bUsesStats;
|
||||
Proxy->bShouldAdvertise = bShouldAdvertise;
|
||||
Proxy->bUseLobbiesVoiceChatIfAvailable = bUseLobbiesVoiceChatIfAvailable;
|
||||
Proxy->bStartAfterCreate = bStartAfterCreate;
|
||||
return Proxy;
|
||||
}
|
||||
|
||||
@@ -50,21 +53,27 @@ void UCreateSessionCallbackProxyAdvanced::Activate()
|
||||
FOnlineSessionSettings Settings;
|
||||
Settings.NumPublicConnections = NumPublicConnections;
|
||||
Settings.NumPrivateConnections = NumPrivateConnections;
|
||||
Settings.bShouldAdvertise = true;
|
||||
Settings.bShouldAdvertise = bShouldAdvertise;
|
||||
Settings.bAllowJoinInProgress = true;
|
||||
Settings.bIsLANMatch = bUseLAN;
|
||||
Settings.bAllowJoinViaPresence = true;
|
||||
Settings.bAllowJoinViaPresence = bAllowJoinViaPresence;
|
||||
Settings.bIsDedicated = bDedicatedServer;
|
||||
|
||||
if (bDedicatedServer)
|
||||
{
|
||||
Settings.bUsesPresence = false;
|
||||
Settings.bUseLobbiesIfAvailable = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Settings.bUsesPresence = bUsePresence;
|
||||
Settings.bUseLobbiesIfAvailable = bUseLobbiesIfAvailable;
|
||||
}
|
||||
|
||||
Settings.bUseLobbiesVoiceChatIfAvailable = bUseLobbiesIfAvailable ? bUseLobbiesVoiceChatIfAvailable : false;
|
||||
Settings.bAllowJoinViaPresenceFriendsOnly = bAllowJoinViaPresenceFriendsOnly;
|
||||
Settings.bAntiCheatProtected = bAntiCheatProtected;
|
||||
Settings.bUsesStats = bUsesStats;
|
||||
Settings.bShouldAdvertise = bShouldAdvertise;
|
||||
|
||||
// These are about the only changes over the standard Create Sessions Node
|
||||
Settings.bAllowInvites = bAllowInvites;
|
||||
@@ -124,8 +133,17 @@ void UCreateSessionCallbackProxyAdvanced::OnCreateCompleted(FName SessionName, b
|
||||
|
||||
if (bWasSuccessful)
|
||||
{
|
||||
if (this->bStartAfterCreate)
|
||||
{
|
||||
UE_LOG_ONLINE_SESSION(Display, TEXT("Session creation completed. Automatic start is turned on, starting session now."));
|
||||
StartCompleteDelegateHandle = Sessions->AddOnStartSessionCompleteDelegate_Handle(StartCompleteDelegate);
|
||||
Sessions->StartSession(NAME_GameSession);
|
||||
Sessions->StartSession(NAME_GameSession); // We'll call `OnSuccess.Broadcast()` when start succeeds.
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG_ONLINE_SESSION(Display, TEXT("Session creation completed. Automatic start is turned off, to start the session call 'StartSession'."));
|
||||
OnSuccess.Broadcast();
|
||||
}
|
||||
|
||||
// OnStartCompleted will get called, nothing more to do now
|
||||
return;
|
||||
|
||||
@@ -15,7 +15,7 @@ UFindSessionsCallbackProxyAdvanced::UFindSessionsCallbackProxyAdvanced(const FOb
|
||||
bIsOnSecondSearch = false;
|
||||
}
|
||||
|
||||
UFindSessionsCallbackProxyAdvanced* UFindSessionsCallbackProxyAdvanced::FindSessionsAdvanced(UObject* WorldContextObject, class APlayerController* PlayerController, int MaxResults, bool bUseLAN, EBPServerPresenceSearchType ServerTypeToSearch, const TArray<FSessionsSearchSetting> &Filters, bool bEmptyServersOnly, bool bNonEmptyServersOnly, bool bSecureServersOnly, int MinSlotsAvailable)
|
||||
UFindSessionsCallbackProxyAdvanced* UFindSessionsCallbackProxyAdvanced::FindSessionsAdvanced(UObject* WorldContextObject, class APlayerController* PlayerController, int MaxResults, bool bUseLAN, EBPServerPresenceSearchType ServerTypeToSearch, const TArray<FSessionsSearchSetting> &Filters, bool bEmptyServersOnly, bool bNonEmptyServersOnly, bool bSecureServersOnly, bool bSearchLobbies, int MinSlotsAvailable)
|
||||
{
|
||||
UFindSessionsCallbackProxyAdvanced* Proxy = NewObject<UFindSessionsCallbackProxyAdvanced>();
|
||||
Proxy->PlayerControllerWeakPtr = PlayerController;
|
||||
@@ -27,6 +27,7 @@ UFindSessionsCallbackProxyAdvanced* UFindSessionsCallbackProxyAdvanced::FindSess
|
||||
Proxy->bEmptyServersOnly = bEmptyServersOnly,
|
||||
Proxy->bNonEmptyServersOnly = bNonEmptyServersOnly;
|
||||
Proxy->bSecureServersOnly = bSecureServersOnly;
|
||||
Proxy->bSearchLobbies = bSearchLobbies;
|
||||
Proxy->MinSlotsAvailable = MinSlotsAvailable;
|
||||
return Proxy;
|
||||
}
|
||||
@@ -73,6 +74,17 @@ void UFindSessionsCallbackProxyAdvanced::Activate()
|
||||
#define SEARCH_USER FName(TEXT("SEARCHUSER"))
|
||||
// Keywords to match in session search
|
||||
#define SEARCH_KEYWORDS FName(TEXT("SEARCHKEYWORDS"))*/
|
||||
/** Keywords to match in session search */
|
||||
/** The matchmaking queue name to matchmake in, e.g. "TeamDeathmatch" (value is string) */
|
||||
/** #define SEARCH_MATCHMAKING_QUEUE FName(TEXT("MATCHMAKINGQUEUE"))*/
|
||||
/** If set, use the named Xbox Live hopper to find a session via matchmaking (value is a string) */
|
||||
/** #define SEARCH_XBOX_LIVE_HOPPER_NAME FName(TEXT("LIVEHOPPERNAME"))*/
|
||||
/** Which session template from the service configuration to use */
|
||||
/** #define SEARCH_XBOX_LIVE_SESSION_TEMPLATE_NAME FName(TEXT("LIVESESSIONTEMPLATE"))*/
|
||||
/** Selection method used to determine which match to join when multiple are returned (valid only on Switch) */
|
||||
/** #define SEARCH_SWITCH_SELECTION_METHOD FName(TEXT("SWITCHSELECTIONMETHOD"))*/
|
||||
/** Whether to use lobbies vs sessions */
|
||||
/** #define SEARCH_LOBBIES FName(TEXT("LOBBYSEARCH"))*/
|
||||
|
||||
if (bEmptyServersOnly)
|
||||
tem.Set(SEARCH_EMPTY_SERVERS_ONLY, true, EOnlineComparisonOp::Equals);
|
||||
@@ -86,8 +98,6 @@ void UFindSessionsCallbackProxyAdvanced::Activate()
|
||||
if (MinSlotsAvailable != 0)
|
||||
tem.Set(SEARCH_MINSLOTSAVAILABLE, MinSlotsAvailable, EOnlineComparisonOp::GreaterThanEquals);
|
||||
|
||||
|
||||
|
||||
// Filter results
|
||||
if (SearchSettings.Num() > 0)
|
||||
{
|
||||
@@ -104,6 +114,9 @@ void UFindSessionsCallbackProxyAdvanced::Activate()
|
||||
case EBPServerPresenceSearchType::ClientServersOnly:
|
||||
{
|
||||
tem.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals);
|
||||
|
||||
if (bSearchLobbies)
|
||||
tem.Set(SEARCH_LOBBIES, true, EOnlineComparisonOp::Equals);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -116,9 +129,8 @@ void UFindSessionsCallbackProxyAdvanced::Activate()
|
||||
case EBPServerPresenceSearchType::AllServers:
|
||||
default:
|
||||
{
|
||||
// Only steam uses the separate searching flags currently
|
||||
if (IOnlineSubsystem::DoesInstanceExist("STEAM"))
|
||||
{
|
||||
//if (IOnlineSubsystem::DoesInstanceExist("STEAM"))
|
||||
//{
|
||||
bRunSecondSearch = true;
|
||||
|
||||
SearchObjectDedicated = MakeShareable(new FOnlineSessionSearch);
|
||||
@@ -126,11 +138,15 @@ void UFindSessionsCallbackProxyAdvanced::Activate()
|
||||
SearchObjectDedicated->bIsLanQuery = bUseLAN;
|
||||
|
||||
FOnlineSearchSettingsEx DedicatedOnly = tem;
|
||||
|
||||
tem.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals);
|
||||
|
||||
if (bSearchLobbies)
|
||||
tem.Set(SEARCH_LOBBIES, true, EOnlineComparisonOp::Equals);
|
||||
|
||||
//DedicatedOnly.Set(SEARCH_DEDICATED_ONLY, true, EOnlineComparisonOp::Equals);
|
||||
SearchObjectDedicated->QuerySettings = DedicatedOnly;
|
||||
}
|
||||
//}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -12,12 +12,13 @@ ULoginUserCallbackProxy::ULoginUserCallbackProxy(const FObjectInitializer& Objec
|
||||
{
|
||||
}
|
||||
|
||||
ULoginUserCallbackProxy* ULoginUserCallbackProxy::LoginUser(UObject* WorldContextObject, class APlayerController* PlayerController, FString UserID, FString UserToken)
|
||||
ULoginUserCallbackProxy* ULoginUserCallbackProxy::LoginUser(UObject* WorldContextObject, class APlayerController* PlayerController, FString UserID, FString UserToken, FString AuthType)
|
||||
{
|
||||
ULoginUserCallbackProxy* Proxy = NewObject<ULoginUserCallbackProxy>();
|
||||
Proxy->PlayerControllerWeakPtr = PlayerController;
|
||||
Proxy->UserID = UserID;
|
||||
Proxy->UserToken = UserToken;
|
||||
Proxy->AuthType = AuthType;
|
||||
Proxy->WorldContextObject = WorldContextObject;
|
||||
return Proxy;
|
||||
}
|
||||
@@ -43,8 +44,13 @@ void ULoginUserCallbackProxy::Activate()
|
||||
|
||||
if (Identity.IsValid())
|
||||
{
|
||||
// Fallback to default AuthType if nothing is specified
|
||||
if (AuthType.IsEmpty())
|
||||
{
|
||||
AuthType = Identity->GetAuthType();
|
||||
}
|
||||
DelegateHandle = Identity->AddOnLoginCompleteDelegate_Handle(Player->GetControllerId(), Delegate);
|
||||
FOnlineAccountCredentials AccountCreds(Identity->GetAuthType(), UserID, UserToken);
|
||||
FOnlineAccountCredentials AccountCreds(AuthType, UserID, UserToken);
|
||||
Identity->Login(Player->GetControllerId(), AccountCreds);
|
||||
return;
|
||||
}
|
||||
@@ -59,6 +65,8 @@ void ULoginUserCallbackProxy::OnCompleted(int32 LocalUserNum, bool bWasSuccessfu
|
||||
{
|
||||
ULocalPlayer* Player = Cast<ULocalPlayer>(PlayerControllerWeakPtr->Player);
|
||||
|
||||
FUniqueNetIdRepl UniqueID(UserId.AsShared());
|
||||
|
||||
if (Player)
|
||||
{
|
||||
auto Identity = Online::GetIdentityInterface();
|
||||
@@ -67,6 +75,13 @@ void ULoginUserCallbackProxy::OnCompleted(int32 LocalUserNum, bool bWasSuccessfu
|
||||
{
|
||||
Identity->ClearOnLoginCompleteDelegate_Handle(Player->GetControllerId(), DelegateHandle);
|
||||
}
|
||||
Player->SetCachedUniqueNetId(UniqueID);
|
||||
}
|
||||
|
||||
if (APlayerState* State = PlayerControllerWeakPtr->PlayerState)
|
||||
{
|
||||
// Update UniqueId. See also ShowLoginUICallbackProxy.cpp
|
||||
State->SetUniqueId(UniqueID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
#include "StartSessionCallbackProxyAdvanced.h"
|
||||
|
||||
UStartSessionCallbackProxyAdvanced::UStartSessionCallbackProxyAdvanced(const FObjectInitializer& ObjectInitializer)
|
||||
: Super(ObjectInitializer)
|
||||
, StartCompleteDelegate(FOnStartSessionCompleteDelegate::CreateUObject(this, &ThisClass::OnStartCompleted))
|
||||
{
|
||||
}
|
||||
|
||||
UStartSessionCallbackProxyAdvanced* UStartSessionCallbackProxyAdvanced::StartAdvancedSession(
|
||||
const UObject* WorldContextObject)
|
||||
{
|
||||
UStartSessionCallbackProxyAdvanced* Proxy = NewObject<UStartSessionCallbackProxyAdvanced>();
|
||||
Proxy->WorldContextObject = WorldContextObject;
|
||||
return Proxy;
|
||||
}
|
||||
|
||||
void UStartSessionCallbackProxyAdvanced::Activate()
|
||||
{
|
||||
const FOnlineSubsystemBPCallHelperAdvanced Helper(
|
||||
TEXT("StartSession"),
|
||||
GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull));
|
||||
|
||||
if (Helper.OnlineSub != nullptr)
|
||||
{
|
||||
const auto Sessions = Helper.OnlineSub->GetSessionInterface();
|
||||
if (Sessions.IsValid())
|
||||
{
|
||||
StartCompleteDelegateHandle = Sessions->AddOnStartSessionCompleteDelegate_Handle(StartCompleteDelegate);
|
||||
Sessions->StartSession(NAME_GameSession);
|
||||
return;
|
||||
}
|
||||
FFrame::KismetExecutionMessage(TEXT("Sessions not supported by Online Subsystem"), ELogVerbosity::Warning);
|
||||
}
|
||||
|
||||
// Fail immediately
|
||||
OnFailure.Broadcast();
|
||||
}
|
||||
|
||||
void UStartSessionCallbackProxyAdvanced::OnStartCompleted(FName SessionName, bool bWasSuccessful)
|
||||
{
|
||||
const FOnlineSubsystemBPCallHelperAdvanced Helper(
|
||||
TEXT("StartSessionCallback"),
|
||||
GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull));
|
||||
|
||||
if (Helper.OnlineSub != nullptr)
|
||||
{
|
||||
const auto Sessions = Helper.OnlineSub->GetSessionInterface();
|
||||
if (Sessions.IsValid())
|
||||
{
|
||||
Sessions->ClearOnStartSessionCompleteDelegate_Handle(StartCompleteDelegateHandle);
|
||||
}
|
||||
}
|
||||
|
||||
if (bWasSuccessful)
|
||||
{
|
||||
OnSuccess.Broadcast();
|
||||
}
|
||||
else
|
||||
{
|
||||
OnFailure.Broadcast();
|
||||
}
|
||||
}
|
||||
@@ -29,9 +29,11 @@ UUpdateSessionCallbackProxyAdvanced* UUpdateSessionCallbackProxyAdvanced::Update
|
||||
|
||||
void UUpdateSessionCallbackProxyAdvanced::Activate()
|
||||
{
|
||||
const FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("UpdateSession"), GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull));
|
||||
|
||||
IOnlineSessionPtr Sessions = Online::GetSessionInterface(GetWorld());
|
||||
|
||||
if (Helper.OnlineSub != nullptr)
|
||||
{
|
||||
const auto Sessions = Helper.OnlineSub->GetSessionInterface();
|
||||
if (Sessions.IsValid())
|
||||
{
|
||||
if (Sessions->GetNumSessions() < 1)
|
||||
@@ -94,6 +96,7 @@ void UUpdateSessionCallbackProxyAdvanced::Activate()
|
||||
{
|
||||
FFrame::KismetExecutionMessage(TEXT("Sessions not supported by Online Subsystem"), ELogVerbosity::Warning);
|
||||
}
|
||||
}
|
||||
// Fail immediately
|
||||
OnFailure.Broadcast();
|
||||
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Sessions not supported"));
|
||||
@@ -101,7 +104,11 @@ void UUpdateSessionCallbackProxyAdvanced::Activate()
|
||||
|
||||
void UUpdateSessionCallbackProxyAdvanced::OnUpdateCompleted(FName SessionName, bool bWasSuccessful)
|
||||
{
|
||||
IOnlineSessionPtr Sessions = Online::GetSessionInterface(GetWorld());
|
||||
const FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("UpdateSessionCallback"), GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull));
|
||||
|
||||
if (Helper.OnlineSub != nullptr)
|
||||
{
|
||||
const auto Sessions = Helper.OnlineSub->GetSessionInterface();
|
||||
if (Sessions.IsValid())
|
||||
{
|
||||
Sessions->ClearOnUpdateSessionCompleteDelegate_Handle(OnUpdateSessionCompleteDelegateHandle);
|
||||
@@ -112,6 +119,7 @@ void UUpdateSessionCallbackProxyAdvanced::OnUpdateCompleted(FName SessionName, b
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!bWasSuccessful)
|
||||
{
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
"FileVersion" : 3,
|
||||
|
||||
"FriendlyName" : "Advanced Steam Sessions",
|
||||
"Version" : 4.26,
|
||||
"VersionName": "4.26",
|
||||
"Version" : 5.0,
|
||||
"VersionName": "5.0",
|
||||
"Description" : "Adds new blueprint functions to handle more advanced session operations in Steam. REQUIRES ADVANCED SESSIONS",
|
||||
"Category" : "Advanced Sessions Plugin",
|
||||
"CreatedBy" : "Joshua Statzer",
|
||||
@@ -33,6 +33,10 @@
|
||||
{
|
||||
"Name": "OnlineSubsystemSteam",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "SteamShared",
|
||||
"Enabled": true
|
||||
}
|
||||
]
|
||||
}
|
||||
8
AdvancedSteamSessions/Config/FilterPlugin.ini
Normal file
8
AdvancedSteamSessions/Config/FilterPlugin.ini
Normal file
@@ -0,0 +1,8 @@
|
||||
[FilterPlugin]
|
||||
; This section lists additional files which will be packaged along with your plugin. Paths should be listed relative to the root plugin directory, and
|
||||
; may include "...", "*", and "?" wildcards to match directories, files, and individual characters respectively.
|
||||
;
|
||||
; Examples:
|
||||
; /README.txt
|
||||
; /Extras/...
|
||||
; /Binaries/ThirdParty/*.dll
|
||||
@@ -13,7 +13,7 @@ public class AdvancedSteamSessions : ModuleRules
|
||||
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "OnlineSubsystem", "CoreUObject", "OnlineSubsystemUtils", "Networking", "Sockets", "AdvancedSessions"/*"Voice", "OnlineSubsystemSteam"*/ });
|
||||
PrivateDependencyModuleNames.AddRange(new string[] { "OnlineSubsystem", "Sockets", "Networking", "OnlineSubsystemUtils" /*"Voice", "Steamworks","OnlineSubsystemSteam"*/});
|
||||
|
||||
if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Linux) || (Target.Platform == UnrealTargetPlatform.Mac))
|
||||
if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Linux) || (Target.Platform == UnrealTargetPlatform.Mac))
|
||||
{
|
||||
PublicDependencyModuleNames.AddRange(new string[] { "Steamworks",/*"Voice",*/ "OnlineSubsystemSteam" });
|
||||
PublicIncludePaths.AddRange(new string[] { "../Plugins/Online/OnlineSubsystemSteam/Source/Private" });// This is dumb but it isn't very open
|
||||
|
||||
@@ -297,11 +297,11 @@ public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
||||
FString GroupTag;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
||||
int32 numOnline;
|
||||
int32 numOnline = 0;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
||||
int32 numInGame;
|
||||
int32 numInGame = 0;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
||||
int32 numChatting;
|
||||
int32 numChatting = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
||||
FBPUniqueNetId OfficerUniqueNetID; // Uint64 representation
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
||||
bool bIsOwner;
|
||||
bool bIsOwner = false;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -332,18 +332,22 @@ UTexture2D * UAdvancedSteamFriendsLibrary::GetSteamFriendAvatar(const FBPUniqueN
|
||||
|
||||
UTexture2D* Avatar = UTexture2D::CreateTransient(Width, Height, PF_R8G8B8A8);
|
||||
// Switched to a Memcpy instead of byte by byte transer
|
||||
uint8* MipData = (uint8*)Avatar->PlatformData->Mips[0].BulkData.Lock(LOCK_READ_WRITE);
|
||||
|
||||
if (FTexturePlatformData* PlatformData = Avatar->GetPlatformData())
|
||||
{
|
||||
uint8* MipData = (uint8*)PlatformData->Mips[0].BulkData.Lock(LOCK_READ_WRITE);
|
||||
FMemory::Memcpy(MipData, (void*)oAvatarRGBA, Height * Width * 4);
|
||||
Avatar->PlatformData->Mips[0].BulkData.Unlock();
|
||||
PlatformData->Mips[0].BulkData.Unlock();
|
||||
|
||||
// Original implementation was missing this!!
|
||||
// the hell man......
|
||||
delete[] oAvatarRGBA;
|
||||
|
||||
//Setting some Parameters for the Texture and finally returning it
|
||||
Avatar->PlatformData->SetNumSlices(1);
|
||||
PlatformData->SetNumSlices(1);
|
||||
Avatar->NeverStream = true;
|
||||
//Avatar->CompressionSettings = TC_EditorIcon;
|
||||
}
|
||||
|
||||
Avatar->UpdateResource();
|
||||
|
||||
@@ -395,7 +399,18 @@ bool UAdvancedSteamFriendsLibrary::FilterText(FString TextToFilter, EBPTextFilte
|
||||
id = *((uint64*)TextSourceID.UniqueNetId->GetBytes());
|
||||
}
|
||||
|
||||
// MAC is bugged with current steam version according to epic, they forced it to be the old steam ver
|
||||
#if PLATFORM_MAC
|
||||
// Filters the provided input message and places the filtered result into pchOutFilteredText.
|
||||
// pchOutFilteredText is where the output will be placed, even if no filtering or censoring is performed
|
||||
// nByteSizeOutFilteredText is the size (in bytes) of pchOutFilteredText
|
||||
// pchInputText is the input string that should be filtered, which can be ASCII or UTF-8
|
||||
// bLegalOnly should be false if you want profanity and legally required filtering (where required) and true if you want legally required filtering only
|
||||
// Returns the number of characters (not bytes) filtered.
|
||||
int FilterCount = SteamUtils()->FilterText(OutText, BufferLen, TCHAR_TO_ANSI(*TextToFilter), Context == EBPTextFilteringContext::FContext_GameContent);
|
||||
#else
|
||||
int FilterCount = SteamUtils()->FilterText((ETextFilteringContext)Context, id, TCHAR_TO_ANSI(*TextToFilter), OutText, BufferLen);
|
||||
#endif
|
||||
|
||||
if (FilterCount > 0)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#include "SteamRequestGroupOfficersCallbackProxy.h"
|
||||
#include "UObject/CoreOnline.h"
|
||||
#include "Online/CoreOnline.h"
|
||||
#include "AdvancedSteamFriendsLibrary.h"
|
||||
#include "OnlineSubSystemHeader.h"
|
||||
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
||||
|
||||
Reference in New Issue
Block a user