//  Read this object from message-in
        internal override bool Read(BinaryReader binaryReader, EndPoint senderEndPoint, int gameVersion)
        {
            if (base.Read(binaryReader, senderEndPoint, gameVersion) == false) return NetworkError();

            MyMwcVector3Sbyte? relativeSectorPosition = MyMwcMessageIn.ReadVector3SbyteEx(binaryReader, senderEndPoint);
            if (relativeSectorPosition == null) return NetworkError();
            RelativeSectorPosition = relativeSectorPosition.Value;
            MyMwcLog.IfNetVerbose_AddToLog("RelativeSectorPosition: " + RelativeSectorPosition.ToString());

            MyMwcVector3Short? voxelMapPositionInVoxelCoords = MyMwcMessageIn.ReadVector3ShortEx(binaryReader, senderEndPoint);
            if (voxelMapPositionInVoxelCoords == null) return NetworkError();
            VoxelMapPositionInVoxelCoords = voxelMapPositionInVoxelCoords.Value;
            MyMwcLog.IfNetVerbose_AddToLog("VoxelMapPositionInVoxelCoords: " + VoxelMapPositionInVoxelCoords.ToString());

            MyMwcVoxelFilesEnum? voxelFile = MyMwcMessageIn.ReadVoxelFileEnumEx(binaryReader, senderEndPoint);
            if (voxelFile == null) return NetworkError();
            VoxelFile = voxelFile.Value;
            MyMwcLog.IfNetVerbose_AddToLog("VoxelFile: " + VoxelFile.ToString());

            MyMwcVoxelMaterialsEnum? voxelMaterial = MyMwcMessageIn.ReadVoxelMaterialsEnumEx(binaryReader, senderEndPoint);
            if (voxelMaterial == null) return NetworkError();
            VoxelMaterial = voxelMaterial.Value;
            MyMwcLog.IfNetVerbose_AddToLog("VoxelMaterial: " + VoxelMaterial.ToString());

            return true;
        }
Exemple #2
0
        //  Write this object into message-out
        internal override void Write(BinaryWriter binaryWriter)
        {
            base.Write(binaryWriter);

            MyMwcLog.IfNetVerbose_AddToLog("RelativeSectorPosition: " + RelativeSectorPosition.ToString());
            MyMwcMessageOut.WriteVector3Sbyte(RelativeSectorPosition, binaryWriter);

            MyMwcLog.IfNetVerbose_AddToLog("VoxelMapPositionInVoxelCoords: " + VoxelMapPositionInVoxelCoords.ToString());
            MyMwcMessageOut.WriteVector3Short(VoxelMapPositionInVoxelCoords, binaryWriter);

            MyMwcLog.IfNetVerbose_AddToLog("VoxelFile: " + VoxelFile.ToString());
            MyMwcMessageOut.WriteVoxelFilesEnum(VoxelFile, binaryWriter);

            MyMwcLog.IfNetVerbose_AddToLog("VoxelMaterial: " + VoxelMaterial.ToString());
            MyMwcMessageOut.WriteVoxelMaterialsEnum(VoxelMaterial, binaryWriter);
        }
Exemple #3
0
        //  Read this object from message-in
        internal override bool Read(BinaryReader binaryReader, EndPoint senderEndPoint, int gameVersion)
        {
            if (base.Read(binaryReader, senderEndPoint, gameVersion) == false)
            {
                return(NetworkError());
            }

            MyMwcVector3Sbyte?relativeSectorPosition = MyMwcMessageIn.ReadVector3SbyteEx(binaryReader, senderEndPoint);

            if (relativeSectorPosition == null)
            {
                return(NetworkError());
            }
            RelativeSectorPosition = relativeSectorPosition.Value;
            MyMwcLog.IfNetVerbose_AddToLog("RelativeSectorPosition: " + RelativeSectorPosition.ToString());

            MyMwcVector3Short?voxelMapPositionInVoxelCoords = MyMwcMessageIn.ReadVector3ShortEx(binaryReader, senderEndPoint);

            if (voxelMapPositionInVoxelCoords == null)
            {
                return(NetworkError());
            }
            VoxelMapPositionInVoxelCoords = voxelMapPositionInVoxelCoords.Value;
            MyMwcLog.IfNetVerbose_AddToLog("VoxelMapPositionInVoxelCoords: " + VoxelMapPositionInVoxelCoords.ToString());

            MyMwcVoxelFilesEnum?voxelFile = MyMwcMessageIn.ReadVoxelFileEnumEx(binaryReader, senderEndPoint);

            if (voxelFile == null)
            {
                return(NetworkError());
            }
            VoxelFile = voxelFile.Value;
            MyMwcLog.IfNetVerbose_AddToLog("VoxelFile: " + VoxelFile.ToString());

            MyMwcVoxelMaterialsEnum?voxelMaterial = MyMwcMessageIn.ReadVoxelMaterialsEnumEx(binaryReader, senderEndPoint);

            if (voxelMaterial == null)
            {
                return(NetworkError());
            }
            VoxelMaterial = voxelMaterial.Value;
            MyMwcLog.IfNetVerbose_AddToLog("VoxelMaterial: " + VoxelMaterial.ToString());

            return(true);
        }