Esempio n. 1
0
void SFlareKeyBind::SetKey(FKey NewKey, bool bCanReset, bool bNotify)
{
	if (Key.IsValid())
	{
		FKey CurrentKey = *Key;
		if (NewKey == *Key && bCanReset)
		{
			NewKey = FKey();
		}

		*Key = NewKey;
		KeyText->SetText(NewKey == FKey() ? FString() : NewKey.ToString());
		bWaitingForKey = false;

		FSlateApplication::Get().GetPlatformApplication().Get()->Cursor->Show(true);
		FSlateApplication::Get().ClearKeyboardFocus(EKeyboardFocusCause::SetDirectly);

		if (bNotify)
		{
			OnKeyBindingChanged.ExecuteIfBound( CurrentKey , NewKey );
		}
	}
}
Esempio n. 2
0
FVector UInputComponent::GetVectorAxisValue( const FKey AxisKey ) const
{
	FVector AxisValue;
	bool bFound = false;

	for (const FInputVectorAxisBinding& AxisBinding : VectorAxisBindings)
	{
		if (AxisBinding.AxisKey == AxisKey)
		{
			AxisValue = AxisBinding.AxisValue;
			bFound = true;
			break;
		}
	}

	if (!bFound)
	{
		UE_LOG(LogPlayerController, Warning, TEXT("Request for value of vector axis key '%s' returning 0 as it is not bound on this input component."), *AxisKey.ToString());
	}

	return AxisValue;
}