Inheritance: BaseInvokableCall
コード例 #1
0
        public void Invoke()
        {
            List <BaseInvokableCall> list = base.PrepareInvoke();

            for (int i = 0; i < list.Count; i++)
            {
                InvokableCall invokableCall = list[i] as InvokableCall;
                if (invokableCall != null)
                {
                    invokableCall.Invoke();
                }
                else
                {
                    InvokableCall invokableCall2 = list[i] as InvokableCall;
                    if (invokableCall2 != null)
                    {
                        invokableCall2.Invoke();
                    }
                    else
                    {
                        BaseInvokableCall baseInvokableCall = list[i];
                        if (this.m_InvokeArray == null)
                        {
                            this.m_InvokeArray = new object[0];
                        }
                        baseInvokableCall.Invoke(this.m_InvokeArray);
                    }
                }
            }
        }
コード例 #2
0
        public void Invoke(T0 arg0, T1 arg1, T2 arg2)
        {
            List <BaseInvokableCall> list = base.PrepareInvoke();

            for (int i = 0; i < list.Count; i++)
            {
                InvokableCall <T0, T1, T2> invokableCall = list[i] as InvokableCall <T0, T1, T2>;
                if (invokableCall != null)
                {
                    invokableCall.Invoke(arg0, arg1, arg2);
                }
                else
                {
                    InvokableCall invokableCall2 = list[i] as InvokableCall;
                    if (invokableCall2 != null)
                    {
                        invokableCall2.Invoke();
                    }
                    else
                    {
                        BaseInvokableCall baseInvokableCall = list[i];
                        if (this.m_InvokeArray == null)
                        {
                            this.m_InvokeArray = new object[3];
                        }
                        this.m_InvokeArray[0] = arg0;
                        this.m_InvokeArray[1] = arg1;
                        this.m_InvokeArray[2] = arg2;
                        baseInvokableCall.Invoke(this.m_InvokeArray);
                    }
                }
            }
        }
コード例 #3
0
        public BaseInvokableCall GetRuntimeCall(UnityEventBase theEvent)
        {
            BaseInvokableCall result;

            if (this.m_CallState == UnityEventCallState.RuntimeOnly && !Application.isPlaying)
            {
                result = null;
            }
            else if (this.m_CallState == UnityEventCallState.Off || theEvent == null)
            {
                result = null;
            }
            else
            {
                MethodInfo methodInfo = theEvent.FindMethod(this);
                if (methodInfo == null)
                {
                    result = null;
                }
                else
                {
                    switch (this.m_Mode)
                    {
                    case PersistentListenerMode.EventDefined:
                        result = theEvent.GetDelegate(this.target, methodInfo);
                        break;

                    case PersistentListenerMode.Void:
                        result = new InvokableCall(this.target, methodInfo);
                        break;

                    case PersistentListenerMode.Object:
                        result = PersistentCall.GetObjectCall(this.target, methodInfo, this.m_Arguments);
                        break;

                    case PersistentListenerMode.Int:
                        result = new CachedInvokableCall <int>(this.target, methodInfo, this.m_Arguments.intArgument);
                        break;

                    case PersistentListenerMode.Float:
                        result = new CachedInvokableCall <float>(this.target, methodInfo, this.m_Arguments.floatArgument);
                        break;

                    case PersistentListenerMode.String:
                        result = new CachedInvokableCall <string>(this.target, methodInfo, this.m_Arguments.stringArgument);
                        break;

                    case PersistentListenerMode.Bool:
                        result = new CachedInvokableCall <bool>(this.target, methodInfo, this.m_Arguments.boolArgument);
                        break;

                    default:
                        result = null;
                        break;
                    }
                }
            }
            return(result);
        }
コード例 #4
0
        public InvokableCall(object target, MethodInfo theFunction)
            : base(target, theFunction)
        {
            InvokableCall <T1> invokableCall = this;
            UnityAction <T1>   unityAction   = (UnityAction <T1>)System.Delegate.Combine((System.Delegate)invokableCall.Delegate, theFunction.CreateDelegate(typeof(UnityAction <T1>), target));

            invokableCall.Delegate = unityAction;
        }