PhotonStream.PeekNext C# (CSharp) Method

PeekNext() public method

Read next piece of data from the stream without advancing the "current" item.
public PeekNext ( ) : object
return object
    public object PeekNext()
    {
        if (this.write)
        {
            Debug.LogError("Error: you cannot read this stream that you are writing!");
            return null;
        }

        object obj = this.data[this.currentItem];
        //this.currentItem++;
        return obj;
    }

Usage Example

Esempio n. 1
0
    private void DeserializeDataDiscretly(PhotonStream stream)
    {
        for (int index = 0; index < this.m_SynchronizeLayers.Count; ++index)
        {
            if (this.m_SynchronizeLayers[index].SynchronizeType == PhotonAnimatorView.SynchronizeType.Discrete)
            {
                this.m_Animator.SetLayerWeight(this.m_SynchronizeLayers[index].LayerIndex, (float)stream.ReceiveNext());
            }
        }
        for (int index = 0; index < this.m_SynchronizeParameters.Count; ++index)
        {
            PhotonAnimatorView.SynchronizedParameter synchronizeParameter = this.m_SynchronizeParameters[index];
            if (synchronizeParameter.SynchronizeType == PhotonAnimatorView.SynchronizeType.Discrete)
            {
                PhotonAnimatorView.ParameterType type = synchronizeParameter.Type;
                switch (type)
                {
                case PhotonAnimatorView.ParameterType.Float:
                    if (!(stream.PeekNext() is float))
                    {
                        return;
                    }
                    this.m_Animator.SetFloat(synchronizeParameter.Name, (float)stream.ReceiveNext());
                    continue;

                case PhotonAnimatorView.ParameterType.Int:
                    if (!(stream.PeekNext() is int))
                    {
                        return;
                    }
                    this.m_Animator.SetInteger(synchronizeParameter.Name, (int)stream.ReceiveNext());
                    continue;

                case PhotonAnimatorView.ParameterType.Bool:
                    if (!(stream.PeekNext() is bool))
                    {
                        return;
                    }
                    this.m_Animator.SetBool(synchronizeParameter.Name, (bool)stream.ReceiveNext());
                    continue;

                default:
                    if (type == PhotonAnimatorView.ParameterType.Trigger)
                    {
                        if (!(stream.PeekNext() is bool))
                        {
                            return;
                        }
                        if ((bool)stream.ReceiveNext())
                        {
                            this.m_Animator.SetTrigger(synchronizeParameter.Name);
                            continue;
                        }
                        continue;
                    }
                    continue;
                }
            }
        }
    }
All Usage Examples Of PhotonStream::PeekNext