Пример #1
0
    public KInputHandler(IInputHandler obj)
    {
        name = obj.handlerName;
        MethodInfo method = obj.GetType().GetMethod("OnKeyDown");

        if (method != null)
        {
            Action <KButtonEvent> item = (Action <KButtonEvent>)Delegate.CreateDelegate(typeof(Action <KButtonEvent>), obj, method);
            mOnKeyDownDelegates.Add(item);
        }
        MethodInfo method2 = obj.GetType().GetMethod("OnKeyUp");

        if (method2 != null)
        {
            Action <KButtonEvent> item2 = (Action <KButtonEvent>)Delegate.CreateDelegate(typeof(Action <KButtonEvent>), obj, method2);
            mOnKeyUpDelegates.Add(item2);
        }
    }