mirror of
https://github.com/mordentral/AdvancedSessionsPlugin.git
synced 2025-12-09 23:53:03 +00:00
Compare commits
36 Commits
4.27-Locke
...
5.0-Locked
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76e08581f5 | ||
|
|
382ed08217 | ||
|
|
f760855494 | ||
|
|
fe76b60b2e | ||
|
|
7f1b47f42d | ||
|
|
3ac5d6c664 | ||
|
|
fd33fc34a5 | ||
|
|
bc26be2a12 | ||
|
|
936532f1a0 | ||
|
|
64710df075 | ||
|
|
ab9de1b344 | ||
|
|
bf4d99cba8 | ||
|
|
f7f56e7038 | ||
|
|
90fff579ba | ||
|
|
e1ed0f22b6 | ||
|
|
0de641f7d9 | ||
|
|
295ab98a91 | ||
|
|
18475eb2ef | ||
|
|
9784cd2f01 | ||
|
|
2e43a65acd | ||
|
|
09bbe211a8 | ||
|
|
fded4d065b | ||
|
|
b0ae86b017 | ||
|
|
4d913be381 | ||
|
|
8192f73ca7 | ||
|
|
f2a33fe1c6 | ||
|
|
c59f4bba43 | ||
|
|
7b21ee2344 | ||
|
|
b72b0d59fe | ||
|
|
5b2260079c | ||
|
|
c4df122248 | ||
|
|
6065bd9a36 | ||
|
|
6c392ee1fb | ||
|
|
4b7cffc1c0 | ||
|
|
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,
|
"FileVersion": 3,
|
||||||
|
"FriendlyName": "Advanced Sessions",
|
||||||
"FriendlyName" : "Advanced Sessions",
|
"Version": 4,
|
||||||
"Version" : 4.27,
|
"VersionName": "5.0",
|
||||||
"VersionName": "4.27",
|
"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",
|
"CreatedByURL": "N/A",
|
||||||
"CreatedByURL" : "N/A",
|
"Modules": [
|
||||||
|
|
||||||
"Modules" :
|
|
||||||
[
|
|
||||||
{
|
{
|
||||||
"Name" : "AdvancedSessions",
|
"Name": "AdvancedSessions",
|
||||||
"Type" : "RunTime",
|
"Type": "Runtime",
|
||||||
"LoadingPhase" : "PreDefault"
|
"LoadingPhase": "PreDefault"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"Plugins": [
|
"Plugins": [
|
||||||
@@ -26,5 +23,12 @@
|
|||||||
"Name": "OnlineSubsystemUtils",
|
"Name": "OnlineSubsystemUtils",
|
||||||
"Enabled": true
|
"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")
|
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|PlayerID")
|
||||||
static void GetUniqueNetID(APlayerController *PlayerController, FBPUniqueNetId &UniqueNetId);
|
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
|
// Get the unique net id of a network player who is assigned the the given player state
|
||||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|PlayerID")
|
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|PlayerID")
|
||||||
static void GetUniqueNetIDFromPlayerState(APlayerState *PlayerState, FBPUniqueNetId &UniqueNetId);
|
static void GetUniqueNetIDFromPlayerState(APlayerState *PlayerState, FBPUniqueNetId &UniqueNetId);
|
||||||
@@ -206,5 +210,4 @@ public:
|
|||||||
UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category = "Online|AdvancedSessions|Seamless", meta = (HidePin = "WorldContextObject", DefaultToSelf = "WorldContextObject"))
|
UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category = "Online|AdvancedSessions|Seamless", meta = (HidePin = "WorldContextObject", DefaultToSelf = "WorldContextObject"))
|
||||||
static bool ServerTravel(UObject* WorldContextObject, const FString& InURL, bool bAbsolute, bool bShouldSkipGameNotify);
|
static bool ServerTravel(UObject* WorldContextObject, const FString& InURL, bool bAbsolute, bool bShouldSkipGameNotify);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -251,17 +251,17 @@ struct FBPFriendPresenceInfo
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
||||||
bool bIsOnline;
|
bool bIsOnline = false;
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
||||||
bool bIsPlaying;
|
bool bIsPlaying = false;
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
||||||
bool bIsPlayingThisGame;
|
bool bIsPlayingThisGame = false;
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
||||||
bool bIsJoinable;
|
bool bIsJoinable = false;
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
||||||
bool bHasVoiceSupport;
|
bool bHasVoiceSupport = false;
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
||||||
EBPOnlinePresenceState PresenceState;
|
EBPOnlinePresenceState PresenceState = EBPOnlinePresenceState::Offline;
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
||||||
FString StatusString;
|
FString StatusString;
|
||||||
|
|
||||||
@@ -288,11 +288,11 @@ public:
|
|||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
||||||
FString RealName;
|
FString RealName;
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
||||||
EBPOnlinePresenceState OnlineState;
|
EBPOnlinePresenceState OnlineState = EBPOnlinePresenceState::Offline;
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
||||||
FBPUniqueNetId UniqueNetId;
|
FBPUniqueNetId UniqueNetId;
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
||||||
bool bIsPlayingSameGame;
|
bool bIsPlayingSameGame = false;
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
||||||
FBPFriendPresenceInfo PresenceInfo;
|
FBPFriendPresenceInfo PresenceInfo;
|
||||||
|
|
||||||
|
|||||||
@@ -27,19 +27,20 @@ class UCreateSessionCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase
|
|||||||
* @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 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 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 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")
|
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 bUseLobbiesIfAvailable = true, bool bAllowJoinViaPresence = true, bool bAllowJoinViaPresenceFriendsOnly = false, bool bAntiCheatProtected = false, bool bUsesStats = false, bool bShouldAdvertise = true, bool bUseLobbiesVoiceChatIfAvailable = false);
|
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
|
// UOnlineBlueprintCallProxyBase interface
|
||||||
virtual void Activate() override;
|
virtual void Activate() override;
|
||||||
// End of UOnlineBlueprintCallProxyBase interface
|
// End of UOnlineBlueprintCallProxyBase interface
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Internal callback when session creation completes, calls StartSession
|
// Internal callback when session creation completes, optionally calls StartSession
|
||||||
void OnCreateCompleted(FName SessionName, bool bWasSuccessful);
|
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);
|
void OnStartCompleted(FName SessionName, bool bWasSuccessful);
|
||||||
|
|
||||||
// The player controller triggering things
|
// The player controller triggering things
|
||||||
@@ -94,6 +95,9 @@ private:
|
|||||||
// Whether to prefer the use of voice chat lobbies if the api supports them
|
// Whether to prefer the use of voice chat lobbies if the api supports them
|
||||||
bool bUseLobbiesVoiceChatIfAvailable;
|
bool bUseLobbiesVoiceChatIfAvailable;
|
||||||
|
|
||||||
|
// Whether to start the session automatically after it is created
|
||||||
|
bool bStartAfterCreate;
|
||||||
|
|
||||||
// Store extra settings
|
// Store extra settings
|
||||||
TArray<FSessionPropertyKeyPair> ExtraSettings;
|
TArray<FSessionPropertyKeyPair> ExtraSettings;
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,11 @@ class UEndSessionCallbackProxy : public UOnlineBlueprintCallProxyBase
|
|||||||
UPROPERTY(BlueprintAssignable)
|
UPROPERTY(BlueprintAssignable)
|
||||||
FEmptyOnlineDelegate OnFailure;
|
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);
|
static UEndSessionCallbackProxy* EndSession(UObject* WorldContextObject, class APlayerController* PlayerController);
|
||||||
|
|
||||||
// UOnlineBlueprintCallProxyBase interface
|
// UOnlineBlueprintCallProxyBase interface
|
||||||
|
|||||||
@@ -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)
|
void UAdvancedSessionsLibrary::GetUniqueNetIDFromPlayerState(APlayerState *PlayerState, FBPUniqueNetId &UniqueNetId)
|
||||||
{
|
{
|
||||||
if (!PlayerState)
|
if (!PlayerState)
|
||||||
@@ -531,11 +542,17 @@ void UAdvancedSessionsLibrary::GetNumberOfNetworkPlayers(UObject* WorldContextOb
|
|||||||
|
|
||||||
bool UAdvancedSessionsLibrary::ServerTravel(UObject* WorldContextObject, const FString& FURL, bool bAbsolute, bool bShouldSkipGameNotify)
|
bool UAdvancedSessionsLibrary::ServerTravel(UObject* WorldContextObject, const FString& FURL, bool bAbsolute, bool bShouldSkipGameNotify)
|
||||||
{
|
{
|
||||||
if (!WorldContextObject) return false;
|
if (!WorldContextObject)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//using a context object to get the world
|
//using a context object to get the world
|
||||||
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::ReturnNull);
|
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::ReturnNull);
|
||||||
if (!World) return false;
|
if (World)
|
||||||
World->ServerTravel(FURL,bAbsolute,bShouldSkipGameNotify);
|
{
|
||||||
return true;
|
return World->ServerTravel(FURL, bAbsolute, bShouldSkipGameNotify);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||||||
|
|
||||||
#include "AutoLoginUserCallbackProxy.h"
|
#include "AutoLoginUserCallbackProxy.h"
|
||||||
|
#include "Kismet/GameplayStatics.h"
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// ULoginUserCallbackProxy
|
// ULoginUserCallbackProxy
|
||||||
@@ -44,6 +44,25 @@ void UAutoLoginUserCallbackProxy::OnCompleted(int32 LocalUserNum, bool bWasSucce
|
|||||||
Identity->ClearOnLoginCompleteDelegate_Handle(LocalUserNum, DelegateHandle);
|
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)
|
if (bWasSuccessful)
|
||||||
{
|
{
|
||||||
OnSuccess.Broadcast();
|
OnSuccess.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 bUseLobbiesIfAvailable, bool bAllowJoinViaPresence, bool bAllowJoinViaPresenceFriendsOnly, bool bAntiCheatProtected, bool bUsesStats, bool bShouldAdvertise, bool bUseLobbiesVoiceChatIfAvailable)
|
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>();
|
UCreateSessionCallbackProxyAdvanced* Proxy = NewObject<UCreateSessionCallbackProxyAdvanced>();
|
||||||
Proxy->PlayerControllerWeakPtr = PlayerController;
|
Proxy->PlayerControllerWeakPtr = PlayerController;
|
||||||
@@ -32,6 +32,7 @@ UCreateSessionCallbackProxyAdvanced* UCreateSessionCallbackProxyAdvanced::Create
|
|||||||
Proxy->bUsesStats = bUsesStats;
|
Proxy->bUsesStats = bUsesStats;
|
||||||
Proxy->bShouldAdvertise = bShouldAdvertise;
|
Proxy->bShouldAdvertise = bShouldAdvertise;
|
||||||
Proxy->bUseLobbiesVoiceChatIfAvailable = bUseLobbiesVoiceChatIfAvailable;
|
Proxy->bUseLobbiesVoiceChatIfAvailable = bUseLobbiesVoiceChatIfAvailable;
|
||||||
|
Proxy->bStartAfterCreate = bStartAfterCreate;
|
||||||
return Proxy;
|
return Proxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,10 +53,10 @@ void UCreateSessionCallbackProxyAdvanced::Activate()
|
|||||||
FOnlineSessionSettings Settings;
|
FOnlineSessionSettings Settings;
|
||||||
Settings.NumPublicConnections = NumPublicConnections;
|
Settings.NumPublicConnections = NumPublicConnections;
|
||||||
Settings.NumPrivateConnections = NumPrivateConnections;
|
Settings.NumPrivateConnections = NumPrivateConnections;
|
||||||
Settings.bShouldAdvertise = true;
|
Settings.bShouldAdvertise = bShouldAdvertise;
|
||||||
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)
|
||||||
@@ -73,7 +74,6 @@ void UCreateSessionCallbackProxyAdvanced::Activate()
|
|||||||
Settings.bAllowJoinViaPresenceFriendsOnly = bAllowJoinViaPresenceFriendsOnly;
|
Settings.bAllowJoinViaPresenceFriendsOnly = bAllowJoinViaPresenceFriendsOnly;
|
||||||
Settings.bAntiCheatProtected = bAntiCheatProtected;
|
Settings.bAntiCheatProtected = bAntiCheatProtected;
|
||||||
Settings.bUsesStats = bUsesStats;
|
Settings.bUsesStats = bUsesStats;
|
||||||
Settings.bShouldAdvertise = bShouldAdvertise;
|
|
||||||
|
|
||||||
// These are about the only changes over the standard Create Sessions Node
|
// These are about the only changes over the standard Create Sessions Node
|
||||||
Settings.bAllowInvites = bAllowInvites;
|
Settings.bAllowInvites = bAllowInvites;
|
||||||
@@ -133,8 +133,17 @@ void UCreateSessionCallbackProxyAdvanced::OnCreateCompleted(FName SessionName, b
|
|||||||
|
|
||||||
if (bWasSuccessful)
|
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);
|
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
|
// OnStartCompleted will get called, nothing more to do now
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -129,9 +129,8 @@ void UFindSessionsCallbackProxyAdvanced::Activate()
|
|||||||
case EBPServerPresenceSearchType::AllServers:
|
case EBPServerPresenceSearchType::AllServers:
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
// Only steam uses the separate searching flags currently
|
//if (IOnlineSubsystem::DoesInstanceExist("STEAM"))
|
||||||
if (IOnlineSubsystem::DoesInstanceExist("STEAM"))
|
//{
|
||||||
{
|
|
||||||
bRunSecondSearch = true;
|
bRunSecondSearch = true;
|
||||||
|
|
||||||
SearchObjectDedicated = MakeShareable(new FOnlineSessionSearch);
|
SearchObjectDedicated = MakeShareable(new FOnlineSessionSearch);
|
||||||
@@ -139,11 +138,15 @@ void UFindSessionsCallbackProxyAdvanced::Activate()
|
|||||||
SearchObjectDedicated->bIsLanQuery = bUseLAN;
|
SearchObjectDedicated->bIsLanQuery = bUseLAN;
|
||||||
|
|
||||||
FOnlineSearchSettingsEx DedicatedOnly = tem;
|
FOnlineSearchSettingsEx DedicatedOnly = tem;
|
||||||
|
|
||||||
tem.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals);
|
tem.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals);
|
||||||
|
|
||||||
|
if (bSearchLobbies)
|
||||||
|
tem.Set(SEARCH_LOBBIES, true, EOnlineComparisonOp::Equals);
|
||||||
|
|
||||||
//DedicatedOnly.Set(SEARCH_DEDICATED_ONLY, true, EOnlineComparisonOp::Equals);
|
//DedicatedOnly.Set(SEARCH_DEDICATED_ONLY, true, EOnlineComparisonOp::Equals);
|
||||||
SearchObjectDedicated->QuerySettings = DedicatedOnly;
|
SearchObjectDedicated->QuerySettings = DedicatedOnly;
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,8 @@ void ULoginUserCallbackProxy::OnCompleted(int32 LocalUserNum, bool bWasSuccessfu
|
|||||||
if (PlayerControllerWeakPtr.IsValid())
|
if (PlayerControllerWeakPtr.IsValid())
|
||||||
{
|
{
|
||||||
ULocalPlayer* Player = Cast<ULocalPlayer>(PlayerControllerWeakPtr->Player);
|
ULocalPlayer* Player = Cast<ULocalPlayer>(PlayerControllerWeakPtr->Player);
|
||||||
auto uniqueId = UserId.AsShared();
|
|
||||||
|
FUniqueNetIdRepl UniqueID(UserId.AsShared());
|
||||||
|
|
||||||
if (Player)
|
if (Player)
|
||||||
{
|
{
|
||||||
@@ -74,15 +75,13 @@ void ULoginUserCallbackProxy::OnCompleted(int32 LocalUserNum, bool bWasSuccessfu
|
|||||||
{
|
{
|
||||||
Identity->ClearOnLoginCompleteDelegate_Handle(Player->GetControllerId(), DelegateHandle);
|
Identity->ClearOnLoginCompleteDelegate_Handle(Player->GetControllerId(), DelegateHandle);
|
||||||
}
|
}
|
||||||
Player->SetCachedUniqueNetId(uniqueId);
|
Player->SetCachedUniqueNetId(UniqueID);
|
||||||
}
|
}
|
||||||
|
|
||||||
APlayerState* State = PlayerControllerWeakPtr->PlayerState;
|
if (APlayerState* State = PlayerControllerWeakPtr->PlayerState)
|
||||||
|
|
||||||
if (State)
|
|
||||||
{
|
{
|
||||||
// Update UniqueId. See also ShowLoginUICallbackProxy.cpp
|
// Update UniqueId. See also ShowLoginUICallbackProxy.cpp
|
||||||
State->SetUniqueId((const FUniqueNetIdPtr&) uniqueId);
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
"FileVersion" : 3,
|
"FileVersion" : 3,
|
||||||
|
|
||||||
"FriendlyName" : "Advanced Steam Sessions",
|
"FriendlyName" : "Advanced Steam Sessions",
|
||||||
"Version" : 4.27,
|
"Version" : 5.0,
|
||||||
"VersionName": "4.27",
|
"VersionName": "5.0",
|
||||||
"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",
|
||||||
@@ -33,6 +33,10 @@
|
|||||||
{
|
{
|
||||||
"Name": "OnlineSubsystemSteam",
|
"Name": "OnlineSubsystemSteam",
|
||||||
"Enabled": true
|
"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"*/ });
|
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"*/});
|
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" });
|
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
|
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")
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
||||||
FString GroupTag;
|
FString GroupTag;
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
||||||
int32 numOnline;
|
int32 numOnline = 0;
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
||||||
int32 numInGame;
|
int32 numInGame = 0;
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
||||||
int32 numChatting;
|
int32 numChatting = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public:
|
|||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
||||||
FBPUniqueNetId OfficerUniqueNetID; // Uint64 representation
|
FBPUniqueNetId OfficerUniqueNetID; // Uint64 representation
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
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);
|
UTexture2D* Avatar = UTexture2D::CreateTransient(Width, Height, PF_R8G8B8A8);
|
||||||
// Switched to a Memcpy instead of byte by byte transer
|
// 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);
|
FMemory::Memcpy(MipData, (void*)oAvatarRGBA, Height * Width * 4);
|
||||||
Avatar->PlatformData->Mips[0].BulkData.Unlock();
|
PlatformData->Mips[0].BulkData.Unlock();
|
||||||
|
|
||||||
// Original implementation was missing this!!
|
// Original implementation was missing this!!
|
||||||
// the hell man......
|
// the hell man......
|
||||||
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->SetNumSlices(1);
|
PlatformData->SetNumSlices(1);
|
||||||
Avatar->NeverStream = true;
|
Avatar->NeverStream = true;
|
||||||
//Avatar->CompressionSettings = TC_EditorIcon;
|
//Avatar->CompressionSettings = TC_EditorIcon;
|
||||||
|
}
|
||||||
|
|
||||||
Avatar->UpdateResource();
|
Avatar->UpdateResource();
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||||||
|
|
||||||
#include "SteamRequestGroupOfficersCallbackProxy.h"
|
#include "SteamRequestGroupOfficersCallbackProxy.h"
|
||||||
#include "UObject/CoreOnline.h"
|
#include "Online/CoreOnline.h"
|
||||||
#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
|
||||||
|
|||||||
Reference in New Issue
Block a user