示例#1
0
        public static BitReaderWriter ReadFrom(BitStream stream)
        {
            Debug.Assert(stream.Reading, "Read stream should be set for reading!");

            // Move current position after the data
            uint dataBitLen = stream.ReadUInt32Variant();
            var reader = new BitReaderWriter(stream, stream.BitPosition);
            stream.SetBitPositionRead(stream.BitPosition + (int)dataBitLen);
            return reader;
        }
示例#2
0
        public static BitReaderWriter ReadFrom(BitStream stream)
        {
            Debug.Assert(stream.Reading, "Read stream should be set for reading!");

            // Move current position after the data
            uint dataBitLen = stream.ReadUInt32Variant();
            var  reader     = new BitReaderWriter(stream, stream.BitPosition);

            stream.SetBitPositionRead(stream.BitPosition + (int)dataBitLen);
            return(reader);
        }
 public void RpcToClient_Implementation(BitReaderWriter reader)
 {
     Sync.Layer.ProcessRpc(reader);
 }
 private static void SendVoicePlayer(ulong user, BitReaderWriter data)
 {
     data.ReadData(Recievebuffer, false);
     MyVoiceChatSessionComponent.Static.VoiceMessageReceived((ulong)Recievebuffer.SenderUserId);
 }
 private static void SendVoice(ulong user, BitReaderWriter data)
 {
     data.ReadData(Recievebuffer, false);
     if (user != Sync.MyId)
     {
         MyMultiplayer.RaiseStaticEvent(x => SendVoicePlayer, user, (BitReaderWriter)Recievebuffer, new EndpointId(user));
     }
     else
     {
         MyVoiceChatSessionComponent.Static.VoiceMessageReceived((ulong)Recievebuffer.SenderUserId);
     }           
 }
        private void SyncPropertyChanged_Implementation(byte propertyIndex, BitReaderWriter reader)
        {
            if (!GlobalValidate(MyEventContext.Current))
                return;

            if (propertyIndex >= m_properties.Count) // Client data validation
                return;

            bool isValid = reader.ReadData(m_properties[propertyIndex], true);

            // Validation succeeded, mark property as clean
            if (MyEventContext.Current.ClientState != null && m_clientData.ContainsKey(MyEventContext.Current.ClientState.EndpointId))
            {
                m_clientData[MyEventContext.Current.ClientState.EndpointId].DirtyProperties[propertyIndex] = !isValid;
            }
        }