Esempio n. 1
0
        internal static void AddReceiversStatic(Type tp)
        {
            MethodInfo[] methods = tp.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);

            if (methods != null && methods.Length > 0)
            {
                foreach (var method in methods)
                {
                    //var objs = method.GetCustomAttributesData();

                    //foreach (var obj in objs)
                    //{
                    //    //Receiver attr = (Receiver)obj;
                    //    //ReceiverData receiver = new ReceiverData();
                    //    //receiver.call.instance = null;
                    //    //receiver.call.method = method;
                    //    //receiver.type = attr.dataType;
                    //    //DataCenter.AddReceiver(receiver);
                    //}

                    object[] objs = method.GetCustomAttributes(typeof(Receiver), false);

                    if (objs != null && objs.Length > 0)
                    {
                        foreach (var obj in objs)
                        {
                            Receiver     attr     = (Receiver)obj;
                            ReceiverData receiver = new ReceiverData();
                            receiver.call.instance = null;
                            receiver.call.method   = method;
                            receiver.type          = attr.dataType;
                            DataCenter.AddReceiver(receiver);
                        }
                    }
                }
            }
        }
Esempio n. 2
0
 public TriggerObject()
 {
     DataCenter.AddEntityWithInstance(this);
     DataCenter.AddReceiversWithInstance(this);
 }