Esempio n. 1
0
        public void SubscribeToEvent(StringHash e, Object sender, Action <StringHash, VariantMap> eventHandler)
        {
            var eventCallback = new EventCallbackDelegate((eventHash, argMap) =>
            {
                eventHandler(new StringHash(eventHash), VariantMap.wrap(argMap, false));
            });
            var handle   = GCHandle.ToIntPtr(GCHandle.Alloc(eventCallback));
            var callback = Marshal.GetFunctionPointerForDelegate(eventCallback);

            Urho3D_Object_SubscribeToEvent(swigCPtr, getCPtr(sender), e.Hash, callback, handle);
        }
Esempio n. 2
0
        private static void EventHandlerCallback(IntPtr actionHandle, uint eventHash, IntPtr argMap)
        {
            var eventHandler = (Action <StringHash, VariantMap>)GCHandle.FromIntPtr(actionHandle).Target;

            eventHandler(new StringHash(eventHash), VariantMap.wrap(argMap, false));
        }