fix: input mapping
This commit is contained in:
		
							
								
								
									
										
											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.
										
									
								
							| @@ -490,6 +490,7 @@ void USkillTreeComponent::UpdateSkillStates() | |||||||
| { | { | ||||||
| 	for (auto& Pair : AllSkills) | 	for (auto& Pair : AllSkills) | ||||||
| 	{ | 	{ | ||||||
|  | 		const FName& SkillID = Pair.Key; | ||||||
| 		FSkillNodeRuntime& SkillNode = Pair.Value; | 		FSkillNodeRuntime& SkillNode = Pair.Value; | ||||||
|  |  | ||||||
| 		// Only update Locked and Available states based on prerequisites | 		// Only update Locked and Available states based on prerequisites | ||||||
| @@ -503,14 +504,18 @@ void USkillTreeComponent::UpdateSkillStates() | |||||||
|  |  | ||||||
| 		case ESkillNodeState::Locked: | 		case ESkillNodeState::Locked: | ||||||
| 		case ESkillNodeState::Available: | 		case ESkillNodeState::Available: | ||||||
| 			// Update state based on prerequisites |  | ||||||
| 			if (ArePrerequisitesMet(SkillNode.NodeData)) |  | ||||||
| 			{ | 			{ | ||||||
| 				SkillNode.CurrentState = ESkillNodeState::Available; | 				// Calculate new state based on prerequisites | ||||||
|  | 				ESkillNodeState NewState = ArePrerequisitesMet(SkillNode.NodeData) | ||||||
|  | 					? ESkillNodeState::Available | ||||||
|  | 					: ESkillNodeState::Locked; | ||||||
|  |  | ||||||
|  | 				// Only broadcast if state actually changed | ||||||
|  | 				if (SkillNode.CurrentState != NewState) | ||||||
|  | 				{ | ||||||
|  | 					SkillNode.CurrentState = NewState; | ||||||
|  | 					OnSkillStateChanged.Broadcast(SkillID); | ||||||
| 				} | 				} | ||||||
| 			else |  | ||||||
| 			{ |  | ||||||
| 				SkillNode.CurrentState = ESkillNodeState::Locked; |  | ||||||
| 			} | 			} | ||||||
| 			break; | 			break; | ||||||
| 		} | 		} | ||||||
|   | |||||||
| @@ -196,19 +196,21 @@ void AUTAD_UIPlayerController::ShowSkillTree() | |||||||
| 	{ | 	{ | ||||||
| 		SkillTreeWidget->AddToViewport(1); | 		SkillTreeWidget->AddToViewport(1); | ||||||
|  |  | ||||||
| 		// Switch to UI-only input mode to block gameplay actions (like click-to-move) | 		// Use GameAndUI mode - allows Enhanced Input to work while UI is open | ||||||
| 		FInputModeUIOnly InputMode; | 		// Mouse clicks will be consumed by UI widgets automatically | ||||||
| 		InputMode.SetWidgetToFocus(SkillTreeWidget->TakeWidget()); | 		FInputModeGameAndUI InputMode; | ||||||
| 		InputMode.SetLockMouseToViewportBehavior(EMouseLockMode::DoNotLock); | 		InputMode.SetLockMouseToViewportBehavior(EMouseLockMode::DoNotLock); | ||||||
|  | 		InputMode.SetHideCursorDuringCapture(false); | ||||||
| 		SetInputMode(InputMode); | 		SetInputMode(InputMode); | ||||||
| 		bShowMouseCursor = true; | 		bShowMouseCursor = true; | ||||||
|  |  | ||||||
| 		// Switch input mapping context from gameplay to UI | 		// Switch input mapping context from gameplay to UI | ||||||
|  | 		// This allows UI-specific controls (like Tab to close) to work | ||||||
| 		if (UEnhancedInputLocalPlayerSubsystem* Subsystem = | 		if (UEnhancedInputLocalPlayerSubsystem* Subsystem = | ||||||
| 				ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>( | 				ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>( | ||||||
| 					GetLocalPlayer())) | 					GetLocalPlayer())) | ||||||
| 		{ | 		{ | ||||||
| 			// Remove gameplay context | 			// Remove gameplay context to prevent movement actions | ||||||
| 			if (DefaultMappingContext) | 			if (DefaultMappingContext) | ||||||
| 			{ | 			{ | ||||||
| 				Subsystem->RemoveMappingContext(DefaultMappingContext); | 				Subsystem->RemoveMappingContext(DefaultMappingContext); | ||||||
| @@ -227,9 +229,11 @@ void AUTAD_UIPlayerController::HideSkillTree() | |||||||
| 	if (SkillTreeWidget && SkillTreeWidget->IsInViewport()) | 	if (SkillTreeWidget && SkillTreeWidget->IsInViewport()) | ||||||
| 	{ | 	{ | ||||||
| 		// Clear any unconfirmed skill selections | 		// Clear any unconfirmed skill selections | ||||||
| 		if (AUTAD_UICharacter* Character = Cast<AUTAD_UICharacter>(GetPawn())) | 		if (const AUTAD_UICharacter* PlayerCharacter = | ||||||
|  | 				Cast<AUTAD_UICharacter>(GetPawn())) | ||||||
| 		{ | 		{ | ||||||
| 			if (USkillTreeComponent* SkillTreeComp = Character->GetSkillTreeComponent()) | 			if (USkillTreeComponent* SkillTreeComp = | ||||||
|  | 					PlayerCharacter->GetSkillTreeComponent()) | ||||||
| 			{ | 			{ | ||||||
| 				SkillTreeComp->ClearSelection(); | 				SkillTreeComp->ClearSelection(); | ||||||
| 			} | 			} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user