예제 #1
0
        public FInputTouchBindingHandle BindTouch(EInputEventType keyEvent, FInputTouchHandler handler)
        {
            IntPtr  functionAddress;
            UObject obj;

            if (NativeReflection.LookupTable.GetFunctionAddress(handler, out functionAddress, out obj))
            {
                return((FInputTouchBindingHandle)Native_UInputComponent.BindTouch(
                           Address, (byte)keyEvent, obj.Address, functionAddress));
            }
            return(default(FInputTouchBindingHandle));
        }
예제 #2
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));
            }
            return(default(FInputActionBindingHandle));
        }
예제 #3
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));
            }
            return(default(FInputKeyBindingHandle));
        }
예제 #4
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));
            }
            else
            {
                LogFunctionNotFound("BindKey", keyEvent.ToString(), handler);
            }
            return(default(FInputKeyBindingHandle));
        }
예제 #5
0
 /**
  * Adds a callback to an event type
  */
 public static void AddInputEventCallback(EInputEventType type, InputEventDelegate callback)
 {
     GetInstance().inputEventCallbacks.Add(type, callback);
 }
예제 #6
0
 /**
  * Triggers all events of a given type
  */
 private void TriggerEvents(EInputEventType type)
 {
     foreach(KeyValuePair<EInputEventType, InputEventDelegate> kvp in GetInstance().inputEventCallbacks)
     {
         if(kvp.Key == type)
         {
             kvp.Value();
         }
     }
 }