mirror of
https://github.com/mordentral/AdvancedSessionsPlugin.git
synced 2025-10-24 08:54:16 +00:00
FirstCommitdf
This commit is contained in:
109
Source/AdvancedSessions/Classes/AdvancedFriendsGameInstance.h
Normal file
109
Source/AdvancedSessions/Classes/AdvancedFriendsGameInstance.h
Normal file
@@ -0,0 +1,109 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
#include "OnlineSubSystemHeader.h"
|
||||
#include "Kismet/BlueprintFunctionLibrary.h"
|
||||
#include "Online.h"
|
||||
#include "OnlineSubsystem.h"
|
||||
#include "OnlineFriendsInterface.h"
|
||||
#include "OnlineUserInterface.h"
|
||||
#include "OnlineMessageInterface.h"
|
||||
#include "OnlinePresenceInterface.h"
|
||||
#include "Engine/GameInstance.h"
|
||||
#include "OnlineSessionInterface.h"
|
||||
#include "OnlineSessionSettings.h"
|
||||
#include "UObjectIterator.h"
|
||||
#include "AdvancedFriendsInterface.h"
|
||||
|
||||
#include "AdvancedFriendsGameInstance.generated.h"
|
||||
|
||||
|
||||
//General Advanced Sessions Log
|
||||
DECLARE_LOG_CATEGORY_EXTERN(AdvancedFriendsInterfaceLog, Log, All);
|
||||
|
||||
UCLASS()
|
||||
class UAdvancedFriendsGameInstance : public UGameInstance
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
|
||||
UAdvancedFriendsGameInstance(const FObjectInitializer& ObjectInitializer);
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = AdvancedFriendsInterface)
|
||||
bool bCallFriendInterfaceEventsOnPlayerControllers;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = AdvancedFriendsInterface)
|
||||
bool bCallVoiceInterfaceEventsOnPlayerControllers;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = AdvancedVoiceInterface)
|
||||
bool bEnableTalkingStatusDelegate;
|
||||
|
||||
//virtual void PostLoad() override;
|
||||
virtual void Shutdown() override;
|
||||
virtual void Init() override;
|
||||
|
||||
//*** Session invite accepted by local ***//
|
||||
FOnSessionUserInviteAcceptedDelegate SessionInviteAcceptedDelegate;
|
||||
FDelegateHandle SessionInviteAcceptedDelegateHandle;
|
||||
|
||||
void OnSessionInviteAcceptedMaster(const bool bWasSuccessful, int32 LocalPlayer, TSharedPtr<const FUniqueNetId> PersonInviting, const FOnlineSessionSearchResult& SessionToJoin);
|
||||
|
||||
// After a session invite has been accepted by the local player this event is triggered, call JoinSession on the session result to join it
|
||||
UFUNCTION(BlueprintImplementableEvent, Category = "AdvancedFriends")
|
||||
void OnSessionInviteAccepted(int32 LocalPlayerNum, FBPUniqueNetId PersonInviting, const FBlueprintSessionResult& SessionToJoin);
|
||||
|
||||
|
||||
// After a voice status has changed this event is triggered if the bEnableTalkingStatusDelegate property is true
|
||||
UFUNCTION(BlueprintImplementableEvent, Category = "AdvancedVoice")
|
||||
void OnPlayerTalkingStateChanged(FBPUniqueNetId PlayerId, bool bIsTalking);
|
||||
|
||||
void OnPlayerTalkingStateChangedMaster(TSharedRef<const FUniqueNetId> PlayerId, bool bIsTalking);
|
||||
|
||||
FOnPlayerTalkingStateChangedDelegate PlayerTalkingStateChangedDelegate;
|
||||
FDelegateHandle PlayerTalkingStateChangedDelegateHandle;
|
||||
|
||||
//*** Session Invite Received From Friend ***//
|
||||
// REMOVED BECAUSE IT NEVER GETS CALLED
|
||||
/*FOnSessionInviteReceivedDelegate SessionInviteReceivedDelegate;
|
||||
FDelegateHandle SessionInviteReceivedDelegateHandle;
|
||||
|
||||
void OnSessionInviteReceivedMaster(const FUniqueNetId &InvitedPlayer, const FUniqueNetId &FriendInviting, const FOnlineSessionSearchResult& Session);
|
||||
|
||||
// After a session invite has been sent from a friend this event is triggered, call JoinSession on the session result to join it
|
||||
UFUNCTION(BlueprintImplementableEvent, Category = "AdvancedFriends")
|
||||
void OnSessionInviteReceived(const FBPUniqueNetId &InvitedPlayer, const FBPUniqueNetId &FriendInviting, const FBlueprintSessionResult &Session);
|
||||
*/
|
||||
|
||||
//*** Friend Invite Accepted ***//
|
||||
/*FOnInviteAcceptedDelegate FriendInviteAcceptedDelegate;
|
||||
FDelegateHandle FriendInviteAcceptedDelegateHandle;
|
||||
|
||||
void OnFriendInviteAcceptedDelegateMaster(const FUniqueNetId& LocalPlayer, const FUniqueNetId &PlayerInvited);
|
||||
|
||||
// After a session invite has been accepted by a friend this event is triggered
|
||||
UFUNCTION(BlueprintImplementableEvent, Category = "AdvancedFriends")
|
||||
void OnFriendInviteAccepted(const FBPUniqueNetId &InvitedPlayer, const FBPUniqueNetId &PlayerInvited);
|
||||
*/
|
||||
|
||||
//*** Friend Invite Rejected ***//
|
||||
/*FOnInviteRejectedDelegate SessionInviteRejectedByFriendDelegate;
|
||||
FDelegateHandle InviteRejectedByFriendDelegateHandle;
|
||||
|
||||
void OnFriendInviteRejectedDelegateMaster(const FUniqueNetId& LocalPlayer, const FUniqueNetId &PlayerDeclined);
|
||||
|
||||
// After a friend invite has been rejected this event is triggered
|
||||
UFUNCTION(BlueprintImplementableEvent, Category = "AdvancedFriends")
|
||||
void OnFriendInviteRejected(const FBPUniqueNetId &InvitedPlayer, const FBPUniqueNetId &PlayerDeclined);
|
||||
*/
|
||||
|
||||
//*** Removed By Friend ***//
|
||||
/*FOnFriendRemovedDelegate RemovedByFriendDelegate;
|
||||
FDelegateHandle RemovedByFriendDelegateHandle;
|
||||
|
||||
void OnRemovedByFriendDelegateMaster(const FUniqueNetId& LocalPlayer, const FUniqueNetId &FriendRemoved);
|
||||
|
||||
// After a friend removed the player this event is triggered
|
||||
UFUNCTION(BlueprintImplementableEvent, Category = "AdvancedFriends")
|
||||
void OnRemovedByFriend(const FBPUniqueNetId &InvitedPlayer, const FBPUniqueNetId &FriendRemoved);*/
|
||||
};
|
||||
|
||||
44
Source/AdvancedSessions/Classes/AdvancedFriendsInterface.h
Normal file
44
Source/AdvancedSessions/Classes/AdvancedFriendsInterface.h
Normal file
@@ -0,0 +1,44 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
#include "OnlineSubSystemHeader.h"
|
||||
#include "Kismet/BlueprintFunctionLibrary.h"
|
||||
#include "Online.h"
|
||||
#include "OnlineSubsystem.h"
|
||||
#include "OnlineFriendsInterface.h"
|
||||
#include "OnlineUserInterface.h"
|
||||
#include "OnlineMessageInterface.h"
|
||||
#include "OnlinePresenceInterface.h"
|
||||
#include "Engine/GameInstance.h"
|
||||
#include "OnlineSessionInterface.h"
|
||||
#include "OnlineSessionSettings.h"
|
||||
#include "UObjectIterator.h"
|
||||
#include "BlueprintDataDefinitions.h"
|
||||
#include "AdvancedFriendsInterface.generated.h"
|
||||
|
||||
|
||||
UINTERFACE(MinimalAPI)
|
||||
class UAdvancedFriendsInterface : public UInterface
|
||||
{
|
||||
GENERATED_UINTERFACE_BODY()
|
||||
};
|
||||
|
||||
class IAdvancedFriendsInterface
|
||||
{
|
||||
GENERATED_IINTERFACE_BODY()
|
||||
public:
|
||||
|
||||
// Called when the designated LocalUser has accepted a session invite, use JoinSession on result to connect
|
||||
UFUNCTION(BlueprintImplementableEvent, meta = (DisplayName = "OnSessionInviteAccepted"))
|
||||
void OnSessionInviteAccepted(FBPUniqueNetId PersonInviting, const FBlueprintSessionResult& SearchResult);
|
||||
|
||||
// Called when the designated LocalUser has accepted a session invite, use JoinSession on result to connect
|
||||
UFUNCTION(BlueprintImplementableEvent, meta = (DisplayName = "OnPlayerVoiceStateChanged"))
|
||||
void OnPlayerVoiceStateChanged(FBPUniqueNetId PlayerId, bool bIsTalking);
|
||||
|
||||
// REMOVED BECAUSE IT WAS NEVER BEING CALLED
|
||||
// Called when the designated LocalUser has received a session invite, use JoinSession on result to connect
|
||||
//UFUNCTION(BlueprintImplementableEvent, meta = (FriendlyName = "OnSessionInviteReceived"))
|
||||
//void OnSessionInviteReceived(const FBPUniqueNetId &FriendInviting, const FBlueprintSessionResult &Session);
|
||||
|
||||
};
|
||||
56
Source/AdvancedSessions/Classes/AdvancedFriendsLibrary.h
Normal file
56
Source/AdvancedSessions/Classes/AdvancedFriendsLibrary.h
Normal file
@@ -0,0 +1,56 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
#include "OnlineSubSystemHeader.h"
|
||||
#include "Kismet/BlueprintFunctionLibrary.h"
|
||||
#include "Online.h"
|
||||
#include "OnlineSubsystem.h"
|
||||
#include "OnlineFriendsInterface.h"
|
||||
#include "OnlineUserInterface.h"
|
||||
#include "OnlineMessageInterface.h"
|
||||
#include "OnlinePresenceInterface.h"
|
||||
#include "Engine/GameInstance.h"
|
||||
#include "OnlineSessionInterface.h"
|
||||
|
||||
#include "UObjectIterator.h"
|
||||
|
||||
#include "AdvancedFriendsLibrary.generated.h"
|
||||
|
||||
|
||||
//General Advanced Sessions Log
|
||||
DECLARE_LOG_CATEGORY_EXTERN(AdvancedFriendsLog, Log, All);
|
||||
|
||||
|
||||
UCLASS()
|
||||
class UAdvancedFriendsLibrary : public UBlueprintFunctionLibrary
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
|
||||
//********* Friend List Functions *************//
|
||||
|
||||
// Sends an Invite to the current online session to a list of friends
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|FriendsList", meta = (ExpandEnumAsExecs = "Result"))
|
||||
static void SendSessionInviteToFriends(APlayerController *PlayerController, const TArray<FBPUniqueNetId> &Friends, TEnumAsByte<EBlueprintResultSwitch::Type> &Result);
|
||||
|
||||
// Sends an Invite to the current online session to a friend
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|FriendsList", meta = (ExpandEnumAsExecs = "Result"))
|
||||
static void SendSessionInviteToFriend(APlayerController *PlayerController, const FBPUniqueNetId &FriendUniqueNetId, TEnumAsByte<EBlueprintResultSwitch::Type> &Result);
|
||||
|
||||
// Get a friend from the previously read/saved friends list (Must Call GetFriends first for this to return anything)
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|FriendsList")
|
||||
static void GetFriend(APlayerController *PlayerController, const FBPUniqueNetId FriendUniqueNetId, FBPFriendInfo &Friend);
|
||||
|
||||
// Get the previously read/saved friends list (Must Call GetFriends first for this to return anything)
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|FriendsList")
|
||||
static void GetStoredFriendsList(APlayerController *PlayerController, TArray<FBPFriendInfo> &FriendsList);
|
||||
|
||||
// Get the previously read/saved recent players list (Must Call GetRecentPlayers first for this to return anything)
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|RecentPlayersList")
|
||||
static void GetStoredRecentPlayersList(FBPUniqueNetId UniqueNetId, TArray<FBPOnlineRecentPlayer> &PlayersList);
|
||||
|
||||
// Check if a UniqueNetId is a friend
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedFriends|FriendsList")
|
||||
static void IsAFriend(APlayerController *PlayerController, const FBPUniqueNetId UniqueNetId, bool &IsFriend);
|
||||
|
||||
};
|
||||
143
Source/AdvancedSessions/Classes/AdvancedSessionsLibrary.h
Normal file
143
Source/AdvancedSessions/Classes/AdvancedSessionsLibrary.h
Normal file
@@ -0,0 +1,143 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
#include "OnlineSubSystemHeader.h"
|
||||
#include "Kismet/BlueprintFunctionLibrary.h"
|
||||
#include "Online.h"
|
||||
#include "OnlineSubsystem.h"
|
||||
#include "OnlineFriendsInterface.h"
|
||||
#include "OnlineUserInterface.h"
|
||||
#include "OnlineMessageInterface.h"
|
||||
#include "OnlinePresenceInterface.h"
|
||||
#include "Engine/GameInstance.h"
|
||||
#include "OnlineSessionInterface.h"
|
||||
|
||||
#include "UObjectIterator.h"
|
||||
|
||||
#include "AdvancedSessionsLibrary.generated.h"
|
||||
|
||||
|
||||
//General Advanced Sessions Log
|
||||
DECLARE_LOG_CATEGORY_EXTERN(AdvancedSessionsLog, Log, All);
|
||||
|
||||
|
||||
UCLASS()
|
||||
class UAdvancedSessionsLibrary : public UBlueprintFunctionLibrary
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
//********* Session Search Functions *************//
|
||||
|
||||
// Adds or modifies session settings in an existing array depending on if they exist already or not
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo")
|
||||
static void AddOrModifyExtraSettings(const TArray<FSessionPropertyKeyPair> & SettingsArray, const TArray<FSessionPropertyKeyPair> & NewOrChangedSettings, TArray<FSessionPropertyKeyPair> & ModifiedSettingsArray);
|
||||
|
||||
// Get an array of the session settings from a session search result
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo")
|
||||
static void GetExtraSettings(FBlueprintSessionResult SessionResult, TArray<FSessionPropertyKeyPair> & ExtraSettings);
|
||||
|
||||
// Get the current session state
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo")
|
||||
static void GetSessionState(TEnumAsByte<EBPOnlineSessionState::Type> &SessionState);
|
||||
|
||||
// Get the current session settings
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "Result"))
|
||||
static void GetSessionSettings(int32 &NumConnections, bool &bIsLAN, bool &bIsDedicated, bool &bIsAnticheatEnabled, int32 &BuildUniqueID, TArray<FSessionPropertyKeyPair> &ExtraSettings, TEnumAsByte<EBlueprintResultSwitch::Type> &Result);
|
||||
|
||||
// Check if someone is in the current session
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo")
|
||||
static void IsPlayerInSession(const FBPUniqueNetId &PlayerToCheck, bool &bIsInSession);
|
||||
|
||||
// Make a literal session search parameter
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo|Literals")
|
||||
static FSessionsSearchSetting MakeLiteralSessionSearchProperty(FSessionPropertyKeyPair SessionSearchProperty, EOnlineComparisonOpRedux::Type ComparisonOp);
|
||||
|
||||
|
||||
//********* Session Information Functions ***********//
|
||||
|
||||
// Get the Unique Current Build ID
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo")
|
||||
static void GetCurrentUniqueBuildID(int32 &UniqueBuildId);
|
||||
|
||||
// Get the Unique Build ID from a session search result
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo")
|
||||
static void GetUniqueBuildID(FBlueprintSessionResult SessionResult, int32 &UniqueBuildId);
|
||||
|
||||
// Get session custom information key/value as Byte (For Enums)
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "SearchResult"))
|
||||
static void GetSessionPropertyByte(const TArray<FSessionPropertyKeyPair> & ExtraSettings, FName SettingName, TEnumAsByte<ESessionSettingSearchResult::Type> &SearchResult, uint8 &SettingValue);
|
||||
|
||||
// Get session custom information key/value as Bool
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "SearchResult"))
|
||||
static void GetSessionPropertyBool(const TArray<FSessionPropertyKeyPair> & ExtraSettings, FName SettingName, TEnumAsByte<ESessionSettingSearchResult::Type> &SearchResult, bool &SettingValue);
|
||||
|
||||
// Get session custom information key/value as String
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "SearchResult"))
|
||||
static void GetSessionPropertyString(const TArray<FSessionPropertyKeyPair> & ExtraSettings, FName SettingName, TEnumAsByte<ESessionSettingSearchResult::Type> &SearchResult, FString &SettingValue);
|
||||
|
||||
// Get session custom information key/value as Int
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "SearchResult"))
|
||||
static void GetSessionPropertyInt(const TArray<FSessionPropertyKeyPair> & ExtraSettings, FName SettingName, TEnumAsByte<ESessionSettingSearchResult::Type> &SearchResult, int32 &SettingValue);
|
||||
|
||||
// Get session custom information key/value as Float
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "SearchResult"))
|
||||
static void GetSessionPropertyFloat(const TArray<FSessionPropertyKeyPair> & ExtraSettings, FName SettingName, TEnumAsByte<ESessionSettingSearchResult::Type> &SearchResult, float &SettingValue);
|
||||
|
||||
|
||||
// Make a literal session custom information key/value pair from Byte (For Enums)
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo|Literals")
|
||||
static FSessionPropertyKeyPair MakeLiteralSessionPropertyByte(FName Key, uint8 Value);
|
||||
|
||||
// Make a literal session custom information key/value pair from Bool
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo|Literals")
|
||||
static FSessionPropertyKeyPair MakeLiteralSessionPropertyBool(FName Key, bool Value);
|
||||
|
||||
// Make a literal session custom information key/value pair from String
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo|Literals")
|
||||
static FSessionPropertyKeyPair MakeLiteralSessionPropertyString(FName Key, FString Value);
|
||||
|
||||
// Make a literal session custom information key/value pair from Int
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo|Literals")
|
||||
static FSessionPropertyKeyPair MakeLiteralSessionPropertyInt(FName Key, int32 Value);
|
||||
|
||||
// Make a literal session custom information key/value pair from Float
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo|Literals")
|
||||
static FSessionPropertyKeyPair MakeLiteralSessionPropertyFloat(FName Key, float Value);
|
||||
|
||||
|
||||
//******* Player ID functions *********//
|
||||
|
||||
// Get the unique net id of a network player attached to the given controller
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|PlayerID")
|
||||
static void GetUniqueNetID(APlayerController *PlayerController, FBPUniqueNetId &UniqueNetId);
|
||||
|
||||
// Check if a UniqueNetId is a friend
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|UniqueNetId")
|
||||
static void UniqueNetIdToString(const FBPUniqueNetId &UniqueNetId, FString &String);
|
||||
|
||||
//******** Player Name Functions **********//
|
||||
|
||||
// Get the player name of a network player attached to the given controller
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|PlayerName")
|
||||
static void GetPlayerName(APlayerController *PlayerController, FString &PlayerName);
|
||||
|
||||
// Set the player name of a network player attached to the given controller
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|PlayerInfo|PlayerName")
|
||||
static void SetPlayerName(APlayerController *PlayerController, FString PlayerName);
|
||||
|
||||
//********** Misc Player Info Functions *********//
|
||||
|
||||
// Get the number of network players
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|Misc")
|
||||
static void GetNumberOfNetworkPlayers(int32 &NumNetPlayers);
|
||||
|
||||
// Get the network player index of the given controller
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|Misc")
|
||||
static void GetNetPlayerIndex(APlayerController *PlayerController, int32 &NetPlayerIndex);
|
||||
|
||||
// Checks if the stated session subsystem is active
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|Misc")
|
||||
static bool HasOnlineSubsystem(FName SubSystemName);
|
||||
|
||||
|
||||
};
|
||||
96
Source/AdvancedSessions/Classes/AdvancedVoiceLibrary.h
Normal file
96
Source/AdvancedSessions/Classes/AdvancedVoiceLibrary.h
Normal file
@@ -0,0 +1,96 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
#include "OnlineSubSystemHeader.h"
|
||||
#include "Kismet/BlueprintFunctionLibrary.h"
|
||||
#include "Online.h"
|
||||
#include "OnlineSubsystem.h"
|
||||
#include "VoiceInterface.h"
|
||||
//#include "OnlineFriendsInterface.h"
|
||||
//#include "OnlineUserInterface.h"
|
||||
//#include "OnlineMessageInterface.h"
|
||||
//#include "OnlinePresenceInterface.h"
|
||||
#include "Engine/GameInstance.h"
|
||||
//#include "OnlineSessionInterface.h"
|
||||
|
||||
#include "UObjectIterator.h"
|
||||
|
||||
#include "AdvancedVoiceLibrary.generated.h"
|
||||
|
||||
|
||||
//General Advanced Sessions Log
|
||||
DECLARE_LOG_CATEGORY_EXTERN(AdvancedVoiceLog, Log, All);
|
||||
|
||||
|
||||
UCLASS()
|
||||
class UAdvancedVoiceLibrary : public UBlueprintFunctionLibrary
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
|
||||
//********* Voice Library Functions *************//
|
||||
|
||||
// Get if a headset is present for the specified local user
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedVoice|VoiceInfo")
|
||||
static void IsHeadsetPresent(bool & bHasHeadset, uint8 LocalPlayerNum = 0);
|
||||
|
||||
// Starts networked voice, allows push to talk in coordination with StopNetworkedVoice
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice")
|
||||
static void StartNetworkedVoice(uint8 LocalPlayerNum = 0);
|
||||
|
||||
// Stops networked voice, allows push to talk in coordination with StartNetworkedVoice
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice")
|
||||
static void StopNetworkedVoice(uint8 LocalPlayerNum = 0);
|
||||
|
||||
// Registers a local player as someone interested in voice data
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice")
|
||||
static bool RegisterLocalTalker(uint8 LocalPlayerNum = 0);
|
||||
|
||||
// Registers all signed in players as local talkers
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice")
|
||||
static void RegisterAllLocalTalkers();
|
||||
|
||||
// UnRegisters local player as a local talker
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice")
|
||||
static void UnRegisterLocalTalker(uint8 LocalPlayerNum = 0);
|
||||
|
||||
// UnRegisters all signed in players as local talkers
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice")
|
||||
static void UnRegisterAllLocalTalkers();
|
||||
|
||||
// Registers a remote player as a talker
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice")
|
||||
static bool RegisterRemoteTalker(const FBPUniqueNetId& UniqueNetId);
|
||||
|
||||
// UnRegisters a remote player as a talker
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice")
|
||||
static bool UnRegisterRemoteTalker(const FBPUniqueNetId& UniqueNetId);
|
||||
|
||||
// UnRegisters all remote players as talkers
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice")
|
||||
static void RemoveAllRemoteTalkers();
|
||||
|
||||
// Returns whether a local player is currently talking
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedVoice|VoiceInfo")
|
||||
static bool IsLocalPlayerTalking(uint8 LocalPlayerNum);
|
||||
|
||||
// Returns whether a remote player is currently talking
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedVoice|VoiceInfo")
|
||||
static bool IsRemotePlayerTalking(const FBPUniqueNetId& UniqueNetId);
|
||||
|
||||
// Returns whether a player is muted for the specified local player
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedVoice|VoiceInfo")
|
||||
static bool IsPlayerMuted(uint8 LocalUserNumChecking, const FBPUniqueNetId& UniqueNetId);
|
||||
|
||||
// Mutes the player associated with the uniquenetid for the specified local player, if IsSystemWide is true then it will attempt to mute globally for the player
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice")
|
||||
static bool MuteRemoteTalker(uint8 LocalUserNum, const FBPUniqueNetId& UniqueNetId, bool bIsSystemWide = false);
|
||||
|
||||
// UnMutes the player associated with the uniquenetid for the specified local player, if IsSystemWide is true then it will attempt to unmute globally for the player
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice")
|
||||
static bool UnMuteRemoteTalker(uint8 LocalUserNum, const FBPUniqueNetId& UniqueNetId, bool bIsSystemWide = false);
|
||||
|
||||
// Gets the number of local talkers for this system
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedVoice|VoiceInfo")
|
||||
static void GetNumLocalTalkers(int32 & NumLocalTalkers);
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||||
#pragma once
|
||||
|
||||
#include "OnlineSessionInterface.h"
|
||||
#include "CancelFindSessionsCallbackProxy.generated.h"
|
||||
|
||||
UCLASS(MinimalAPI)
|
||||
class UCancelFindSessionsCallbackProxy : 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;
|
||||
|
||||
// Cancels finding sessions
|
||||
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedSessions")
|
||||
static UCancelFindSessionsCallbackProxy* CancelFindSessions(UObject* WorldContextObject, class APlayerController* PlayerController);
|
||||
|
||||
// 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(bool bWasSuccessful);
|
||||
|
||||
private:
|
||||
// The player controller triggering things
|
||||
TWeakObjectPtr<APlayerController> PlayerControllerWeakPtr;
|
||||
|
||||
// The delegate executed by the online subsystem
|
||||
FOnCancelFindSessionsCompleteDelegate Delegate;
|
||||
|
||||
// Handle to the registered OnDestroySessionComplete delegate
|
||||
FDelegateHandle DelegateHandle;
|
||||
|
||||
// The world context object in which this call is taking place
|
||||
UObject* WorldContextObject;
|
||||
};
|
||||
@@ -0,0 +1,67 @@
|
||||
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||||
#pragma once
|
||||
|
||||
#include "OnlineSubSystemHeader.h"
|
||||
|
||||
#include "CreateSessionCallbackProxyAdvanced.generated.h"
|
||||
|
||||
UCLASS(MinimalAPI)
|
||||
class UCreateSessionCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase
|
||||
{
|
||||
GENERATED_UCLASS_BODY()
|
||||
|
||||
// Called when the session was created successfully
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FEmptyOnlineDelegate OnSuccess;
|
||||
|
||||
// Called when there was an error creating the session
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FEmptyOnlineDelegate OnFailure;
|
||||
|
||||
// Creates a session with the default online subsystem with advanced optional inputs
|
||||
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, bool bUseLAN = false, bool bAllowInvites = true, bool bIsDedicatedServer = false);
|
||||
|
||||
// UOnlineBlueprintCallProxyBase interface
|
||||
virtual void Activate() override;
|
||||
// End of UOnlineBlueprintCallProxyBase interface
|
||||
|
||||
private:
|
||||
// Internal callback when session creation completes, calls StartSession
|
||||
void OnCreateCompleted(FName SessionName, bool bWasSuccessful);
|
||||
|
||||
// Internal callback when session creation completes, calls StartSession
|
||||
void OnStartCompleted(FName SessionName, bool bWasSuccessful);
|
||||
|
||||
// The player controller triggering things
|
||||
TWeakObjectPtr<APlayerController> PlayerControllerWeakPtr;
|
||||
|
||||
// The delegate executed by the online subsystem
|
||||
FOnCreateSessionCompleteDelegate CreateCompleteDelegate;
|
||||
|
||||
// The delegate executed by the online subsystem
|
||||
FOnStartSessionCompleteDelegate StartCompleteDelegate;
|
||||
|
||||
// Handles to the registered delegates above
|
||||
FDelegateHandle CreateCompleteDelegateHandle;
|
||||
FDelegateHandle StartCompleteDelegateHandle;
|
||||
|
||||
// Number of public connections
|
||||
int NumPublicConnections;
|
||||
|
||||
// Whether or not to search LAN
|
||||
bool bUseLAN;
|
||||
|
||||
// Whether or not to allow invites
|
||||
bool bAllowInvites;
|
||||
|
||||
// Whether this is a dedicated server or not
|
||||
bool bDedicatedServer;
|
||||
|
||||
// Store extra settings
|
||||
TArray<FSessionPropertyKeyPair> ExtraSettings;
|
||||
|
||||
// The world context object in which this call is taking place
|
||||
UObject* WorldContextObject;
|
||||
};
|
||||
|
||||
44
Source/AdvancedSessions/Classes/EndSessionCallbackProxy.h
Normal file
44
Source/AdvancedSessions/Classes/EndSessionCallbackProxy.h
Normal file
@@ -0,0 +1,44 @@
|
||||
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||||
#pragma once
|
||||
|
||||
#include "OnlineSessionInterface.h"
|
||||
#include "EndSessionCallbackProxy.generated.h"
|
||||
|
||||
UCLASS(MinimalAPI)
|
||||
class UEndSessionCallbackProxy : 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;
|
||||
|
||||
// Ends the current session
|
||||
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedSessions")
|
||||
static UEndSessionCallbackProxy* EndSession(UObject* WorldContextObject, class APlayerController* PlayerController);
|
||||
|
||||
// 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(FName SessionName, bool bWasSuccessful);
|
||||
|
||||
private:
|
||||
// The player controller triggering things
|
||||
TWeakObjectPtr<APlayerController> PlayerControllerWeakPtr;
|
||||
|
||||
// The delegate executed by the online subsystem
|
||||
FOnEndSessionCompleteDelegate Delegate;
|
||||
|
||||
// Handle to the registered OnDestroySessionComplete delegate
|
||||
FDelegateHandle DelegateHandle;
|
||||
|
||||
// The world context object in which this call is taking place
|
||||
UObject* WorldContextObject;
|
||||
};
|
||||
@@ -0,0 +1,50 @@
|
||||
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||||
#pragma once
|
||||
|
||||
#include "OnlineSubSystemHeader.h"
|
||||
|
||||
#include "FindFriendSessionCallbackProxy.generated.h"
|
||||
|
||||
DECLARE_LOG_CATEGORY_EXTERN(AdvancedFindFriendSessionLog, Log, All);
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FBlueprintFindFriendSessionDelegate, const FBlueprintSessionResult&, SessionInfo);
|
||||
|
||||
UCLASS(MinimalAPI)
|
||||
class UFindFriendSessionCallbackProxy : public UOnlineBlueprintCallProxyBase
|
||||
{
|
||||
GENERATED_UCLASS_BODY()
|
||||
|
||||
// Called when the friends list successfully was retrieved
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FBlueprintFindFriendSessionDelegate OnSuccess;
|
||||
|
||||
// Called when there was an error retrieving the friends list
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FBlueprintFindFriendSessionDelegate OnFailure;
|
||||
|
||||
// Attempts to get the current session that a friend is in
|
||||
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedFriends")
|
||||
static UFindFriendSessionCallbackProxy* FindFriendSession(UObject* WorldContextObject, APlayerController *PlayerController, const FBPUniqueNetId &FriendUniqueNetId);
|
||||
|
||||
virtual void Activate() override;
|
||||
|
||||
private:
|
||||
// Internal callback when the friends list is retrieved
|
||||
void OnFindFriendSessionCompleted(int32 LocalPlayer, bool bWasSuccessful, const FOnlineSessionSearchResult& SessionInfo);
|
||||
|
||||
// The player controller triggering things
|
||||
TWeakObjectPtr<APlayerController> PlayerControllerWeakPtr;
|
||||
|
||||
// The UniqueNetID of the person to invite
|
||||
FBPUniqueNetId cUniqueNetId;
|
||||
|
||||
// The delegate to call on completion
|
||||
FOnFindFriendSessionCompleteDelegate OnFindFriendSessionCompleteDelegate;
|
||||
|
||||
// Handles to the registered delegates above
|
||||
FDelegateHandle FindFriendSessionCompleteDelegateHandle;
|
||||
|
||||
// The world context object in which this call is taking place
|
||||
UObject* WorldContextObject;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||||
#pragma once
|
||||
|
||||
#include "OnlineSessionInterface.h"
|
||||
#include "OnlineSubSystemHeader.h"
|
||||
#include "FindSessionsCallbackProxy.h"
|
||||
#include "FindSessionsCallbackProxyAdvanced.generated.h"
|
||||
|
||||
UCLASS(MinimalAPI)
|
||||
class UFindSessionsCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase
|
||||
{
|
||||
GENERATED_UCLASS_BODY()
|
||||
|
||||
// Called when there is a successful query
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FBlueprintFindSessionsResultDelegate OnSuccess;
|
||||
|
||||
// Called when there is an unsuccessful query
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FBlueprintFindSessionsResultDelegate OnFailure;
|
||||
|
||||
// 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, const TArray<FSessionsSearchSetting> &Filters);
|
||||
|
||||
static bool CompareVariants(const FVariantData &A, const FVariantData &B, EOnlineComparisonOpRedux::Type Comparator);
|
||||
|
||||
// Filters an array of session results by the given search parameters, returns a new array with the filtered results
|
||||
UFUNCTION(BluePrintCallable, meta = (Category = "Online|AdvancedSessions"))
|
||||
static void FilterSessionResults(const TArray<FBlueprintSessionResult> &SessionResults, const TArray<FSessionsSearchSetting> &Filters, TArray<FBlueprintSessionResult> &FilteredResults);
|
||||
|
||||
// Removed, the default built in versions work fine in the normal FindSessionsCallbackProxy
|
||||
/*UFUNCTION(BlueprintPure, Category = "Online|Session")
|
||||
static int32 GetPingInMs(const FBlueprintSessionResult& Result);
|
||||
|
||||
UFUNCTION(BlueprintPure, Category = "Online|Session")
|
||||
static FString GetServerName(const FBlueprintSessionResult& Result);
|
||||
|
||||
UFUNCTION(BlueprintPure, Category = "Online|Session")
|
||||
static int32 GetCurrentPlayers(const FBlueprintSessionResult& Result);
|
||||
|
||||
UFUNCTION(BlueprintPure, Category = "Online|Session")
|
||||
static int32 GetMaxPlayers(const FBlueprintSessionResult& Result);*/
|
||||
|
||||
|
||||
// UOnlineBlueprintCallProxyBase interface
|
||||
virtual void Activate() override;
|
||||
// End of UOnlineBlueprintCallProxyBase interface
|
||||
|
||||
private:
|
||||
// Internal callback when the session search completes, calls out to the public success/failure callbacks
|
||||
void OnCompleted(bool bSuccess);
|
||||
|
||||
private:
|
||||
// The player controller triggering things
|
||||
TWeakObjectPtr<APlayerController> PlayerControllerWeakPtr;
|
||||
|
||||
// The delegate executed by the online subsystem
|
||||
FOnFindSessionsCompleteDelegate Delegate;
|
||||
|
||||
// Handle to the registered OnFindSessionsComplete delegate
|
||||
FDelegateHandle DelegateHandle;
|
||||
|
||||
// Object to track search results
|
||||
TSharedPtr<FOnlineSessionSearch> SearchObject;
|
||||
|
||||
// Whether or not to search LAN
|
||||
bool bUseLAN;
|
||||
|
||||
// Maximum number of results to return
|
||||
int MaxResults;
|
||||
|
||||
// Store extra settings
|
||||
TArray<FSessionsSearchSetting> SearchSettings;
|
||||
|
||||
// The world context object in which this call is taking place
|
||||
UObject* WorldContextObject;
|
||||
};
|
||||
48
Source/AdvancedSessions/Classes/GetFriendsCallbackProxy.h
Normal file
48
Source/AdvancedSessions/Classes/GetFriendsCallbackProxy.h
Normal file
@@ -0,0 +1,48 @@
|
||||
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||||
#pragma once
|
||||
|
||||
#include "OnlineSubSystemHeader.h"
|
||||
|
||||
#include "GetFriendsCallbackProxy.generated.h"
|
||||
|
||||
DECLARE_LOG_CATEGORY_EXTERN(AdvancedGetFriendsLog, Log, All);
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FBlueprintGetFriendsListDelegate, const TArray<FBPFriendInfo>&, Results);
|
||||
|
||||
UCLASS(MinimalAPI)
|
||||
class UGetFriendsCallbackProxy : public UOnlineBlueprintCallProxyBase
|
||||
{
|
||||
GENERATED_UCLASS_BODY()
|
||||
|
||||
// Called when the friends list successfully was retrieved
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FBlueprintGetFriendsListDelegate OnSuccess;
|
||||
|
||||
// Called when there was an error retrieving the friends list
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FBlueprintGetFriendsListDelegate OnFailure;
|
||||
|
||||
// Gets the players list of friends from the OnlineSubsystem and returns it, can be retrieved later with GetStoredFriendsList
|
||||
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedFriends")
|
||||
static UGetFriendsCallbackProxy* GetAndStoreFriendsList(UObject* WorldContextObject, class APlayerController* PlayerController);
|
||||
|
||||
virtual void Activate() override;
|
||||
|
||||
private:
|
||||
// Internal callback when the friends list is retrieved
|
||||
void OnReadFriendsListCompleted(int32 LocalUserNum, bool bWasSuccessful, const FString& ListName, const FString& ErrorString);
|
||||
|
||||
// The player controller triggering things
|
||||
TWeakObjectPtr<APlayerController> PlayerControllerWeakPtr;
|
||||
|
||||
// The delegate executed
|
||||
FOnReadFriendsListComplete FriendListReadCompleteDelegate;
|
||||
|
||||
// The Type of friends list to get
|
||||
// Removed because all but the facebook interfaces don't even currently support anything but the default friends list.
|
||||
//EBPFriendsLists::Type FriendListToGet;
|
||||
|
||||
// The world context object in which this call is taking place
|
||||
UObject* WorldContextObject;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||||
#pragma once
|
||||
|
||||
#include "OnlineSubSystemHeader.h"
|
||||
|
||||
#include "GetRecentPlayersCallbackProxy.generated.h"
|
||||
|
||||
DECLARE_LOG_CATEGORY_EXTERN(AdvancedGetRecentPlayersLog, Log, All);
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FBlueprintGetRecentPlayersDelegate, const TArray<FBPOnlineRecentPlayer>&, Results);
|
||||
|
||||
UCLASS(MinimalAPI)
|
||||
class UGetRecentPlayersCallbackProxy : public UOnlineBlueprintCallProxyBase
|
||||
{
|
||||
GENERATED_UCLASS_BODY()
|
||||
|
||||
// Called when the friends list successfully was retrieved
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FBlueprintGetRecentPlayersDelegate OnSuccess;
|
||||
|
||||
// Called when there was an error retrieving the friends list
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FBlueprintGetRecentPlayersDelegate OnFailure;
|
||||
|
||||
// Gets the list of recent players from the OnlineSubsystem and returns it, can be retrieved later with GetStoredRecentPlayersList, can fail if no recent players are found
|
||||
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedFriends")
|
||||
static UGetRecentPlayersCallbackProxy* GetAndStoreRecentPlayersList(UObject* WorldContextObject, const FBPUniqueNetId &UniqueNetId);
|
||||
|
||||
virtual void Activate() override;
|
||||
|
||||
private:
|
||||
// Internal callback when the friends list is retrieved
|
||||
void OnQueryRecentPlayersCompleted(const FUniqueNetId &UserID, const FString &Namespace, bool bWasSuccessful, const FString& ErrorString);
|
||||
// Handle to the registered OnFindSessionsComplete delegate
|
||||
FDelegateHandle DelegateHandle;
|
||||
|
||||
// The player controller triggering things
|
||||
//TWeakObjectPtr<APlayerController> PlayerControllerWeakPtr;
|
||||
|
||||
// The UniqueNetID of the person to get recent players for
|
||||
FBPUniqueNetId cUniqueNetId;
|
||||
|
||||
// The delegate executed
|
||||
FOnQueryRecentPlayersCompleteDelegate QueryRecentPlayersCompleteDelegate;
|
||||
|
||||
// The world context object in which this call is taking place
|
||||
UObject* WorldContextObject;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||||
#pragma once
|
||||
|
||||
#include "OnlineSubSystemHeader.h"
|
||||
|
||||
#include "SendFriendInviteCallbackProxy.generated.h"
|
||||
|
||||
DECLARE_LOG_CATEGORY_EXTERN(AdvancedSendFriendInviteLog, Log, All);
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FBlueprintSendFriendInviteDelegate);
|
||||
|
||||
UCLASS(MinimalAPI)
|
||||
class USendFriendInviteCallbackProxy : public UOnlineBlueprintCallProxyBase
|
||||
{
|
||||
GENERATED_UCLASS_BODY()
|
||||
|
||||
// Called when the friends list successfully was retrieved
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FBlueprintSendFriendInviteDelegate OnSuccess;
|
||||
|
||||
// Called when there was an error retrieving the friends list
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FBlueprintSendFriendInviteDelegate OnFailure;
|
||||
|
||||
// Adds a friend who is using the defined UniqueNetId, some interfaces do now allow this function to be called (INCLUDING STEAM)
|
||||
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedFriends")
|
||||
static USendFriendInviteCallbackProxy* SendFriendInvite(UObject* WorldContextObject, APlayerController *PlayerController, const FBPUniqueNetId &UniqueNetIDInvited);
|
||||
|
||||
virtual void Activate() override;
|
||||
|
||||
private:
|
||||
// Internal callback when the friends list is retrieved
|
||||
void OnSendInviteComplete(int32 LocalPlayerNum, bool bWasSuccessful, const FUniqueNetId &InvitedPlayer, const FString &ListName, const FString &ErrorString);
|
||||
|
||||
|
||||
// The player controller triggering things
|
||||
TWeakObjectPtr<APlayerController> PlayerControllerWeakPtr;
|
||||
|
||||
// The UniqueNetID of the person to invite
|
||||
FBPUniqueNetId cUniqueNetId;
|
||||
|
||||
// The delegate to call on completion
|
||||
FOnSendInviteComplete OnSendInviteCompleteDelegate;
|
||||
|
||||
// The world context object in which this call is taking place
|
||||
UObject* WorldContextObject;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||||
#pragma once
|
||||
|
||||
#include "OnlineSubSystemHeader.h"
|
||||
|
||||
#include "UpdateSessionCallbackProxyAdvanced.generated.h"
|
||||
|
||||
UCLASS(MinimalAPI)
|
||||
class UUpdateSessionCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase
|
||||
{
|
||||
GENERATED_UCLASS_BODY()
|
||||
|
||||
// Called when the session was updated successfully
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FEmptyOnlineDelegate OnSuccess;
|
||||
|
||||
// Called when there was an error updating the session
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FEmptyOnlineDelegate OnFailure;
|
||||
|
||||
// Creates a session with the default online subsystem with advanced optional inputs
|
||||
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject",AutoCreateRefTerm="ExtraSettings"), Category = "Online|AdvancedSessions")
|
||||
static UUpdateSessionCallbackProxyAdvanced* UpdateSession(UObject* WorldContextObject, int32 PublicConnections, bool bUseLAN, bool bAllowInvites, bool bAllowJoinInProgress, const TArray<FSessionPropertyKeyPair> &ExtraSettings, bool bRefreshOnlineData = true, bool bIsDedicatedServer = false);
|
||||
|
||||
// UOnlineBlueprintCallProxyBase interface
|
||||
virtual void Activate() override;
|
||||
// End of UOnlineBlueprintCallProxyBase interface
|
||||
|
||||
private:
|
||||
// Internal callback when session creation completes, calls StartSession
|
||||
void OnUpdateCompleted(FName SessionName, bool bWasSuccessful);
|
||||
|
||||
// The delegate executed by the online subsystem
|
||||
FOnUpdateSessionCompleteDelegate OnUpdateSessionCompleteDelegate;
|
||||
|
||||
// Handles to the registered delegates above
|
||||
FDelegateHandle OnUpdateSessionCompleteDelegateHandle;
|
||||
|
||||
// Number of public connections
|
||||
int NumPublicConnections;
|
||||
|
||||
// Whether or not to search LAN
|
||||
bool bUseLAN;
|
||||
|
||||
// Whether or not to allow invites
|
||||
bool bAllowInvites;
|
||||
|
||||
// Store extra settings
|
||||
TArray<FSessionPropertyKeyPair> ExtraSettings;
|
||||
|
||||
// Whether to update the online data
|
||||
bool bRefreshOnlineData;
|
||||
|
||||
// Allow joining in progress
|
||||
bool bAllowJoinInProgress;
|
||||
|
||||
// Update whether this is a dedicated server or not
|
||||
bool bDedicatedServer;
|
||||
|
||||
// The world context object in which this call is taking place
|
||||
UObject* WorldContextObject;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user