Added gameplay settings refresh on change + fixed escape losing focus
Signed-off-by: TjgL <lithmoneo@gmail.com>
This commit is contained in:
parent
1a8a9c4fba
commit
a40c768563
BIN
Content/Legumix/Player/BP_Play.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Player/BP_Play.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Player/HUD/WP_PauseMenu.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Player/HUD/WP_PauseMenu.uasset
(Stored with Git LFS)
Binary file not shown.
@ -7,3 +7,10 @@ ULMUserSettings* ULMUserSettings::GetLegumixUserSettings()
|
||||
{
|
||||
return Cast<ULMUserSettings>(UGameUserSettings::GetGameUserSettings());
|
||||
}
|
||||
|
||||
void ULMUserSettings::ApplySettings(const bool bCheckForCommandLineOverrides)
|
||||
{
|
||||
Super::ApplySettings(bCheckForCommandLineOverrides);
|
||||
OnSettingsChanged.Broadcast();
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,9 @@ void ALMPlayerController::BeginPlay()
|
||||
LegumixPlayer = Cast<ALMPlayer>(GetPawn());
|
||||
|
||||
LegumixPlayer->OnRequestedUnpause.AddUniqueDynamic(this, &ALMPlayerController::TogglePause);
|
||||
ULMUserSettings::GetLegumixUserSettings()->OnSettingsChanged.AddUniqueDynamic(this, &ALMPlayerController::OnSettingsChanged);
|
||||
|
||||
OnSettingsChanged();
|
||||
}
|
||||
|
||||
void ALMPlayerController::SetupInputComponent()
|
||||
@ -50,8 +53,6 @@ void ALMPlayerController::Jump(const FInputActionValue& InputValue)
|
||||
void ALMPlayerController::Look(const FInputActionValue& InputValue)
|
||||
{
|
||||
const FVector2d VectorDirection = InputValue.Get<FVector2d>();
|
||||
|
||||
const float Sensitivity = ULMUserSettings::GetLegumixUserSettings()->MouseSensitivity;
|
||||
|
||||
AddYawInput(VectorDirection.X * Sensitivity);
|
||||
AddPitchInput(VectorDirection.Y * Sensitivity);
|
||||
@ -92,3 +93,10 @@ void ALMPlayerController::TogglePause()
|
||||
SetInputMode(InputMode);
|
||||
}
|
||||
}
|
||||
|
||||
void ALMPlayerController::OnSettingsChanged()
|
||||
{
|
||||
Sensitivity = ULMUserSettings::GetLegumixUserSettings()->MouseSensitivity;
|
||||
int const CameraFov = ULMUserSettings::GetLegumixUserSettings()->FieldOfView;
|
||||
LegumixPlayer->GetCamera()->SetFieldOfView(CameraFov);
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "GameFramework/GameUserSettings.h"
|
||||
#include "LMUserSettings.generated.h"
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSettingsChangedSignature, FLMSettings, setting);
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnSettingsChangedSignature);
|
||||
|
||||
/**
|
||||
*
|
||||
@ -21,6 +21,8 @@ public:
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Legumix", meta = (Keywords = "Game User Settings, Settings, User Settings"))
|
||||
static ULMUserSettings* GetLegumixUserSettings();
|
||||
|
||||
virtual void ApplySettings(bool bCheckForCommandLineOverrides) override;
|
||||
|
||||
UPROPERTY(BlueprintCallable, BlueprintAssignable, category = "Legumix")
|
||||
FOnSettingsChangedSignature OnSettingsChanged;
|
||||
|
||||
|
@ -60,7 +60,13 @@ private:
|
||||
void Scroll(const FInputActionValue& InputValue);
|
||||
void PauseInput(const FInputActionValue& InputValue);
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true, UIMin=0.01, ClampMin=0.01, UIMax=10.0, ClampMax=10.0))
|
||||
float Sensitivity = 1.0f;
|
||||
|
||||
private:
|
||||
UFUNCTION(BlueprintCallable, Category = Legumix)
|
||||
void TogglePause();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = Legumix)
|
||||
void OnSettingsChanged();
|
||||
};
|
||||
|
Reference in New Issue
Block a user