Esempio n. 1
0
        public void StartListening(GraphStack stack)
        {
            var data = stack.GetElementData <Data>(this);

            if (data.isListening)
            {
                return;
            }

            var reference = stack.ToReference();
            var hook      = new EventHook(EventHooks.Update, stack.machine);
            Action <EmptyEventArgs> update = args => TriggerUpdate(reference);

            EventBus.Register(hook, update);
            data.update      = update;
            data.isListening = true;
        }
Esempio n. 2
0
        public virtual void StartListening(GraphStack stack)
        {
            var data = stack.GetElementData <Data>(this);

            if (data.isListening)
            {
                return;
            }

            if (register)
            {
                var            reference = stack.ToReference();
                var            hook      = GetHook(reference);
                Action <TArgs> handler   = args => Trigger(reference, args);
                EventBus.Register(hook, handler);

                data.hook    = hook;
                data.handler = handler;
            }

            data.isListening = true;
        }