Ejemplo n.º 1
0
        public TestityBaseInvokableCall GetRuntimeCall(TestityEventBase theEvent)
        {
            if (this.m_CallState == TestityEventCallState.RuntimeOnly && !Application.isPlaying)
            {
                return(null);
            }
            if (this.m_CallState == TestityEventCallState.Off || theEvent == null)
            {
                return(null);
            }

            MethodInfo methodInfo = theEvent.FindMethod(this);

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

            case TestityPersistentListenerMode.Void:
            {
                return(new TestityInvokableCall(this.target, methodInfo));
            }

            case TestityPersistentListenerMode.Object:
            {
                return(TestityPersistentCall.GetObjectCall(this.target, methodInfo, this.m_Arguments));
            }

            case TestityPersistentListenerMode.Int:
            {
                return(new TestityCachedInvokableCall <int>(this.target, methodInfo, this.m_Arguments.intArgument));
            }

            case TestityPersistentListenerMode.Float:
            {
                return(new TestityCachedInvokableCall <float>(this.target, methodInfo, this.m_Arguments.floatArgument));
            }

            case TestityPersistentListenerMode.String:
            {
                return(new TestityCachedInvokableCall <string>(this.target, methodInfo, this.m_Arguments.stringArgument));
            }

            case TestityPersistentListenerMode.Bool:
            {
                return(new TestityCachedInvokableCall <bool>(this.target, methodInfo, this.m_Arguments.boolArgument));
            }
            }
            return(null);
        }
Ejemplo n.º 2
0
 public void Initialize(TestityInvokableCallList invokableList, TestityEventBase unityEventBase)
 {
     foreach (TestityPersistentCall mCall in this.m_Calls)
     {
         if (mCall.IsValid())
         {
             TestityBaseInvokableCall runtimeCall = mCall.GetRuntimeCall(unityEventBase);
             if (runtimeCall == null)
             {
                 continue;
             }
             invokableList.AddPersistentInvokableCall(runtimeCall);
         }
     }
 }
Ejemplo n.º 3
0
        public MethodInfo FindMethod(string name, object listener, TestityPersistentListenerMode mode, Type argumentType)
        {
            switch (mode)
            {
            case TestityPersistentListenerMode.EventDefined:
            {
                return(this.FindMethod_Impl(name, listener));
            }

            case TestityPersistentListenerMode.Void:
            {
                return(TestityEventBase.GetValidMethodInfo(listener, name, new Type[0]));
            }

            case TestityPersistentListenerMode.Object:
            {
                return(TestityEventBase.GetValidMethodInfo(listener, name, new Type[] { argumentType ?? typeof(UnityEngine.Object) }));
            }

            case TestityPersistentListenerMode.Int:
            {
                return(TestityEventBase.GetValidMethodInfo(listener, name, new Type[] { typeof(int) }));
            }

            case TestityPersistentListenerMode.Float:
            {
                return(TestityEventBase.GetValidMethodInfo(listener, name, new Type[] { typeof(float) }));
            }

            case TestityPersistentListenerMode.String:
            {
                return(TestityEventBase.GetValidMethodInfo(listener, name, new Type[] { typeof(string) }));
            }

            case TestityPersistentListenerMode.Bool:
            {
                return(TestityEventBase.GetValidMethodInfo(listener, name, new Type[] { typeof(bool) }));
            }
            }
            return(null);
        }
 protected override MethodInfo FindMethod_Impl(string name, object targetObj)
 {
     return(TestityEventBase.GetValidMethodInfo(targetObj, name, new Type[0]));
 }