First step of new focus management system

This commit is contained in:
2026-04-15 22:55:02 -04:00
parent 2f83910897
commit 8a3d200247
7 changed files with 365 additions and 5 deletions

View File

@@ -3,6 +3,7 @@
#include "CoreMinimal.h"
#include "Engine/HitResult.h"
#include "GameFramework/PlayerController.h"
#include "InputEvents.h"
#include "PlayerControllerBase.generated.h"
UCLASS(BlueprintType, Blueprintable)
@@ -11,6 +12,8 @@ class INTEGRATION_API AlxPlayerControllerBase : public APlayerController
GENERATED_BODY()
public:
using InputMode = FlxEventRequests::InputMode;
UFUNCTION(BlueprintCallable, meta = (WorldContext = "Context"), Category = "Luprex|Look-At Detection")
static void SetLookAt(const UObject *Context, const FHitResult &HitResult);
@@ -26,6 +29,12 @@ public:
UFUNCTION(BlueprintCallable, meta = (WorldContext = "Context"), Category = "Luprex|Look-At Detection")
static void SetLookAtChanged(const UObject *Context);
UFUNCTION(BlueprintCallable, Category = "Luprex|Input Events")
static void RequestEvents(const FlxEventRequest &Request);
UFUNCTION(BlueprintCallable, Category = "Luprex|Input Events")
static void UnRequestEvents(UUserWidget *Widget);
// Blueprint events
UFUNCTION(BlueprintImplementableEvent, Category = "Luprex|Look-At Detection")
void CalculateLookAt();
@@ -33,14 +42,35 @@ public:
UFUNCTION(BlueprintImplementableEvent, Category = "Luprex|Look-At Detection")
void LookAtChanged();
virtual void BeginPlay() override;
// Called by GameMode each tick.
void UpdateLookAt();
// Rebuild input component and switch input mode.
void UpdateEventDispatch();
// Handler for character mode hotkey presses.
void ForwardKeyEvent(FKey Key);
// Walk up from a Slate widget to find the nearest UMG widget class name.
static FString GetUserWidgetName(SWidget *W);
// Get the player controller, cast to AlxPlayerControllerBase.
static AlxPlayerControllerBase *FromContext(const UObject *Context);
UPROPERTY()
FHitResult CurrentLookAt;
UPROPERTY()
FlxEventRequests EventRequests;
// Input component for Character Mode: catches hotkeys only.
UPROPERTY()
UInputComponent *CharacterModeInput = nullptr;
// Current input mode.
InputMode CurrentInputMode = InputMode::GameOnly;
bool MustCallLookAtChanged = false;
};