/// <summary> /// Called by PUN several times per second, so that your script can write and read synchronization data for the PhotonView. /// </summary> /// <param name="stream">The stream that is being written to/read from.</param> /// <param name="info">Contains information about the message.</param> public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.IsWriting) { m_StreamQueue.Serialize(stream); stream.SendNext(Speed); stream.SendNext(Height); stream.SendNext(Moving); stream.SendNext(Aiming); stream.SendNext(MovementSetID); stream.SendNext(AbilityIntData); for (int i = 0; i < ParameterSlotCount; ++i) { stream.SendNext(ItemSlotID[i]); stream.SendNext(ItemSlotStateIndex[i]); stream.SendNext(ItemSlotSubstateIndex[i]); } } else // Reading. { m_StreamQueue.Deserialize(stream); SetSpeedParameter((float)stream.ReceiveNext(), 1); SetHeightParameter((int)stream.ReceiveNext()); SetMovingParameter((bool)stream.ReceiveNext()); SetAimingParameter((bool)stream.ReceiveNext()); SetMovementSetIDParameter((int)stream.ReceiveNext()); SetAbilityIntDataParameter((int)stream.ReceiveNext()); for (int i = 0; i < ParameterSlotCount; ++i) { SetItemIDParameter(i, (int)stream.ReceiveNext()); SetItemStateIndexParameter(i, (int)stream.ReceiveNext()); SetItemSubstateIndexParameter(i, (int)stream.ReceiveNext()); } } }
/// <summary> /// Called by PUN several times per second, so that your script can write and read synchronization data for the PhotonView. /// </summary> /// <param name="stream">The stream that is being written to/read from.</param> /// <param name="info">Contains information about the message.</param> public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.IsWriting) { m_StreamQueue.Serialize(stream); } else { m_StreamQueue.Deserialize(stream); } }
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (m_Animator == null) { return; } if (stream.isWriting == true) { if (m_WasSynchronizeTypeChanged == true) { m_StreamQueue.Reset(); SerializeSynchronizationTypeState(stream); m_WasSynchronizeTypeChanged = false; } m_StreamQueue.Serialize(stream); SerializeDataDiscretly(stream); } else { #if PHOTON_DEVELOP if (ReceivingSender != null) { ReceivingSender.OnPhotonSerializeView(stream, info); } else #endif { if (stream.PeekNext() is byte[]) { DeserializeSynchronizationTypeState(stream); } m_StreamQueue.Deserialize(stream); DeserializeDataDiscretly(stream); } } }