Beispiel #1
0
        public void RegisterEventPersistentListener(int index, UnityEngine.Object targetObj, string methodName)
        {
            TestityPersistentCall listener = this.GetListener(index);

            listener.RegisterPersistentListener(targetObj, methodName);
            listener.mode = TestityPersistentListenerMode.EventDefined;
        }
Beispiel #2
0
        public void RegisterIntPersistentListener(int index, UnityEngine.Object targetObj, int argument, string methodName)
        {
            TestityPersistentCall listener = this.GetListener(index);

            listener.RegisterPersistentListener(targetObj, methodName);
            listener.mode = TestityPersistentListenerMode.Int;
            listener.arguments.intArgument = argument;
        }
Beispiel #3
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);
        }
Beispiel #4
0
        /// <summary>
        ///   <para>Modify the execution state of a persistent listener.</para>
        /// </summary>
        /// <param name="index">Index of the listener to query.</param>
        /// <param name="state">State to set.</param>
        public void SetPersistentListenerState(int index, TestityEventCallState state)
        {
            TestityPersistentCall listener = this.m_PersistentCalls.GetListener(index);

            if (listener != null)
            {
                listener.callState = state;
            }
            this.DirtyPersistentCalls();
        }
Beispiel #5
0
        public MethodInfo FindMethod(TestityPersistentCall call)
        {
            Type type = typeof(UnityEngine.Object);

            if (!string.IsNullOrEmpty(call.arguments.unityObjectArgumentAssemblyTypeName))
            {
                type = Type.GetType(call.arguments.unityObjectArgumentAssemblyTypeName, false) ?? typeof(UnityEngine.Object);
            }
            return(this.FindMethod(call.methodName, call.target, call.mode, type));
        }
Beispiel #6
0
        /// <summary>
        ///   <para>Get the target component of the listener at index index.</para>
        /// </summary>
        /// <param name="index">Index of the listener to query.</param>
        public UnityEngine.Object GetPersistentTarget(int index)
        {
            UnityEngine.Object    obj;
            TestityPersistentCall listener = this.m_PersistentCalls.GetListener(index);

            if (listener == null)
            {
                obj = null;
            }
            else
            {
                obj = listener.target;
            }
            return(obj);
        }
Beispiel #7
0
 public void AddListener(TestityPersistentCall call)
 {
     this.m_Calls.Add(call);
 }
Beispiel #8
0
        /// <summary>
        ///   <para>Get the target method name of the listener at index index.</para>
        /// </summary>
        /// <param name="index">Index of the listener to query.</param>
        public string GetPersistentMethodName(int index)
        {
            TestityPersistentCall listener = this.m_PersistentCalls.GetListener(index);

            return(listener == null ? string.Empty : listener.methodName);
        }
		public void AddListener(TestityPersistentCall call)
		{
			this.m_Calls.Add(call);
		}