Beispiel #1
0
        /// <summary>
        /// Binds a key event to a delegate function.
        /// Returned reference is only guaranteed to be valid until another input key is bound.
        /// </summary>
        public FInputKeyBindingHandle BindKey(FKey key, EInputEventType keyEvent, FInputActionHandler handler)
        {
            IntPtr  functionAddress;
            UObject obj;

            if (NativeReflection.LookupTable.GetFunctionAddress(handler, out functionAddress, out obj))
            {
                return((FInputKeyBindingHandle)Native_UInputComponent.BindKey(
                           Address, ref key, (byte)keyEvent, obj.Address, functionAddress));
            }
            return(default(FInputKeyBindingHandle));
        }
Beispiel #2
0
        /// <summary>
        /// Binds a chord event to a delegate function.
        /// Returned reference is only guaranteed to be valid until another input key is bound.
        /// </summary>
        public FInputKeyBindingHandle BindKey(FInputChord inputChord, EInputEventType keyEvent, FInputActionHandler handler)
        {
            IntPtr  functionAddress;
            UObject obj;

            if (NativeReflection.LookupTable.GetFunctionAddress(handler, out functionAddress, out obj))
            {
                return((FInputKeyBindingHandle)Native_UInputComponent.BindKeyChord(
                           Address,
                           ref inputChord.Key, inputChord.Shift, inputChord.Ctrl, inputChord.Alt, inputChord.Cmd,
                           (byte)keyEvent, obj.Address, functionAddress));
            }
            else
            {
                LogFunctionNotFound("BindKey", keyEvent.ToString(), handler);
            }
            return(default(FInputKeyBindingHandle));
        }
Beispiel #3
0
        /// <summary>
        /// Binds a delegate function to an Action defined in the project settings.
        /// Returned reference is only guaranteed to be valid until another action is bound.
        /// </summary>
        public FInputActionBindingHandle BindAction(string actionName, EInputEventType keyEvent, FInputActionHandler handler)
        {
            IntPtr  functionAddress;
            UObject obj;

            if (NativeReflection.LookupTable.GetFunctionAddress(handler, out functionAddress, out obj))
            {
                FName actionFName = (FName)actionName;
                return((FInputActionBindingHandle)Native_UInputComponent.BindAction(
                           Address, ref actionFName, (byte)keyEvent, obj.Address, functionAddress));
            }
            else
            {
                LogFunctionNotFound("BindAction", actionName, handler);
            }
            return(default(FInputActionBindingHandle));
        }