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());
|
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 = Cast<ALMPlayer>(GetPawn());
|
||||||
|
|
||||||
LegumixPlayer->OnRequestedUnpause.AddUniqueDynamic(this, &ALMPlayerController::TogglePause);
|
LegumixPlayer->OnRequestedUnpause.AddUniqueDynamic(this, &ALMPlayerController::TogglePause);
|
||||||
|
ULMUserSettings::GetLegumixUserSettings()->OnSettingsChanged.AddUniqueDynamic(this, &ALMPlayerController::OnSettingsChanged);
|
||||||
|
|
||||||
|
OnSettingsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ALMPlayerController::SetupInputComponent()
|
void ALMPlayerController::SetupInputComponent()
|
||||||
@ -51,8 +54,6 @@ void ALMPlayerController::Look(const FInputActionValue& InputValue)
|
|||||||
{
|
{
|
||||||
const FVector2d VectorDirection = InputValue.Get<FVector2d>();
|
const FVector2d VectorDirection = InputValue.Get<FVector2d>();
|
||||||
|
|
||||||
const float Sensitivity = ULMUserSettings::GetLegumixUserSettings()->MouseSensitivity;
|
|
||||||
|
|
||||||
AddYawInput(VectorDirection.X * Sensitivity);
|
AddYawInput(VectorDirection.X * Sensitivity);
|
||||||
AddPitchInput(VectorDirection.Y * Sensitivity);
|
AddPitchInput(VectorDirection.Y * Sensitivity);
|
||||||
}
|
}
|
||||||
@ -92,3 +93,10 @@ void ALMPlayerController::TogglePause()
|
|||||||
SetInputMode(InputMode);
|
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 "GameFramework/GameUserSettings.h"
|
||||||
#include "LMUserSettings.generated.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"))
|
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Legumix", meta = (Keywords = "Game User Settings, Settings, User Settings"))
|
||||||
static ULMUserSettings* GetLegumixUserSettings();
|
static ULMUserSettings* GetLegumixUserSettings();
|
||||||
|
|
||||||
|
virtual void ApplySettings(bool bCheckForCommandLineOverrides) override;
|
||||||
|
|
||||||
UPROPERTY(BlueprintCallable, BlueprintAssignable, category = "Legumix")
|
UPROPERTY(BlueprintCallable, BlueprintAssignable, category = "Legumix")
|
||||||
FOnSettingsChangedSignature OnSettingsChanged;
|
FOnSettingsChangedSignature OnSettingsChanged;
|
||||||
|
|
||||||
|
@ -60,7 +60,13 @@ private:
|
|||||||
void Scroll(const FInputActionValue& InputValue);
|
void Scroll(const FInputActionValue& InputValue);
|
||||||
void PauseInput(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:
|
private:
|
||||||
UFUNCTION(BlueprintCallable, Category = Legumix)
|
UFUNCTION(BlueprintCallable, Category = Legumix)
|
||||||
void TogglePause();
|
void TogglePause();
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, Category = Legumix)
|
||||||
|
void OnSettingsChanged();
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user