LEAP Documentation 40220
Documentation for the LEAP project
VivoxPlayerComponent.h
Go to the documentation of this file.
1// Copyright Blue Isle Studios Inc 2018. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "Components/ActorComponent.h"
7#include "VivoxPlayerComponent.generated.h"
8
10
11UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
12class PROJECTX_API UVivoxPlayerComponent : public UActorComponent
13{
14 GENERATED_BODY()
15
16public:
17 // Sets default values for this component's properties
18 UVivoxPlayerComponent();
19
20 //Binds the input from the player controller to our push to talk-related functions
21 virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent);
22 //Updates spatial chat positioning, currently disabled
23 virtual void TickComponent(float DeltaTime,ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
24 virtual void BeginPlay() override;
25 //External call that auto-resolves the user ID to login and retries if the ID is invalid.
26 virtual void Login();
27
28 UFUNCTION(BlueprintPure)
29 bool IsUsingPushToTalk() const;
30
31 UPROPERTY(BlueprintAssignable)
32 FVivoxChatSignature OnPushToTalkPressed;
33 UPROPERTY(BlueprintAssignable)
34 FVivoxChatSignature OnPushToTalkReleased;
35
36 //Tries to connect to the SessionName + SquadID
37 UFUNCTION(Reliable, Client)
38 void Client_JoinSquadVoiceChannel(const FString& SessionName, const int32 SquadID = INDEX_NONE, bool bForceLeaveChannels = true);
39 void AttemptJoinSquadVoiceChannel(const FString SessionName, const int32 SquadID);
40 UFUNCTION(Reliable, Client)
41 void Client_Login();
42
43protected:
44 //Push to talk bindings
45 void PushToTalkTeamChannelPressed();
46 void PushToTalkTeamChannelReleased();
47 void PushToToggleTeamChannel();
48
49 //A toggle control to make sure PPT with a toggle action is correctly being tracked
50 bool bPPTToggle = false;
51
52 FTimerHandle ClientSquadVoiceChannelJoinHandler;
53 int32 CachedSquadID = INDEX_NONE;
54
55};
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FVivoxChatSignature)