Global settings renamed to something that does not reference the old subsystem.
This commit is contained in:
parent
aa81438bc7
commit
bf43acf0dc
@ -7,7 +7,7 @@
|
|||||||
#include "Kismet/GameplayStatics.h"
|
#include "Kismet/GameplayStatics.h"
|
||||||
|
|
||||||
#include "Components/ComboManagerComponent.h"
|
#include "Components/ComboManagerComponent.h"
|
||||||
#include "GlobalSettings/InputBufferSubsystemGlobalSettings.h"
|
#include "GlobalSettings/InputBufferGlobalSettings.h"
|
||||||
|
|
||||||
DEFINE_LOG_CATEGORY(LogInputBufferComponent);
|
DEFINE_LOG_CATEGORY(LogInputBufferComponent);
|
||||||
|
|
||||||
@ -24,12 +24,13 @@ void UInputBufferComponent::BeginPlay()
|
|||||||
this->OnNewComboInput.BindUObject(ComboManager, &UComboManagerComponent::HandleComboInput);
|
this->OnNewComboInput.BindUObject(ComboManager, &UComboManagerComponent::HandleComboInput);
|
||||||
|
|
||||||
// Get all unique EnhancedInput actions bound to combo input actions.
|
// Get all unique EnhancedInput actions bound to combo input actions.
|
||||||
const UInputBufferSubsystemGlobalSettings *Settings = GetDefault<UInputBufferSubsystemGlobalSettings>();
|
const UInputBufferGlobalSettings *Settings = GetDefault<UInputBufferGlobalSettings>();
|
||||||
TSet<const UInputAction *> InputActionsToBind;
|
TSet<const UInputAction *> InputActionsToBind;
|
||||||
for (TSoftObjectPtr<const UComboInputAsset> ComboInput : Settings->ComboActions)
|
for (TSoftObjectPtr<const UComboInputAsset> ComboInput : Settings->ComboInputs)
|
||||||
{
|
{
|
||||||
if (ComboInput.IsValid())
|
if (ComboInput.IsValid())
|
||||||
{
|
{
|
||||||
|
this->ComboInputList.Emplace(ComboInput.Get());
|
||||||
for (const UInputAction *InputAction : ComboInput->ActionGroup)
|
for (const UInputAction *InputAction : ComboInput->ActionGroup)
|
||||||
{
|
{
|
||||||
InputActionsToBind.Add(InputAction);
|
InputActionsToBind.Add(InputAction);
|
||||||
@ -56,24 +57,17 @@ void UInputBufferComponent::AddActionToBuffer(const FInputActionValue &Value, co
|
|||||||
this->ExpiringActions.Remove(Action);
|
this->ExpiringActions.Remove(Action);
|
||||||
|
|
||||||
// Find any combo input that matches this action, plus buffered actions.
|
// Find any combo input that matches this action, plus buffered actions.
|
||||||
const UInputBufferSubsystemGlobalSettings *Settings = GetDefault<UInputBufferSubsystemGlobalSettings>();
|
for (TObjectPtr<const UComboInputAsset> ComboInput : this->ComboInputList)
|
||||||
for (TSoftObjectPtr<const UComboInputAsset> ComboInput : Settings->ComboActions)
|
|
||||||
{
|
{
|
||||||
if (ComboInput.IsValid())
|
if (ComboInput->MatchesInputActions(this->MostRecentActions))
|
||||||
{
|
{
|
||||||
if (ComboInput->MatchesInputActions(this->MostRecentActions))
|
this->ActivateComboInput(ComboInput.Get());
|
||||||
{
|
|
||||||
this->ActivateComboInput(ComboInput.Get());
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UE_LOG(LogInputBufferComponent, Verbose, TEXT("Invalid combo action found in Combo Actions list in %s"), *Settings->GetClass()->GetName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const UInputBufferGlobalSettings *Settings = GetDefault<UInputBufferGlobalSettings>();
|
||||||
this->GetWorld()->GetTimerManager().SetTimer(this->MultiPressTimerHandle, this, &UInputBufferComponent::ClearMultiPresses, Settings->MultiPressTimerLength);
|
this->GetWorld()->GetTimerManager().SetTimer(this->MultiPressTimerHandle, this, &UInputBufferComponent::ClearMultiPresses, Settings->MultiPressTimerLength);
|
||||||
}
|
}
|
||||||
void UInputBufferComponent::ClearMultiPresses()
|
void UInputBufferComponent::ClearMultiPresses()
|
||||||
@ -104,10 +98,10 @@ void UInputBufferComponent::ActivateComboInput(const UComboInputAsset *ComboInpu
|
|||||||
this->InputBufferActive = ComboInput;
|
this->InputBufferActive = ComboInput;
|
||||||
this->InputBufferHold = nullptr;
|
this->InputBufferHold = nullptr;
|
||||||
|
|
||||||
const UInputBufferSubsystemGlobalSettings *Settings = GetDefault<UInputBufferSubsystemGlobalSettings>();
|
const UInputBufferGlobalSettings *Settings = GetDefault<UInputBufferGlobalSettings>();
|
||||||
for (const TSoftObjectPtr<const UComboInputAsset> &LockedAsset : Settings->ComboActions)
|
for (const TObjectPtr<const UComboInputAsset> &LockedAsset : this->ComboInputList)
|
||||||
{
|
{
|
||||||
this->LockComboInput(LockedAsset.Get());
|
this->LockComboInput(LockedAsset);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->OnNewComboInput.Execute(ComboInput, EComboActionTriggerEvent::Activated);
|
this->OnNewComboInput.Execute(ComboInput, EComboActionTriggerEvent::Activated);
|
||||||
@ -183,7 +177,7 @@ void UInputBufferComponent::ExpireAction(const FInputActionValue &Value, const c
|
|||||||
|
|
||||||
// Prepare to expire any buffered combo inputs
|
// Prepare to expire any buffered combo inputs
|
||||||
this->ExpiringActions.Add(Action);
|
this->ExpiringActions.Add(Action);
|
||||||
const UInputBufferSubsystemGlobalSettings *Settings = GetDefault<UInputBufferSubsystemGlobalSettings>();
|
const UInputBufferGlobalSettings *Settings = GetDefault<UInputBufferGlobalSettings>();
|
||||||
this->GetWorld()->GetTimerManager().SetTimer(this->InputReleaseExpirationTimerHandle, this, &UInputBufferComponent::ExpireBufferedActions, Settings->InputReleaseExpirationTimerLength);
|
this->GetWorld()->GetTimerManager().SetTimer(this->InputReleaseExpirationTimerHandle, this, &UInputBufferComponent::ExpireBufferedActions, Settings->InputReleaseExpirationTimerLength);
|
||||||
}
|
}
|
||||||
void UInputBufferComponent::ExpireBufferedActions()
|
void UInputBufferComponent::ExpireBufferedActions()
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.
|
// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.
|
||||||
|
|
||||||
#include "GlobalSettings/InputBufferSubsystemGlobalSettings.h"
|
#include "GlobalSettings/InputBufferGlobalSettings.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -49,6 +49,9 @@ private:
|
|||||||
// Set of currently locked actions; will not be activated until an unlock signal is received.
|
// Set of currently locked actions; will not be activated until an unlock signal is received.
|
||||||
TSet<TObjectPtr<const class UComboInputAsset>> LockedComboInputs;
|
TSet<TObjectPtr<const class UComboInputAsset>> LockedComboInputs;
|
||||||
|
|
||||||
|
// A local backup of the global setting containing the list of combo inputs to respond to.
|
||||||
|
TSet<TObjectPtr<const UComboInputAsset>> ComboInputList;
|
||||||
|
|
||||||
TSet<const class UInputAction*> MostRecentActions;
|
TSet<const class UInputAction*> MostRecentActions;
|
||||||
TSet<const class UInputAction*> ExpiringActions;
|
TSet<const class UInputAction*> ExpiringActions;
|
||||||
|
|
||||||
|
|||||||
@ -4,14 +4,14 @@
|
|||||||
|
|
||||||
#include "Engine/DeveloperSettingsBackedByCVars.h"
|
#include "Engine/DeveloperSettingsBackedByCVars.h"
|
||||||
|
|
||||||
#include "InputBufferSubsystemGlobalSettings.generated.h"
|
#include "InputBufferGlobalSettings.generated.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Global settings for the input buffer subsystem
|
* Global settings for the input buffer
|
||||||
*/
|
*/
|
||||||
UCLASS(Config=Game, defaultconfig, meta=(DisplayName="Input Buffer Subsystem"))
|
UCLASS(Config=Game, defaultconfig, meta=(DisplayName="Input Buffer"))
|
||||||
class COMBOINPUT_API UInputBufferSubsystemGlobalSettings : public UDeveloperSettingsBackedByCVars
|
class COMBOINPUT_API UInputBufferGlobalSettings : public UDeveloperSettingsBackedByCVars
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ public:
|
|||||||
// either if an action is made while the current combo is inactive, or when the previous
|
// either if an action is made while the current combo is inactive, or when the previous
|
||||||
// action expires.
|
// action expires.
|
||||||
UPROPERTY(Config, BlueprintReadOnly, EditDefaultsOnly)
|
UPROPERTY(Config, BlueprintReadOnly, EditDefaultsOnly)
|
||||||
TSet<TSoftObjectPtr<const class UComboInputAsset>> ComboActions;
|
TSet<TSoftObjectPtr<const class UComboInputAsset>> ComboInputs;
|
||||||
|
|
||||||
// Length of time after releasing an input to keep the associated combo action buffered before clearing it.
|
// Length of time after releasing an input to keep the associated combo action buffered before clearing it.
|
||||||
UPROPERTY(Config, BlueprintReadOnly, EditDefaultsOnly, meta=(UIMin="0.0", UIMax="0.5", ClampMin="0.0", ClampMax="0.5"))
|
UPROPERTY(Config, BlueprintReadOnly, EditDefaultsOnly, meta=(UIMin="0.0", UIMax="0.5", ClampMin="0.0", ClampMax="0.5"))
|
||||||
Loading…
x
Reference in New Issue
Block a user