Beispiel #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 });
            }
        }
    }
Beispiel #2
0
    // Token: 0x06003DE9 RID: 15849 RVA: 0x00138200 File Offset: 0x00136600
    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, out 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
                });
            }
        }
    }
Beispiel #3
0
    protected internal void ExecuteComponentOnSerialize(Component component, PhotonStream stream, PhotonMessageInfo info)
    {
        IPunObservable punObservable = component as IPunObservable;

        if (punObservable != null)
        {
            punObservable.OnPhotonSerializeView(stream, info);
        }
        else
        {
            if (!Object.op_Inequality((Object)component, (Object)null))
            {
                return;
            }
            MethodInfo mi = (MethodInfo)null;
            if (!this.m_OnSerializeMethodInfos.TryGetValue(component, out mi))
            {
                if (!NetworkingPeer.GetMethod(component as MonoBehaviour, PhotonNetworkingMessage.OnPhotonSerializeView.ToString(), out mi))
                {
                    Debug.LogError((object)("The observed monobehaviour (" + ((Object)component).get_name() + ") of this PhotonView does not implement OnPhotonSerializeView()!"));
                    mi = (MethodInfo)null;
                }
                this.m_OnSerializeMethodInfos.Add(component, mi);
            }
            if ((object)mi == null)
            {
                return;
            }
            mi.Invoke((object)component, new object[2]
            {
                (object)stream,
                (object)info
            });
        }
    }
Beispiel #4
0
 protected internal void SerializeComponent(Component component, PhotonStream stream, PhotonMessageInfo info)
 {
     IPunObservable observable = component as IPunObservable;
     if (observable != null)
     {
         observable.OnPhotonSerializeView(stream, info);
     }
     else
     {
         Debug.LogError("Observed scripts have to implement IPunObservable. " + component + " does not. It is Type: " + component.GetType(), component.gameObject);
     }
 }