void UJavascriptWidget::OnListenForInputAction(FName ActionName, TEnumAsByte< EInputEvent > EventType, bool bConsume)
{
	if (!InputComponent)
	{
#if ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION < 12
		if (APlayerController* Controller = GetOwningPlayer())
		{
			InputComponent = NewObject< UInputComponent >(this, NAME_None, RF_Transient);
			InputComponent->bBlockInput = bStopAction;
			InputComponent->Priority = Priority;
			Controller->PushInputComponent(InputComponent);
		}		
#else
		InitializeInputComponent();
#endif
	}

	if (InputComponent)
	{
		FInputActionBinding NewBinding(ActionName, EventType.GetValue());
		NewBinding.bConsumeInput = bConsume;
		NewBinding.ActionDelegate.GetDelegateForManualSet().BindUObject(this, &ThisClass::OnInputActionByName, ActionName);
		InputComponent->AddActionBinding(NewBinding);
	}
}
Пример #2
0
Binding *NewConstDefaultBinding(int gname, int sname, int count, int rname, int regno,
                                float *fval)
{
    Binding *lBind;
    int ii;

    lBind = NewBinding(gname, sname);
    lBind->constdef.kind = BK_CONSTANT;
    lBind->constdef.size = count;
    lBind->constdef.rname = rname;
    lBind->constdef.regno = regno;
    for (ii = 0; ii < count; ii++)
        lBind->constdef.val[ii] = fval[ii];
    return lBind;
} // NewConstDefaultBinding