Esempio n. 1
0
        public BaseInvokableCall GetRuntimeCall(UnityEventBase theEvent)
        {
            BaseInvokableCall result;

            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);
        }
Esempio n. 2
0
        public BaseInvokableCall GetRuntimeCall(UnityEventBase theEvent)
        {
            if (m_CallState == UnityEventCallState.RuntimeOnly && !Application.isPlaying)
            {
                return(null);
            }
            if (m_CallState == UnityEventCallState.Off || theEvent == null)
            {
                return(null);
            }

            var method = theEvent.FindMethod(this);

            if (method == null)
            {
                return(null);
            }

            if (!method.IsStatic && target == null)
            {
                return(null);
            }

            var targetObject = method.IsStatic ? null : target;

            switch (m_Mode)
            {
            case PersistentListenerMode.EventDefined:
                return(theEvent.GetDelegate(targetObject, method));

            case PersistentListenerMode.Object:
                return(GetObjectCall(targetObject, method, m_Arguments));

            case PersistentListenerMode.Float:
                return(new CachedInvokableCall <float>(targetObject, method, m_Arguments.floatArgument));

            case PersistentListenerMode.Int:
                return(new CachedInvokableCall <int>(targetObject, method, m_Arguments.intArgument));

            case PersistentListenerMode.String:
                return(new CachedInvokableCall <string>(targetObject, method, m_Arguments.stringArgument));

            case PersistentListenerMode.Bool:
                return(new CachedInvokableCall <bool>(targetObject, method, m_Arguments.boolArgument));

            case PersistentListenerMode.Void:
                return(new InvokableCall(targetObject, method));
            }
            return(null);
        }
Esempio n. 3
0
        public BaseInvokableCall GetRuntimeCall(UnityEventBase theEvent)
        {
            if (this.m_CallState == UnityEventCallState.RuntimeOnly && !Application.isPlaying)
            {
                return(null);
            }
            if (this.m_CallState == UnityEventCallState.Off || theEvent == null)
            {
                return(null);
            }
            MethodInfo methodInfo = theEvent.FindMethod(this);

            if (methodInfo == null)
            {
                return(null);
            }
            switch (this.m_Mode)
            {
            case PersistentListenerMode.EventDefined:
                return(theEvent.GetDelegate(this.target, methodInfo));

            case PersistentListenerMode.Void:
                return(new InvokableCall(this.target, methodInfo));

            case PersistentListenerMode.Object:
                return(PersistentCall.GetObjectCall(this.target, methodInfo, this.m_Arguments));

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

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

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

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

            default:
                return(null);
            }
        }
Esempio n. 4
0
        public BaseInvokableCall GetRuntimeCall(UnityEventBase theEvent)
        {
            if ((this.m_CallState != UnityEventCallState.RuntimeOnly) || Application.isPlaying)
            {
                if ((this.m_CallState == UnityEventCallState.Off) || (theEvent == null))
                {
                    return(null);
                }
                MethodInfo theFunction = theEvent.FindMethod(this);
                if (theFunction != null)
                {
                    switch (this.m_Mode)
                    {
                    case PersistentListenerMode.EventDefined:
                        return(theEvent.GetDelegate(this.target, theFunction));

                    case PersistentListenerMode.Void:
                        return(new InvokableCall(this.target, theFunction));

                    case PersistentListenerMode.Object:
                        return(GetObjectCall(this.target, theFunction, this.m_Arguments));

                    case PersistentListenerMode.Int:
                        return(new CachedInvokableCall <int>(this.target, theFunction, this.m_Arguments.intArgument));

                    case PersistentListenerMode.Float:
                        return(new CachedInvokableCall <float>(this.target, theFunction, this.m_Arguments.floatArgument));

                    case PersistentListenerMode.String:
                        return(new CachedInvokableCall <string>(this.target, theFunction, this.m_Arguments.stringArgument));

                    case PersistentListenerMode.Bool:
                        return(new CachedInvokableCall <bool>(this.target, theFunction, this.m_Arguments.boolArgument));
                    }
                }
            }
            return(null);
        }
Esempio n. 5
0
        public BaseInvokableCall GetRuntimeCall(UnityEventBase theEvent)
        {
            bool flag = this.m_CallState == UnityEventCallState.RuntimeOnly && !Application.isPlaying;
            BaseInvokableCall result;

            if (flag)
            {
                result = null;
            }
            else
            {
                bool flag2 = this.m_CallState == UnityEventCallState.Off || theEvent == null;
                if (flag2)
                {
                    result = null;
                }
                else
                {
                    MethodInfo methodInfo = theEvent.FindMethod(this);
                    bool       flag3      = methodInfo == null;
                    if (flag3)
                    {
                        result = null;
                    }
                    else
                    {
                        UnityEngine.Object target = methodInfo.IsStatic ? null : this.target;
                        switch (this.m_Mode)
                        {
                        case PersistentListenerMode.EventDefined:
                            result = theEvent.GetDelegate(target, methodInfo);
                            break;

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

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

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

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

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

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

                        default:
                            result = null;
                            break;
                        }
                    }
                }
            }
            return(result);
        }