GetMethod() protected static method

protected static GetMethod ( MonoBehaviour monob, string methodType, MethodInfo &mi ) : bool
monob MonoBehaviour
methodType string
mi MethodInfo
return bool
Esempio n. 1
0
    protected internal void ExecuteComponentOnSerialize(Component component, PhotonStream stream, PhotonMessageInfo info)
    {
        IPunObservable observable = component as IPunObservable;

        if (observable != null)
        {
            observable.OnPhotonSerializeView(stream, info);
        }
        else if (component != null)
        {
            MethodInfo method = null;
            bool       found  = this.m_OnSerializeMethodInfos.TryGetValue(component, out method);
            if (!found)
            {
                bool foundMethod = NetworkingPeer.GetMethod(component as MonoBehaviour, PhotonNetworkingMessage.OnPhotonSerializeView.ToString(), out method);

                if (foundMethod == false)
                {
                    Debug.LogError("The observed monobehaviour (" + component.name + ") of this PhotonView does not implement OnPhotonSerializeView()!");
                    method = null;
                }

                this.m_OnSerializeMethodInfos.Add(component, method);
            }

            if (method != null)
            {
                method.Invoke(component, new object[] { stream, info });
            }
        }
    }
    protected internal void ExecuteComponentOnSerialize(Component component, PhotonStream stream, PhotonMessageInfo info)
    {
        IPunObservable punObservable = component as IPunObservable;

        if (punObservable != null)
        {
            punObservable.OnPhotonSerializeView(stream, info);
        }
        else if (component != null)
        {
            MethodInfo methodInfo = null;
            if (!this.m_OnSerializeMethodInfos.TryGetValue(component, ref methodInfo))
            {
                if (!NetworkingPeer.GetMethod(component as UnityEngine.MonoBehaviour, PhotonNetworkingMessage.OnPhotonSerializeView.ToString(), out methodInfo))
                {
                    Debug.LogError("The observed monobehaviour (" + component.name + ") of this PhotonView does not implement OnPhotonSerializeView()!");
                    methodInfo = null;
                }
                this.m_OnSerializeMethodInfos.Add(component, methodInfo);
            }
            if (methodInfo != null)
            {
                methodInfo.Invoke(component, new object[]
                {
                    stream,
                    info
                });
            }
        }
    }
Esempio n. 3
0
 protected internal void ExecuteOnSerialize(PhotonStream pStream, PhotonMessageInfo info)
 {
     if (!this.failedToFindOnSerialize)
     {
         if ((this.OnSerializeMethodInfo == null) && !NetworkingPeer.GetMethod(this.observed as UnityEngine.MonoBehaviour, PhotonNetworkingMessage.OnPhotonSerializeView.ToString(), out this.OnSerializeMethodInfo))
         {
             Debug.LogError("The observed monobehaviour (" + this.observed.name + ") of this PhotonView does not implement OnPhotonSerializeView()!");
             this.failedToFindOnSerialize = true;
         }
         else
         {
             object[] parameters = new object[] { pStream, info };
             this.OnSerializeMethodInfo.Invoke(this.observed, parameters);
         }
     }
 }
Esempio n. 4
0
    internal protected void ExecuteOnSerialize(PhotonStream pStream, PhotonMessageInfo info)
    {
        if (failedToFindOnSerialize)
        {
            return;
        }

        if (OnSerializeMethodInfo == null)
        {
            if (!NetworkingPeer.GetMethod(this.observed as MonoBehaviour, PhotonNetworkingMessage.OnPhotonSerializeView.ToString(), out OnSerializeMethodInfo))
            {
//                Debug.LogError("The observed monobehaviour (" + this.observed.name + ") of this PhotonView does not implement OnPhotonSerialize()!");
                failedToFindOnSerialize = true;
                return;
            }
        }

        OnSerializeMethodInfo.Invoke((object)this.observed, new object[] { pStream, info });
    }
Esempio n. 5
0
    internal protected void ExecuteComponentOnSerialize(Component component, PhotonStream stream, PhotonMessageInfo info)
    {
        if (component != null)
        {
            if (m_OnSerializeMethodInfos.ContainsKey(component) == false)
            {
                MethodInfo newMethod   = null;
                bool       foundMethod = NetworkingPeer.GetMethod(component as MonoBehaviour, PhotonNetworkingMessage.OnPhotonSerializeView.ToString(), out newMethod);

                if (foundMethod == false)
                {
                    Debug.LogError("The observed monobehaviour (" + component.name + ") of this PhotonView does not implement OnPhotonSerializeView()!");
                    newMethod = null;
                }

                m_OnSerializeMethodInfos.Add(component, newMethod);
            }

            if (m_OnSerializeMethodInfos[component] != null)
            {
                m_OnSerializeMethodInfos[component].Invoke(component, new object[] { stream, info });
            }
        }
    }