fix: inputs
This commit is contained in:
BIN
Content/Blueprints/BP_MainPlayerController.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/BP_MainPlayerController.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Input/IMC_UI.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Input/IMC_UI.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Content/UI/WBP_SkillNode.uasset
(Stored with Git LFS)
BIN
Content/UI/WBP_SkillNode.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/UI/WBP_SkillTree.uasset
(Stored with Git LFS)
BIN
Content/UI/WBP_SkillTree.uasset
(Stored with Git LFS)
Binary file not shown.
@@ -195,12 +195,29 @@ void AUTAD_UIPlayerController::ShowSkillTree()
|
|||||||
{
|
{
|
||||||
SkillTreeWidget->AddToViewport(1);
|
SkillTreeWidget->AddToViewport(1);
|
||||||
|
|
||||||
// Set input mode to Game and UI
|
// Switch to UI-only input mode to block gameplay actions (like click-to-move)
|
||||||
FInputModeGameAndUI InputMode;
|
FInputModeUIOnly InputMode;
|
||||||
InputMode.SetWidgetToFocus(SkillTreeWidget->TakeWidget());
|
InputMode.SetWidgetToFocus(SkillTreeWidget->TakeWidget());
|
||||||
InputMode.SetLockMouseToViewportBehavior(EMouseLockMode::DoNotLock);
|
InputMode.SetLockMouseToViewportBehavior(EMouseLockMode::DoNotLock);
|
||||||
SetInputMode(InputMode);
|
SetInputMode(InputMode);
|
||||||
bShowMouseCursor = true;
|
bShowMouseCursor = true;
|
||||||
|
|
||||||
|
// Switch input mapping context from gameplay to UI
|
||||||
|
if (UEnhancedInputLocalPlayerSubsystem* Subsystem =
|
||||||
|
ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(
|
||||||
|
GetLocalPlayer()))
|
||||||
|
{
|
||||||
|
// Remove gameplay context
|
||||||
|
if (DefaultMappingContext)
|
||||||
|
{
|
||||||
|
Subsystem->RemoveMappingContext(DefaultMappingContext);
|
||||||
|
}
|
||||||
|
// Add UI context with higher priority
|
||||||
|
if (UIMappingContext)
|
||||||
|
{
|
||||||
|
Subsystem->AddMappingContext(UIMappingContext, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,14 +227,29 @@ void AUTAD_UIPlayerController::HideSkillTree()
|
|||||||
{
|
{
|
||||||
SkillTreeWidget->RemoveFromParent();
|
SkillTreeWidget->RemoveFromParent();
|
||||||
|
|
||||||
// Set input mode back to game and UI for top-down gameplay
|
// Restore game and UI input mode for top-down gameplay
|
||||||
// This allows mouse clicks to work for character movement
|
|
||||||
FInputModeGameAndUI InputMode;
|
FInputModeGameAndUI InputMode;
|
||||||
InputMode.SetLockMouseToViewportBehavior(EMouseLockMode::DoNotLock);
|
InputMode.SetLockMouseToViewportBehavior(EMouseLockMode::DoNotLock);
|
||||||
InputMode.SetHideCursorDuringCapture(false);
|
InputMode.SetHideCursorDuringCapture(false);
|
||||||
SetInputMode(InputMode);
|
SetInputMode(InputMode);
|
||||||
// Keep mouse cursor visible for top-down game
|
|
||||||
bShowMouseCursor = true;
|
bShowMouseCursor = true;
|
||||||
|
|
||||||
|
// Switch input mapping context back from UI to gameplay
|
||||||
|
if (UEnhancedInputLocalPlayerSubsystem* Subsystem =
|
||||||
|
ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(
|
||||||
|
GetLocalPlayer()))
|
||||||
|
{
|
||||||
|
// Remove UI context
|
||||||
|
if (UIMappingContext)
|
||||||
|
{
|
||||||
|
Subsystem->RemoveMappingContext(UIMappingContext);
|
||||||
|
}
|
||||||
|
// Restore gameplay context
|
||||||
|
if (DefaultMappingContext)
|
||||||
|
{
|
||||||
|
Subsystem->AddMappingContext(DefaultMappingContext, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,11 +43,16 @@ public:
|
|||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input)
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input)
|
||||||
UNiagaraSystem* FXCursor;
|
UNiagaraSystem* FXCursor;
|
||||||
|
|
||||||
/** MappingContext */
|
/** Gameplay Mapping Context (for movement and game actions) */
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input,
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input,
|
||||||
meta = (AllowPrivateAccess = "true"))
|
meta = (AllowPrivateAccess = "true"))
|
||||||
UInputMappingContext* DefaultMappingContext;
|
UInputMappingContext* DefaultMappingContext;
|
||||||
|
|
||||||
|
/** UI Mapping Context (for UI-specific actions like closing menus) */
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input,
|
||||||
|
meta = (AllowPrivateAccess = "true"))
|
||||||
|
UInputMappingContext* UIMappingContext;
|
||||||
|
|
||||||
/** Jump Input Action */
|
/** Jump Input Action */
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input,
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input,
|
||||||
meta = (AllowPrivateAccess = "true"))
|
meta = (AllowPrivateAccess = "true"))
|
||||||
|
|||||||
Reference in New Issue
Block a user