//  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("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);

            //  Merge Contents
            int countMergeContents = MergeContents == null ? 0 : MergeContents.Count;

            MyMwcLog.IfNetVerbose_AddToLog("countMergeContents: " + countMergeContents);
            MyMwcMessageOut.WriteInt32(countMergeContents, binaryWriter);
            for (int i = 0; i < countMergeContents; i++)
            {
                MergeContents[i].Write(binaryWriter);
            }

            //  Merge Materials
            int countMergeMaterials = MergeMaterials == null ? 0 : MergeMaterials.Count;

            MyMwcLog.IfNetVerbose_AddToLog("countMergeMaterials: " + countMergeMaterials);
            MyMwcMessageOut.WriteInt32(countMergeMaterials, binaryWriter);
            for (int i = 0; i < countMergeMaterials; i++)
            {
                MergeMaterials[i].Write(binaryWriter);
            }

            //  Voxel Hand Shapes
            int countVoxelHandShapes = VoxelHandShapes == null ? 0 : VoxelHandShapes.Count;

            MyMwcLog.IfNetVerbose_AddToLog("countVoxelHandShapes: " + countVoxelHandShapes);
            MyMwcMessageOut.WriteInt32(countVoxelHandShapes, binaryWriter);
            for (int i = 0; i < countVoxelHandShapes; i++)
            {
                VoxelHandShapes[i].Write(binaryWriter);
            }

            int length = VoxelData != null ? VoxelData.Length : 0;

            MyMwcMessageOut.WriteInt32(length, binaryWriter);
            if (length > 0)
            {
                foreach (var b in VoxelData)
                {
                    MyMwcMessageOut.WriteByte(b, binaryWriter);
                }
            }
        }
        //  Write this object into message-out
        internal override void Write(BinaryWriter binaryWriter)
        {
            base.Write(binaryWriter);

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

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

            MyMwcLog.IfNetVerbose_AddToLog("VoxelMaterial: " + MergeType.ToString());
            MyMwcMessageOut.WriteVoxelMapMergeTypeEnum(MergeType, binaryWriter);
        }
Exemple #4
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 #5
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);
        }
        //  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();

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

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

            MyMwcVoxelMapMergeTypeEnum? mergeType = MyMwcMessageIn.ReadVoxelMapMergeTypeEnumEx(binaryReader, senderEndPoint);
            if (mergeType == null) return NetworkError();
            MergeType = mergeType.Value;
            MyMwcLog.IfNetVerbose_AddToLog("VoxelMaterial: " + MergeType.ToString());

            return true;
        }
        //  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());
            }

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

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

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

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

            MyMwcVoxelMapMergeTypeEnum?mergeType = MyMwcMessageIn.ReadVoxelMapMergeTypeEnumEx(binaryReader, senderEndPoint);

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

            return(true);
        }
Exemple #8
0
        bool Read01089000(BinaryReader binaryReader, EndPoint senderEndPoint, int gameVersion)
        {
            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());

            //  Merge Contents
            int?countMergeContents = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint);

            if (countMergeContents == null)
            {
                return(NetworkError());
            }
            MyMwcLog.IfNetVerbose_AddToLog("countMergeContents: " + countMergeContents);
            MergeContents = new List <MyMwcObjectBuilder_VoxelMap_MergeContent>(countMergeContents.Value);
            for (int i = 0; i < countMergeContents; i++)
            {
                MyMwcObjectBuilder_VoxelMap_MergeContent newMC = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_VoxelMap_MergeContent;
                if (newMC == null)
                {
                    return(NetworkError());
                }
                if (newMC.Read(binaryReader, senderEndPoint, gameVersion) == false)
                {
                    return(NetworkError());
                }
                MergeContents.Add(newMC);
            }

            //  Merge Materials
            int?countMergeMaterials = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint);

            if (countMergeMaterials == null)
            {
                return(NetworkError());
            }
            MyMwcLog.IfNetVerbose_AddToLog("countMergeMaterials: " + countMergeMaterials);
            MergeMaterials = new List <MyMwcObjectBuilder_VoxelMap_MergeMaterial>(countMergeMaterials.Value);
            for (int i = 0; i < countMergeMaterials; i++)
            {
                MyMwcObjectBuilder_VoxelMap_MergeMaterial newMM = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_VoxelMap_MergeMaterial;
                if (newMM == null)
                {
                    return(NetworkError());
                }
                if (newMM.Read(binaryReader, senderEndPoint, gameVersion) == false)
                {
                    return(NetworkError());
                }
                MergeMaterials.Add(newMM);
            }

            //  Voxel Hand Shapes
            int?countVoxelHandShapes = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint);

            if (countVoxelHandShapes == null)
            {
                return(NetworkError());
            }
            MyMwcLog.IfNetVerbose_AddToLog("countVoxelHandShapes: " + countVoxelHandShapes);
            VoxelHandShapes = new List <MyMwcObjectBuilder_VoxelHand_Shape>(countVoxelHandShapes.Value);
            for (int i = 0; i < countVoxelHandShapes; i++)
            {
                MyMwcObjectBuilder_VoxelHand_Shape voxelHandShape = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_VoxelHand_Shape;
                if (voxelHandShape == null)
                {
                    return(NetworkError());
                }
                if (voxelHandShape.Read(binaryReader, senderEndPoint, gameVersion) == false)
                {
                    return(NetworkError());
                }
                VoxelHandShapes.Add(voxelHandShape);
            }

            return(true);
        }
        bool Read01089000(BinaryReader binaryReader, EndPoint senderEndPoint, int gameVersion)
        {
            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());

            //  Merge Contents
            int? countMergeContents = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint);
            if (countMergeContents == null) return NetworkError();
            MyMwcLog.IfNetVerbose_AddToLog("countMergeContents: " + countMergeContents);
            MergeContents = new List<MyMwcObjectBuilder_VoxelMap_MergeContent>(countMergeContents.Value);
            for (int i = 0; i < countMergeContents; i++)
            {
                MyMwcObjectBuilder_VoxelMap_MergeContent newMC = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_VoxelMap_MergeContent;
                if (newMC == null) return NetworkError();
                if (newMC.Read(binaryReader, senderEndPoint, gameVersion) == false) return NetworkError();
                MergeContents.Add(newMC);
            }

            //  Merge Materials
            int? countMergeMaterials = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint);
            if (countMergeMaterials == null) return NetworkError();
            MyMwcLog.IfNetVerbose_AddToLog("countMergeMaterials: " + countMergeMaterials);
            MergeMaterials = new List<MyMwcObjectBuilder_VoxelMap_MergeMaterial>(countMergeMaterials.Value);
            for (int i = 0; i < countMergeMaterials; i++)
            {
                MyMwcObjectBuilder_VoxelMap_MergeMaterial newMM = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_VoxelMap_MergeMaterial;
                if (newMM == null) return NetworkError();
                if (newMM.Read(binaryReader, senderEndPoint, gameVersion) == false) return NetworkError();
                MergeMaterials.Add(newMM);
            }

            //  Voxel Hand Shapes
            int? countVoxelHandShapes = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint);
            if (countVoxelHandShapes == null) return NetworkError();
            MyMwcLog.IfNetVerbose_AddToLog("countVoxelHandShapes: " + countVoxelHandShapes);
            VoxelHandShapes = new List<MyMwcObjectBuilder_VoxelHand_Shape>(countVoxelHandShapes.Value);
            for (int i = 0; i < countVoxelHandShapes; i++)
            {
                MyMwcObjectBuilder_VoxelHand_Shape voxelHandShape = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_VoxelHand_Shape;
                if (voxelHandShape == null) return NetworkError();
                if (voxelHandShape.Read(binaryReader, senderEndPoint, gameVersion) == false) return NetworkError();
                VoxelHandShapes.Add(voxelHandShape);
            }

            return true;
        }