Space Plunder
Loading...
Searching...
No Matches
ACustomPlayerController Class Reference

#include <CustomPlayerController.h>

Inheritance diagram for ACustomPlayerController:
AALSPlayerController IInputKeyInterface APlayerControllerBase IPlayerOptions IControllerInterface IPlayerControllerInterface ISaveLoad ACampaignPlayerController

Public Member Functions

 ACustomPlayerController ()
 
class ACustomPlayerStateGetCustomPlayerState () const
 
class ACustomHUDGetCustomHUD () const
 
void ClientAddDeathToKillFeed (FPlayerDeath PlayerDeath, bool bPlayerDeath=true)
 
void ClientUpdateScore (const TArray< FTeamScoreData > &Scores)
 
void ClientSetMultiplayerMode (const EMultiplayerMode Mode)
 
void ClientSetRound (const int32 Num)
 
void ClientSetMultiplayerMatchState (FMatchState State)
 
virtual void MatchOver (FMatchState MatchState, const TArray< FTeamScoreData > &Scores)
 
virtual void RoundOver (FMatchState MatchState, const TArray< FTeamScoreData > &Scores)
 
virtual void SetupInputComponent () override
 
virtual void BindActions (UInputMappingContext *Context) override
 
virtual UInputMappingContext * GetInputActions () override
 
virtual EGameControllerType GetControllerType () override
 
void SetMultiplayerTeamID (const int32 MultiplayerTeam)
 
void GetScore ()
 
- Public Member Functions inherited from APlayerControllerBase
virtual void GetAudioListenerPosition (FVector &OutLocation, FVector &OutFrontDir, FVector &OutRightDir) const override
 
virtual bool SetPlayerLookInverted (const bool bInvert=true) override
 
virtual bool SetPlayerLookHorizontalInverted (const bool bInvert=true) override
 
virtual float SetCameraSensitivity (const float NewValue) override
 
virtual float SetCameraHorizontalSensitivity (const float NewValue) override
 
virtual float SetCameraVerticalSensitivity (const float NewValue) override
 
virtual void SetCameraAimedSensitivityMultiplier (const float NewValue) override
 
virtual void SetCameraUseSeparateAxisSensitivity (const bool bValue) override
 
virtual void SetPlayerUsingController (const bool bValue) override
 
virtual bool GetPlayerUsingController () override
 
virtual bool SaveCurrentPlayerOptions (const FAudioPlayerOptions AudioSettings) override
 
virtual float GetCameraSensitivity () const override
 
virtual float GetCameraAimedSensitivityMultiplier () const override
 
virtual float GetCameraHorizontalSensitivity () const override
 
virtual float GetCameraVerticalSensitivity () const override
 
virtual bool GetCameraUseSeparateAxisSensitivity () const override
 
virtual bool GetPlayerLookInverted () const override
 
virtual bool GetPlayerHorizontalInverted () const override
 
virtual int32 GetAimAssistLevel () const override
 
virtual FAudioPlayerOptions GetPlayerAudioSettings () const override
 
virtual bool RegisterLayer (const FGameplayTag LayerName, UUserWidget *LayerWidget) override
 
virtual UUserWidget * PushContentToLayer (const FGameplayTag LayerName, const TSoftClassPtr< UUserWidget > WidgetClass) override
 
virtual bool PopContentFromLayer (const FGameplayTag LayerName) override
 
virtual bool ClearLayer (const FGameplayTag LayerName) override
 
virtual bool ToggleWidget (const FGameplayTag LayerName, UUserWidget *Widget) override
 
virtual UUserWidget * AddWidgetToLayer (const FGameplayTag LayerName, const TSoftClassPtr< UUserWidget > WidgetClass) override
 
virtual UUserWidget * GetContentFromLayer (const FGameplayTag LayerName, const TSoftClassPtr< UUserWidget > WidgetClass) override
 
virtual UUserWidget * AddWidgetToLayerWithSlot (const FGameplayTag LayerName, const FGameplayTag SlotTag, const TSoftClassPtr< UUserWidget > WidgetClass) override
 
virtual void OpenRadialMenu (const FRadialMenuData &Data) override
 
virtual int32 CloseRadialMenu () override
 
virtual bool GetIsRadialMenuOpen () const override
 
virtual void SetCharacterMode (const FGameplayTag &Mode) override
 
virtual FGameplayTag GetCharacterMode () const override
 
virtual void ToggleGameLog () override
 
virtual FVector2D GetLookAxis () const override
 
virtual FVector2D GetMoveAxis () const override
 
virtual FVector2D GetScreenCenter () const override
 
virtual FVector GetPawnLocation () const override
 
virtual void GetControllerViewPoint (FVector &out_Location, FRotator &out_Rotation) const override
 
virtual bool SaveGame () override
 
virtual bool LoadGame () override
 
void OnCharacterModeChanged (const FGameplayTag &Mode)
 

Public Attributes

TObjectPtr< class ACustomPlayerCharacterPossessedCustomCharacter = nullptr
 
- Public Attributes inherited from AALSPlayerController
TObjectPtr< AALSBaseCharacterPossessedCharacter = nullptr
 
TObjectPtr< UInputMappingContext > DefaultInputMappingContext = nullptr
 
TObjectPtr< UInputMappingContext > DebugInputMappingContext = nullptr
 
- Public Attributes inherited from APlayerControllerBase
TObjectPtr< UInputMappingContext > MenuInputMappingContext = nullptr
 
TObjectPtr< UInputMappingContext > MainInputMappingContext = nullptr
 
bool bDebuggingMode = false
 
FName AudioSocket = FName("head")
 

Protected Member Functions

virtual void BeginPlay () override
 
virtual void OnUnPossess () override
 
virtual void OnPossess (APawn *NewPawn) override
 
virtual void OnRep_Pawn () override
 
virtual void SetAimAssistLevel (const int32 Value) override
 
virtual void OnPawnSpawn () override
 
virtual void OnPawnSpawnComplete () override
 
virtual void ApplySettings (const USettingsSaveGame *LoadedPlayerSettings) override
 
void SetupCustomInputs ()
 
void UseAction (const FInputActionValue &Value) const
 
void ShootAction (const FInputActionValue &Value) const
 
void ReloadAction (const FInputActionValue &Value) const
 
void MeleeAction (const FInputActionValue &Value) const
 
void GrabAction (const FInputActionValue &Value) const
 
void QuickSaveAction (const FInputActionValue &Value) const
 
void QuickLoadAction (const FInputActionValue &Value) const
 
void AutoModeAction (const FInputActionValue &Value) const
 
void ThrowAction (const FInputActionValue &Value) const
 
void SwapWeaponAction (const FInputActionValue &Value) const
 
void HolsterAction (const FInputActionValue &Value) const
 
void PauseAction (const FInputActionValue &Value)
 
void ChatAction (const FInputActionValue &Value) const
 
void QuestMenuAction (const FInputActionValue &Value)
 
void PingAction (const FInputActionValue &Value) const
 
void PingHeldAction (const FInputActionValue &Value) const
 
void ReportBugAction (const FInputActionValue &Value)
 
void ToggleQuestLogMenu ()
 
void ScoreboardMenuAction (const FInputActionValue &Value) const
 
virtual void SelectionUpAction (const FInputActionValue &Value) override
 
virtual void AimAction (const FInputActionValue &Value) override
 
virtual void CameraUpAction (const FInputActionValue &Value) override
 
virtual void CameraRightAction (const FInputActionValue &Value) override
 
float CalculateCameraSensitivity (const float CameraInput) const
 
- Protected Member Functions inherited from AALSPlayerController
virtual void SetupInputs () override
 
void SetupCamera ()
 
virtual void ForwardMovementAction (const FInputActionValue &Value) override
 
virtual void RightMovementAction (const FInputActionValue &Value) override
 
void JumpAction (const FInputActionValue &Value)
 
void SprintAction (const FInputActionValue &Value)
 
void CameraTapAction (const FInputActionValue &Value)
 
void CameraHeldAction (const FInputActionValue &Value)
 
void StanceAction (const FInputActionValue &Value)
 
void WalkAction (const FInputActionValue &Value)
 
void RagdollAction (const FInputActionValue &Value)
 
void VelocityDirectionAction (const FInputActionValue &Value)
 
void LookingDirectionAction (const FInputActionValue &Value)
 
void DebugToggleHudAction (const FInputActionValue &Value)
 
void DebugToggleDebugViewAction (const FInputActionValue &Value)
 
void DebugToggleTracesAction (const FInputActionValue &Value)
 
void DebugToggleShapesAction (const FInputActionValue &Value)
 
void DebugToggleLayerColorsAction (const FInputActionValue &Value)
 
void DebugToggleCharacterInfoAction (const FInputActionValue &Value)
 
void DebugToggleSlomoAction (const FInputActionValue &Value)
 
void DebugFocusedCharacterCycleAction (const FInputActionValue &Value)
 
void DebugToggleMeshAction (const FInputActionValue &Value)
 
void DebugOpenOverlayMenuAction (const FInputActionValue &Value)
 
void DebugOverlayMenuCycleAction (const FInputActionValue &Value)
 
- Protected Member Functions inherited from APlayerControllerBase
virtual void SetupComponents ()
 
virtual bool SavePlayerOptions (const FString &SlotName="Default")
 
virtual bool LoadPlayerOptions (const FString &SlotName="Default")
 
virtual void ApplySettings (const class USettingsSaveGame *LoadedPlayerSettings)
 
virtual USettingsSaveGameApplySettingsToSaveGame (class USettingsSaveGame *LoadedPlayerSettings)
 
virtual void MenuConfirmAction (const FInputActionValue &Value)
 
virtual void MenuBackAction (const FInputActionValue &Value)
 
virtual void CharacterModeAction (const FInputActionValue &Value)
 
IHUDInterfaceGetHUDInterface ()
 
ICharacterBaseInterfaceGetCharacterInterface ()
 
void LogDebugError (const FString &Message) const
 
void LogDebugError (const FString &Message, const int32 Value) const
 
void LogDebugError (const FString &Message, const float Value) const
 
void LogDebugWarning (const FString &Message) const
 
void LogDebugWarning (const FString &Message, const int32 Value) const
 
void LogDebugWarning (const FString &Message, const float Value) const
 
void LogDebugMessage (const FString &Message, const bool bWarning=false, const bool bError=false) const
 
void LogDebugMessage (const FString &Message, const int32 Value, const bool bWarning=false, const bool bError=false) const
 
void LogDebugMessage (const FString &Message, const float Value, const bool bWarning=false, const bool bError=false) const
 
void LogDebugMessage (const FString &Message, const bool bValue, const bool bWarning, const bool bError) const
 
void LogOnScreenMessage (const int32 Key, const FString &Message, FColor Color=FColor::Green) const
 
void SetCategoryName (const FLogCategoryBase &Category)
 

Protected Attributes

class UChatSystemComponent * ChatSystemComponent
 
class UQuestPlayerComponent * QuestPlayerComponent
 
class UAimAssistComponentAimAssistComponent
 
class ACustomHUDHUD
 
class IMultiplayerGSMultiplayerGS
 
class AMultiplayerGameModeMultiplayerGM
 
FGameplayTagContainer Container
 
uint8 TeamID = 1
 
uint8 MultiplayerTeamID = 1
 
float MultiplayerDelayTime = 0.3f
 
float PawnSpawnCompleteDelayTime = 0.3f
 
- Protected Attributes inherited from APlayerControllerBase
FGameplayTag CharacterMode = FGameplayTag(CharacterModeTags::Default)
 
int32 MaxPawnSpawnAttempts = 5
 
bool bAimed = false
 

Private Attributes

int32 PawnSpawnAttempts = 0
 
bool bBindMenuButtonOnce = false
 
TSubclassOf< UUserWidget > SubmitReportWidgetClass
 
class IMenuSystemMenuSystem
 
FTimerHandle SetupCompleteDelayTimerHandle
 
FTimerHandle SetupRetryDelayTimerHandle
 
FTimerHandle SpawnCompleteDelayTimerHandle
 
FTimerHandle UpdateScoreDelayTimerHandle
 

Constructor & Destructor Documentation

◆ ACustomPlayerController()

ACustomPlayerController::ACustomPlayerController ( )
30{
31 ChatSystemComponent = CreateDefaultSubobject<UChatSystemComponent>("Chat System");
32 QuestPlayerComponent = CreateDefaultSubobject<UQuestPlayerComponent>(TEXT("Quest Player"));
33 AimAssistComponent = CreateDefaultSubobject<UAimAssistComponent>(TEXT("Aim Assist"));
34 SubmitReportWidgetClass = UBaseHelpersBPLib::GetDefaultWidgetBPClass("/MenuSystem/Widgets/Website/WBP_SubmitReport");
35}
class UAimAssistComponent * AimAssistComponent
Definition CustomPlayerController.h:104
class UChatSystemComponent * ChatSystemComponent
Definition CustomPlayerController.h:100
class UQuestPlayerComponent * QuestPlayerComponent
Definition CustomPlayerController.h:102
TSubclassOf< UUserWidget > SubmitReportWidgetClass
Definition CustomPlayerController.h:196
static TSubclassOf< UUserWidget > GetDefaultWidgetBPClass(const FString &Location)
Definition BaseHelpersBPLib.cpp:227

Member Function Documentation

◆ AimAction()

void ACustomPlayerController::AimAction ( const FInputActionValue & Value)
overrideprotectedvirtual

Reimplemented from AALSPlayerController.

626{
627 const bool bPressed = Value.Get<bool>();
628 bAimed = bPressed;
629 if(AimAssistComponent != nullptr)
630 {
631 AimAssistComponent->SetIsAiming(bAimed);
632 }
633 if(PossessedCustomCharacter != nullptr)
634 {
635 PossessedCustomCharacter->AimAction(bPressed);
636 }
637 if(HUD != nullptr)
638 {
639 HUD->SetAiming(bPressed);
640 }
641}
virtual void SetAiming(const bool bIsAiming)
Definition CustomHUD.cpp:406
class ACustomHUD * HUD
Definition CustomPlayerController.h:106
TObjectPtr< class ACustomPlayerCharacter > PossessedCustomCharacter
Definition CustomPlayerController.h:33
bool bAimed
Definition PlayerControllerBase.h:239

◆ ApplySettings()

void ACustomPlayerController::ApplySettings ( const USettingsSaveGame * LoadedPlayerSettings)
overrideprotectedvirtual
191{
192 Super::ApplySettings(LoadedPlayerSettings);
193 if(AimAssistComponent != nullptr)
194 {
195 AimAssistComponent->SetAimAssistLevel(GetAimAssistLevel());
196 }
197}
virtual int32 GetAimAssistLevel() const override
Definition PlayerControllerBase.h:118

◆ AutoModeAction()

void ACustomPlayerController::AutoModeAction ( const FInputActionValue & Value) const
protected
423{
424 if(PossessedCustomCharacter != nullptr)
425 {
426 PossessedCustomCharacter->AutoModeAction(Value.Get<bool>());
427 }
428}

◆ BeginPlay()

void ACustomPlayerController::BeginPlay ( )
overrideprotectedvirtual

Reimplemented from APlayerControllerBase.

43{
44 Super::BeginPlay();
45 //@TODO Load Player Options
46}

◆ BindActions()

void ACustomPlayerController::BindActions ( UInputMappingContext * Context)
overridevirtual

Reimplemented from AALSPlayerController.

239{
240 // Super::BindActions(Context);
241 if(Context != nullptr)
242 {
243 const TArray<FEnhancedActionKeyMapping>& Mappings = Context->GetMappings();
244 UEnhancedInputComponent* EnhancedInputComponent = Cast<UEnhancedInputComponent>(InputComponent);
245 if (EnhancedInputComponent)
246 {
247
248 // There may be more than one keymapping assigned to one action. So, first filter duplicate action entries to prevent multiple delegate bindings
249 TSet<const UInputAction*> UniqueActions;
250 for (const FEnhancedActionKeyMapping& Keymapping : Mappings)
251 {
252 UniqueActions.Add(Keymapping.Action);
253 }
254 for(const UInputAction* UniqueAction : UniqueActions)
255 {
256 EnhancedInputComponent->BindAction(UniqueAction, ETriggerEvent::Triggered, Cast<UObject>(this), UniqueAction->GetFName());
257 }
258 }
259 }
260}

◆ CalculateCameraSensitivity()

float ACustomPlayerController::CalculateCameraSensitivity ( const float CameraInput) const
protectedvirtual

Reimplemented from APlayerControllerBase.

644{
645 float CameraSpeed = CameraInput;
646 //CameraSpeed *= CameraSensitivity;
647 if(bAimed){CameraSpeed *= GetCameraAimedSensitivityMultiplier();}
648 if(PossessedCustomCharacter != nullptr)
649 {
650 switch(PossessedCustomCharacter->GetOverlayState())
651 {
661 break;
663 //@TODO Add these back in ?
664 // CameraSpeed *= CameraSensitivityRifleMultiplier;
665 break;
667 // CameraSpeed *= CameraSensitivityOneHandPistolMultiplier;
668 break;
670 // CameraSpeed *= CameraSensitivityTwoHandPistolMultiplier;
671 break;
673 // CameraSpeed *= CameraSensitivityShotgunMultiplier;
674 break;
676 // CameraSpeed *= CameraSensitivitySniperMultiplier;
677 break;
679 // CameraSpeed *= CameraSensitivityLauncherMultiplier;
680 break;
686 // CameraSpeed *= CameraSensitivityMeleeMultiplier;
687 break;
689 // CameraSpeed *= CameraSensitivityBowMultiplier;
690 break;
691 }
692 }
693 return CameraSpeed;
694}
virtual float GetCameraAimedSensitivityMultiplier() const override
Definition PlayerControllerBase.h:94

◆ CameraRightAction()

void ACustomPlayerController::CameraRightAction ( const FInputActionValue & Value)
overrideprotectedvirtual

Reimplemented from AALSPlayerController.

721{
723 float CameraSpeed = CalculateCameraSensitivity(Value.GetMagnitude());
725 {
726 CameraSpeed *= GetCameraHorizontalSensitivity();
727 }
728 else
729 {
730 CameraSpeed *= GetCameraSensitivity();
731 }
732 if(AimAssistComponent != nullptr)
733 {
734 CameraSpeed = AimAssistComponent->CameraMovedRight(CameraSpeed);
735 }
736 if(GetPlayerHorizontalInverted()){CameraSpeed *= -1.0f;}
737 if(PossessedCharacter != nullptr)
738 {
739 PossessedCharacter->CameraRightAction(CameraSpeed);
740 }
741}
TObjectPtr< AALSBaseCharacter > PossessedCharacter
Definition ALSPlayerController.h:111
float CalculateCameraSensitivity(const float CameraInput) const
Definition CustomPlayerController.cpp:643
virtual float GetCameraSensitivity() const override
Definition PlayerControllerBase.h:90
virtual void CameraRightAction(const FInputActionValue &Value)
Definition PlayerControllerBase.cpp:515
virtual float GetCameraHorizontalSensitivity() const override
Definition PlayerControllerBase.h:98
virtual bool GetCameraUseSeparateAxisSensitivity() const override
Definition PlayerControllerBase.h:106
virtual bool GetPlayerHorizontalInverted() const override
Definition PlayerControllerBase.h:114

◆ CameraUpAction()

void ACustomPlayerController::CameraUpAction ( const FInputActionValue & Value)
overrideprotectedvirtual

Reimplemented from AALSPlayerController.

698{
700 float CameraSpeed = CalculateCameraSensitivity(Value.GetMagnitude());
702 {
703 CameraSpeed *= GetCameraVerticalSensitivity();
704 }
705 else
706 {
707 CameraSpeed *= GetCameraSensitivity();
708 }
709 if(AimAssistComponent != nullptr)
710 {
711 CameraSpeed = AimAssistComponent->CameraMovedUp(CameraSpeed);
712 }
713 if(GetPlayerLookInverted()){CameraSpeed *= -1.0f;}
714 if(PossessedCharacter != nullptr)
715 {
716 PossessedCharacter->CameraUpAction(CameraSpeed);
717 }
718}
virtual float GetCameraVerticalSensitivity() const override
Definition PlayerControllerBase.h:102
virtual void CameraUpAction(const FInputActionValue &Value)
Definition PlayerControllerBase.cpp:510
virtual bool GetPlayerLookInverted() const override
Definition PlayerControllerBase.h:110

◆ ChatAction()

void ACustomPlayerController::ChatAction ( const FInputActionValue & Value) const
protected
443{
444 if(ChatSystemComponent != nullptr && HUD != nullptr)
445 {
446 const bool bPressed = Value.Get<bool>();
447 if(bPressed)
448 {
449 if(!HUD->bChatWidget){return;}
450 ChatSystemComponent->ToggleChatWindow(true);
451 }
452 }
453}
bool bChatWidget
Definition CustomHUD.h:126

◆ ClientAddDeathToKillFeed()

void ACustomPlayerController::ClientAddDeathToKillFeed ( FPlayerDeath PlayerDeath,
bool bPlayerDeath = true )

◆ ClientSetMultiplayerMatchState()

void ACustomPlayerController::ClientSetMultiplayerMatchState ( FMatchState State)

◆ ClientSetMultiplayerMode()

void ACustomPlayerController::ClientSetMultiplayerMode ( const EMultiplayerMode Mode)

◆ ClientSetRound()

void ACustomPlayerController::ClientSetRound ( const int32 Num)

◆ ClientUpdateScore()

void ACustomPlayerController::ClientUpdateScore ( const TArray< FTeamScoreData > & Scores)

◆ GetControllerType()

EGameControllerType ACustomPlayerController::GetControllerType ( )
overridevirtual

Implements IInputKeyInterface.

264{
265 TRACE_CPUPROFILER_EVENT_SCOPE(ACustomPlayerController::GetControllerType);
266
267 //@TODO Have Controller Logic//
269
270 if(const UCommonInputSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UCommonInputSubsystem>(GetLocalPlayer()))
271 {
272 const ECommonInputType InputType = Subsystem->GetCurrentInputType();
273 const FName GamepadName = Subsystem->GetCurrentGamepadName();
274 UE_LOG(LogCustomCharacters, Warning, TEXT("Gamepad Name: %s"), *GamepadName.ToString());
275 UE_LOG(LogCustomCharacters, Warning, TEXT("Input Type: %s"), *UEnum::GetValueAsString(InputType));
276 if(InputType == ECommonInputType::Gamepad)
277 {
279 }
280 }
282}
virtual EGameControllerType GetControllerType() override
Definition CustomPlayerController.cpp:263

◆ GetCustomHUD()

class ACustomHUD * ACustomPlayerController::GetCustomHUD ( ) const
inline
40{return HUD;};

◆ GetCustomPlayerState()

ACustomPlayerState * ACustomPlayerController::GetCustomPlayerState ( ) const
38{
39 return Cast<ACustomPlayerState>(PlayerState);
40}

◆ GetInputActions()

virtual UInputMappingContext * ACustomPlayerController::GetInputActions ( )
inlineoverridevirtual

Gets the Player Controllers Input Mapping

Implements IInputKeyInterface.

66{return DefaultInputMappingContext.Get();};
TObjectPtr< UInputMappingContext > DefaultInputMappingContext
Definition ALSPlayerController.h:114

◆ GetScore()

void ACustomPlayerController::GetScore ( )
352{
353 if(MultiplayerGS == nullptr || HUD == nullptr){UE_LOG(LogTemp,Error,TEXT("PC update scores FAILED"));return;}
355 GetWorld()->GetTimerManager().ClearTimer(UpdateScoreDelayTimerHandle);
356}
virtual void SetScore(const TArray< FTeamScoreData > &Scores, const int32 ScoreGoal)
Definition CustomHUD.cpp:384
FTimerHandle UpdateScoreDelayTimerHandle
Definition CustomPlayerController.h:211
class IMultiplayerGS * MultiplayerGS
Definition CustomPlayerController.h:107
virtual int32 GetGoalScore() const =0
virtual const TArray< FTeamScoreData > & GetScores() const =0

◆ GrabAction()

void ACustomPlayerController::GrabAction ( const FInputActionValue & Value) const
protected
391{
392 if(PossessedCustomCharacter != nullptr)
393 {
394 PossessedCustomCharacter->GrabAction(Value.Get<bool>());
395 }
396}

◆ HolsterAction()

void ACustomPlayerController::HolsterAction ( const FInputActionValue & Value) const
protected
618{
619 if(PossessedCustomCharacter != nullptr)
620 {
621 PossessedCustomCharacter->HolsterAction(Value.Get<bool>());
622 }
623}

◆ MatchOver()

virtual void ACustomPlayerController::MatchOver ( FMatchState MatchState,
const TArray< FTeamScoreData > & Scores )
virtual

◆ MeleeAction()

void ACustomPlayerController::MeleeAction ( const FInputActionValue & Value) const
protected
383{
384 if(PossessedCustomCharacter != nullptr)
385 {
386 PossessedCustomCharacter->MeleeAction(Value.Get<bool>());
387 }
388}

◆ OnPawnSpawn()

void ACustomPlayerController::OnPawnSpawn ( )
overrideprotectedvirtual

Reimplemented from APlayerControllerBase.

89{
90 TRACE_CPUPROFILER_EVENT_SCOPE(ACustomPlayerController::OnPawnSpawn);
91 Super::OnPawnSpawn();
92 // if(!IsLocalController())
93 // {
94 // GetWorld()->GetTimerManager().ClearTimer(SetupCompleteDelayTimerHandle);
95 // return;
96 // }
97 // if(PawnSpawnAttempts >= MaxPawnSpawnAttempts)
98 // {
99 // GetWorld()->GetTimerManager().ClearTimer(SetupCompleteDelayTimerHandle);
100 // UE_LOG(LogCustomCharacters, Error, TEXT("Player Controller - Max Pawn Spawn Attempts HIT"));
101 // return;
102 // }
103 if(PossessedCustomCharacter == nullptr)
104 {
105 UE_LOG(LogTemp, Error, TEXT("On Posses, Custom Character Failed. "));
106 PossessedCustomCharacter = Cast<ACustomPlayerCharacter>(GetPawn());
107 }
108 if(MenuSystem == nullptr)
109 {
110 MenuSystem = Cast<IMenuSystem>(GetGameInstance());
111 }
112 if(MultiplayerGS == nullptr)
113 {
114 MultiplayerGS = Cast<IMultiplayerGS>(UGameplayStatics::GetGameState(this));
115 GetWorld()->GetTimerManager().SetTimer(UpdateScoreDelayTimerHandle, this, &ACustomPlayerController::GetScore, MultiplayerDelayTime);
116 }
117 // if(AimAssistComponent != nullptr)
118 // {
119 // AimAssistComponent->SetOwnerPlayerController(this);
120 // }
121
122 HUD = Cast<ACustomHUD>(GetHUD());
123 if(HUD != nullptr)
124 {
125 if(PossessedCustomCharacter != nullptr)
126 {
127 if(GetCustomPlayerState() != nullptr)
128 {
130 if(MenuSystem != nullptr)
131 {
132 if(MenuSystem->GetIsPlayerLoggedIn())
133 {
134 PossessedCustomCharacter->SetPlayerName(GetCustomPlayerState()->GetUserProfile().DisplayName);
135 // PossessedCustomCharacter->SetPlayerName(MenuSystem->GetOnlinePlayerProfile().DisplayName);
136 }
137 }
138 }
139 HUD->SetupWidgets();
140 PossessedCustomCharacter->SetupComponents(this, HUD, IsLocalController());
141 }
142 if(ChatSystemComponent != nullptr)
143 {
144 ChatSystemComponent->SetOwnerPlayerController(this);
145 if(MenuSystem != nullptr)
146 {
147 if(MenuSystem->GetIsPlayerLoggedIn() && GetCustomPlayerState() != nullptr)
148 {
149 ChatSystemComponent->SetPlayerUserProfile(GetCustomPlayerState()->GetUserProfile());
150 // ChatSystemComponent->SetPlayerUserProfile(MenuSystem->GetOnlinePlayerProfile());
151 }
152 }
153 ChatSystemComponent->SetChatBoxWidget(HUD->GetChatBoxWidget());
154 ChatSystemComponent->ComponentSetup();
155 }
156 }
157 else
158 {
159 if(PossessedCustomCharacter != nullptr)
160 {
161 PossessedCustomCharacter->SetupComponents(this, nullptr, IsLocalController());
162 }
163 UE_LOG(LogTemp,Error,TEXT("HUD Class Failed"));
164 }
165}
void SetupWidgets()
Definition CustomHUD.cpp:436
class UChatBoxWidget * GetChatBoxWidget() const
Definition CustomHUD.h:56
void SetPlayerTeamID(const int32 TeamID)
Definition CustomHUD.h:117
float MultiplayerDelayTime
Definition CustomPlayerController.h:184
virtual void OnPawnSpawn() override
Definition CustomPlayerController.cpp:88
class ACustomPlayerState * GetCustomPlayerState() const
Definition CustomPlayerController.cpp:37
void GetScore()
Definition CustomPlayerController.cpp:351
Definition MenuSystem.Build.cs:6

◆ OnPawnSpawnComplete()

void ACustomPlayerController::OnPawnSpawnComplete ( )
overrideprotectedvirtual

Reimplemented from APlayerControllerBase.

168{
169 Super::OnPawnSpawnComplete();
170 // EnableInput(this);
171 //@ TODO Remove This and Replace with OnPawnSpawned //
172 // if(PossessedCustomCharacter != nullptr)
173 // {
174 // PossessedCustomCharacter->OnPawnSpawn();
175 // }
176 if(HUD != nullptr)
177 {
178 HUD->FadeIn();
179 }
180 // if(QuestPlayerComponent != nullptr)
181 // {
182 // QuestPlayerComponent->ComponentSetup();
183 // }
184 // if(AimAssistComponent != nullptr)
185 // {
186 // AimAssistComponent->ComponentSetup();
187 // }
188}
void FadeIn()
Definition CustomHUD.cpp:71

◆ OnPossess()

void ACustomPlayerController::OnPossess ( APawn * NewPawn)
overrideprotectedvirtual

Reimplemented from AALSPlayerController.

49{
50 TRACE_CPUPROFILER_EVENT_SCOPE(ACustomPlayerController::OnPossess);
51 Super::OnPossess(NewPawn);
52 // SetGenericTeamId(FGenericTeamId(5));
53 //@TODO Have retries
54 PossessedCustomCharacter = Cast<ACustomPlayerCharacter>(NewPawn);
55
56 if(!IsRunningDedicatedServer())
57 {
58 // Servers want to setup camera only in listen servers.
60 }
62 if(PossessedCustomCharacter == nullptr){UE_LOG(LogTemp, Error, TEXT("On Posses, Custom Character Failed. "))return;}
63 // PossessedCustomCharacter->SetPlayerController(this);
64 // GetWorld()->GetTimerManager().SetTimer(SetupCompleteDelayTimerHandle, this, &ACustomPlayerController::OnPawnSpawn, MultiplayerStartDelay);
65}
void SetupCamera()
Definition ALSPlayerController.cpp:114
virtual void OnPossess(APawn *NewPawn) override
Definition CustomPlayerController.cpp:48
void SetupCustomInputs()
Definition CustomPlayerController.cpp:284

◆ OnRep_Pawn()

void ACustomPlayerController::OnRep_Pawn ( )
overrideprotectedvirtual

Reimplemented from AALSPlayerController.

68{
69 TRACE_CPUPROFILER_EVENT_SCOPE(ACustomPlayerController::OnRep_Pawn);
70
71 Super::OnRep_Pawn();
72 PossessedCustomCharacter = Cast<ACustomPlayerCharacter>(GetPawn());
75 if(PossessedCustomCharacter == nullptr){UE_LOG(LogTemp, Error, TEXT("On Posses, Custom Character Failed. "))return;}
76 // GetWorld()->GetTimerManager().SetTimer(SetupCompleteDelayTimerHandle, this, &ACustomPlayerController::OnPawnSpawn, MultiplayerStartDelay, false);
77}
virtual void OnRep_Pawn() override
Definition CustomPlayerController.cpp:67

◆ OnUnPossess()

void ACustomPlayerController::OnUnPossess ( )
overrideprotectedvirtual
201{
202 // TArray<UUserWidget*> AllWidgets;
203 // UWidgetBlueprintLibrary::GetAllWidgetsOfClass(this, AllWidgets, UUserWidget::StaticClass());
204 // for(UUserWidget* Widget : AllWidgets)
205 // {
206 // Widget->RemoveFromParent();
207 // }
208 Super::OnUnPossess();
209}

◆ PauseAction()

void ACustomPlayerController::PauseAction ( const FInputActionValue & Value)
protected
431{
432 if(MenuSystem == nullptr)
433 {
434 MenuSystem = Cast<IMenuSystem>(GetGameInstance());
435 }
436 if(MenuSystem != nullptr)
437 {
438 MenuSystem->LaunchInGameMenu(this);
439 }
440}

◆ PingAction()

void ACustomPlayerController::PingAction ( const FInputActionValue & Value) const
protected
494{
495 if(PossessedCustomCharacter == nullptr){return;}
496 const bool bPressed = Value.Get<bool>();
497 PossessedCustomCharacter->PingAction(bPressed);
498}

◆ PingHeldAction()

void ACustomPlayerController::PingHeldAction ( const FInputActionValue & Value) const
protected
501{
502 if(PossessedCustomCharacter == nullptr){return;}
503 const bool bPressed = Value.Get<bool>();
504 if(bPressed)
505 {
506 PossessedCustomCharacter->PingMenuAction();
507 }
508}

◆ QuestMenuAction()

void ACustomPlayerController::QuestMenuAction ( const FInputActionValue & Value)
protected
457{
458 if(HUD == nullptr){return;}
459 if(HUD->GetQuestMenuButton() != nullptr)
460 {
462 }
463 const bool bPressed = Value.Get<bool>();
464 if(bPressed)
465 {
466 if(QuestPlayerComponent != nullptr)
467 {
468 QuestPlayerComponent->TrackButtonPressed();
469 }
471 }
472 else
473 {
475 }
476}
void StartOpenQuestMenu() const
Definition CustomHUD.cpp:778
class UButtonPromptWidget * GetQuestMenuButton() const
Definition CustomHUD.h:57
void StopOpenQuestMenu() const
Definition CustomHUD.cpp:786
void ToggleQuestLogMenu()
Definition CustomPlayerController.cpp:542
FOnButtonPressed OnButtonPressed
Definition ButtonPromptWidget.h:40

◆ QuickLoadAction()

void ACustomPlayerController::QuickLoadAction ( const FInputActionValue & Value) const
protected
407{
408 if(PossessedCustomCharacter != nullptr)
409 {
410 PossessedCustomCharacter->QuickLoadAction(Value.Get<bool>());
411 }
412}

◆ QuickSaveAction()

void ACustomPlayerController::QuickSaveAction ( const FInputActionValue & Value) const
protected
399{
400 if(PossessedCustomCharacter != nullptr)
401 {
402 PossessedCustomCharacter->QuickSaveAction(Value.Get<bool>());
403 }
404}

◆ ReloadAction()

void ACustomPlayerController::ReloadAction ( const FInputActionValue & Value) const
protected
415{
416 if(PossessedCustomCharacter != nullptr)
417 {
418 PossessedCustomCharacter->ReloadAction(Value.Get<bool>());
419 }
420}

◆ ReportBugAction()

void ACustomPlayerController::ReportBugAction ( const FInputActionValue & Value)
protected
528{
529 UUserWidget* SubmitReportWidget = CreateWidget(this, SubmitReportWidgetClass);
530 if(SubmitReportWidget != nullptr)
531 {
532 FInputModeUIOnly UIOnly;
533 UIOnly.SetLockMouseToViewportBehavior(EMouseLockMode::LockAlways);
534 UIOnly.SetWidgetToFocus(SubmitReportWidget->TakeWidget());
535 SetShowMouseCursor(true);
536 UGameplayStatics::SetGamePaused(this, true);
537 SetInputMode(UIOnly);
538 SubmitReportWidget->AddToViewport();
539 }
540}

◆ RoundOver()

virtual void ACustomPlayerController::RoundOver ( FMatchState MatchState,
const TArray< FTeamScoreData > & Scores )
virtual

◆ ScoreboardMenuAction()

void ACustomPlayerController::ScoreboardMenuAction ( const FInputActionValue & Value) const
protected
555{
556 if(MultiplayerGS != nullptr)
557 {
559 }
560 if(HUD == nullptr){return;}
561 const bool bPressed = Value.Get<bool>();
562 if(bPressed)
563 {
565 }
566 else
567 {
568 HUD->OpenScoreboard(false);
569 }
570}
void OpenScoreboard(const bool bOpen=true) const
Definition CustomHUD.cpp:795
virtual void UpdatePlayerStates()=0

◆ SelectionUpAction()

void ACustomPlayerController::SelectionUpAction ( const FInputActionValue & Value)
overrideprotectedvirtual

Reimplemented from APlayerControllerBase.

573{
574 if(HUD == nullptr){return;}
575 // Value.GetMagnitude() > 0
576 const bool bUpSelection = Value.GetMagnitude() < 0;
577 if(PossessedCustomCharacter != nullptr)
578 {
579 PossessedCustomCharacter->SelectionUpAction(bUpSelection);
580 // if(bUpSelection)
581 // {
582 //
583 // }
584 // else
585 // {
586 //
587 // }
588 }
589 // if(bPressed)
590 // {
591 // HUD->SelectionDown();
592 // }
593 // else
594 // {
595 // HUD->SelectionUp();
596 // }
597}

◆ SetAimAssistLevel()

void ACustomPlayerController::SetAimAssistLevel ( const int32 Value)
overrideprotectedvirtual

Reimplemented from APlayerControllerBase.

80{
81 Super::SetAimAssistLevel(Value);
82 if(AimAssistComponent != nullptr)
83 {
84 AimAssistComponent->SetAimAssistLevel(Value);
85 }
86}

◆ SetMultiplayerTeamID()

void ACustomPlayerController::SetMultiplayerTeamID ( const int32 MultiplayerTeam)
inline
72{MultiplayerTeamID = MultiplayerTeam;};
uint8 MultiplayerTeamID
Definition CustomPlayerController.h:176

◆ SetupCustomInputs()

void ACustomPlayerController::SetupCustomInputs ( )
protected
285{
286 if (PossessedCustomCharacter == nullptr){return;}
287 if (UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(GetLocalPlayer()))
288 {
289 FModifyContextOptions Options;
290 Options.bForceImmediately = 1;
291 Subsystem->AddMappingContext(DefaultInputMappingContext, 3, Options);
292 UALSDebugComponent* DebugComp = Cast<UALSDebugComponent>(PossessedCustomCharacter->GetComponentByClass(UALSDebugComponent::StaticClass()));
293 if (DebugComp)
294 {
295 // Do only if we have debug component
296 Subsystem->AddMappingContext(DebugInputMappingContext, 2, Options);
297 }
298 }
299}
TObjectPtr< UInputMappingContext > DebugInputMappingContext
Definition ALSPlayerController.h:117
Definition ALSDebugComponent.h:17

◆ SetupInputComponent()

void ACustomPlayerController::SetupInputComponent ( )
overridevirtual

Reimplemented from AALSPlayerController.

213{
214 //? Call super
215 Super::SetupInputComponent();
216 UEnhancedInputComponent* EnhancedInputComponent = Cast<UEnhancedInputComponent>(InputComponent);
217 if(EnhancedInputComponent != nullptr)
218 {
219 EnhancedInputComponent->ClearActionEventBindings();
220 EnhancedInputComponent->ClearActionValueBindings();
221 EnhancedInputComponent->ClearDebugKeyBindings();
225
226 // for(const FEnhancedActionKeyMapping& Keymapping : DefaultInputMappingContext)
227 // {
228 // UBaseHelpersBPLib::GetAssignedKeyName(this, Keymapping.Action);
229 // }
230 //
231 // if(HUD != nullptr)
232 // {
233 // HUD->SetInputActions();
234 // }
235 }
236}
virtual void BindActions(UInputMappingContext *Context) override
Definition CustomPlayerController.cpp:238
TObjectPtr< UInputMappingContext > MenuInputMappingContext
Definition PlayerControllerBase.h:243

◆ ShootAction()

void ACustomPlayerController::ShootAction ( const FInputActionValue & Value) const
protected
375{
376 if(PossessedCustomCharacter != nullptr)
377 {
378 PossessedCustomCharacter->ShootAction(Value.Get<bool>());
379 }
380}

◆ SwapWeaponAction()

void ACustomPlayerController::SwapWeaponAction ( const FInputActionValue & Value) const
protected
610{
611 if(PossessedCustomCharacter != nullptr)
612 {
613 PossessedCustomCharacter->SwapWeaponAction(Value.Get<bool>());
614 }
615}

◆ ThrowAction()

void ACustomPlayerController::ThrowAction ( const FInputActionValue & Value) const
protected
602{
603 if(PossessedCustomCharacter != nullptr)
604 {
605 PossessedCustomCharacter->ThrowAction(Value.Get<bool>());
606 }
607}

◆ ToggleQuestLogMenu()

void ACustomPlayerController::ToggleQuestLogMenu ( )
protected
543{
544 if(GetHUDInterface() == nullptr){UE_LOG(LogCustomCharacters, Error, TEXT("ACustomPlayerController::ToggleQuestLogMenu"));return;}
546 // if(HUD == nullptr){return;}
547 // HUD->ToggleGameLog();
548 // if(QuestPlayerComponent != nullptr)
549 // {
550 // QuestPlayerComponent->ToggleQuestLog();
551 // }
552}
IHUDInterface * GetHUDInterface()
Definition PlayerControllerBase.cpp:537
virtual void ToggleGameLog()=0

◆ UseAction()

void ACustomPlayerController::UseAction ( const FInputActionValue & Value) const
protected
367{
368 if(PossessedCustomCharacter != nullptr)
369 {
370 PossessedCustomCharacter->UseAction(Value.Get<bool>());
371 }
372}

Member Data Documentation

◆ AimAssistComponent

class UAimAssistComponent* ACustomPlayerController::AimAssistComponent
protected

◆ bBindMenuButtonOnce

bool ACustomPlayerController::bBindMenuButtonOnce = false
private

◆ ChatSystemComponent

class UChatSystemComponent* ACustomPlayerController::ChatSystemComponent
protected

◆ Container

FGameplayTagContainer ACustomPlayerController::Container
protected

◆ HUD

class ACustomHUD* ACustomPlayerController::HUD
protected

◆ MenuSystem

class IMenuSystem* ACustomPlayerController::MenuSystem
private

◆ MultiplayerDelayTime

float ACustomPlayerController::MultiplayerDelayTime = 0.3f
protected

◆ MultiplayerGM

class AMultiplayerGameMode* ACustomPlayerController::MultiplayerGM
protected

◆ MultiplayerGS

class IMultiplayerGS* ACustomPlayerController::MultiplayerGS
protected

◆ MultiplayerTeamID

uint8 ACustomPlayerController::MultiplayerTeamID = 1
protected

◆ PawnSpawnAttempts

int32 ACustomPlayerController::PawnSpawnAttempts = 0
private

◆ PawnSpawnCompleteDelayTime

float ACustomPlayerController::PawnSpawnCompleteDelayTime = 0.3f
protected

◆ PossessedCustomCharacter

TObjectPtr<class ACustomPlayerCharacter> ACustomPlayerController::PossessedCustomCharacter = nullptr

◆ QuestPlayerComponent

class UQuestPlayerComponent* ACustomPlayerController::QuestPlayerComponent
protected

◆ SetupCompleteDelayTimerHandle

FTimerHandle ACustomPlayerController::SetupCompleteDelayTimerHandle
private

◆ SetupRetryDelayTimerHandle

FTimerHandle ACustomPlayerController::SetupRetryDelayTimerHandle
private

◆ SpawnCompleteDelayTimerHandle

FTimerHandle ACustomPlayerController::SpawnCompleteDelayTimerHandle
private

◆ SubmitReportWidgetClass

TSubclassOf<UUserWidget> ACustomPlayerController::SubmitReportWidgetClass
private

◆ TeamID

uint8 ACustomPlayerController::TeamID = 1
protected

◆ UpdateScoreDelayTimerHandle

FTimerHandle ACustomPlayerController::UpdateScoreDelayTimerHandle
private

The documentation for this class was generated from the following files: