// 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(); MyMwcPositionAndOrientation? objectPositionAndOrientation = MyMwcMessageIn.ReadPositionAndOrientationEx(binaryReader, senderEndPoint); if (objectPositionAndOrientation == null) return NetworkError(); MyMwcLog.IfNetVerbose_AddToLog("objectPositionAndOrientation: " + objectPositionAndOrientation.ToString()); PositionAndOrientation = objectPositionAndOrientation.Value; MyMwcVoxelHandModeTypeEnum? voxelHandModeType = MyMwcMessageIn.ReadVoxelHandModeTypeEnumEx(binaryReader, senderEndPoint); if (voxelHandModeType == null) return NetworkError(); VoxelHandModeType = voxelHandModeType.Value; MyMwcLog.IfNetVerbose_AddToLog("VoxelHandModeType: " + VoxelHandModeType.ToString()); bool? isVoxelMaterial = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (isVoxelMaterial == null) return NetworkError(); if (isVoxelMaterial.Value) { VoxelHandMaterial = MyMwcMessageIn.ReadVoxelMaterialsEnumEx(binaryReader, senderEndPoint); } else { VoxelHandMaterial = null; } return true; }
public MyMwcObjectBuilder_VoxelHand_Cylinder(MyMwcPositionAndOrientation positionAndOrientation, float radius1, float radius2, float length, MyMwcVoxelHandModeTypeEnum voxelHandModeType) : base(positionAndOrientation, voxelHandModeType) { Radius1 = radius1; Radius2 = radius2; Length = length; }
private void UpdateVoxelHandProperties() { MyVoxelHandShapeType voxelHandShapeType = (MyVoxelHandShapeType)m_voxelShapeTypeRadioButtonGroup.GetSelectedKey().Value; MyMwcVoxelHandModeTypeEnum modeType = (MyMwcVoxelHandModeTypeEnum)m_voxelShapeModeRadioButtonGroup.GetSelectedKey().Value; MyMwcVoxelMaterialsEnum? materialEnum = (MyMwcVoxelMaterialsEnum)m_voxelShapeMaterialCombobox.GetSelectedKey(); MyEditorVoxelHand.SetVoxelProperties(voxelHandShapeType, m_voxelShapeDistanceSlider.GetValue(), modeType, materialEnum, m_isProjectedCheckbox.Checked, m_isProjectedOnWaypointCheckbox.Checked); }
public static MyGuiEditorVoxelHandHelper GetEditorVoxelHandModeHelper(MyMwcVoxelHandModeTypeEnum modeType) { MyGuiEditorVoxelHandHelper ret; if (m_editorVoxelHandModeHelpers.TryGetValue(modeType, out ret)) return ret; else return null; }
public MyMwcObjectBuilder_VoxelHand_Cuboid(MyMwcPositionAndOrientation positionAndOrientation, float width1, float depth1, float width2, float depth2, float length, MyMwcVoxelHandModeTypeEnum voxelHandModeType) : base(positionAndOrientation, voxelHandModeType) { Width1 = width1; Depth1 = depth1; Width2 = width2; Depth2 = depth2; Length = length; }
protected virtual void Init(MyMwcObjectBuilder_VoxelHand_Shape objectBuilder, MyVoxelMap parentVoxelMap) { base.Init(null, objectBuilder, parentVoxelMap); ModeType = objectBuilder.VoxelHandModeType; Material = objectBuilder.VoxelHandMaterial; SetWorldMatrix(Matrix.CreateWorld(objectBuilder.PositionAndOrientation.Position, objectBuilder.PositionAndOrientation.Forward, objectBuilder.PositionAndOrientation.Up)); Visible = false; }
public void AddVoxelHand(uint voxelMapId, uint entityId, float radius, MyMwcVoxelHandModeTypeEnum handMode, MyMwcVoxelMaterialsEnum?material) { var msg = new MyEventAddVoxelHand(); msg.EntityId = entityId; msg.Radius = radius; msg.HandMode = handMode; msg.VoxelMaterial = material; msg.VoxelMapEntityId = voxelMapId; Peers.SendToAll(ref msg, NetDeliveryMethod.ReliableOrdered, 0); }
public static MyGuiEditorVoxelHandHelper GetEditorVoxelHandModeHelper(MyMwcVoxelHandModeTypeEnum modeType) { MyGuiEditorVoxelHandHelper ret; if (m_editorVoxelHandModeHelpers.TryGetValue(modeType, out ret)) { return(ret); } else { return(null); } }
// 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()); } MyMwcPositionAndOrientation?objectPositionAndOrientation = MyMwcMessageIn.ReadPositionAndOrientationEx(binaryReader, senderEndPoint); if (objectPositionAndOrientation == null) { return(NetworkError()); } MyMwcLog.IfNetVerbose_AddToLog("objectPositionAndOrientation: " + objectPositionAndOrientation.ToString()); PositionAndOrientation = objectPositionAndOrientation.Value; MyMwcVoxelHandModeTypeEnum?voxelHandModeType = MyMwcMessageIn.ReadVoxelHandModeTypeEnumEx(binaryReader, senderEndPoint); if (voxelHandModeType == null) { return(NetworkError()); } VoxelHandModeType = voxelHandModeType.Value; MyMwcLog.IfNetVerbose_AddToLog("VoxelHandModeType: " + VoxelHandModeType.ToString()); bool?isVoxelMaterial = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (isVoxelMaterial == null) { return(NetworkError()); } if (isVoxelMaterial.Value) { VoxelHandMaterial = MyMwcMessageIn.ReadVoxelMaterialsEnumEx(binaryReader, senderEndPoint); } else { VoxelHandMaterial = null; } return(true); }
public void AddVoxelHand(uint voxelMapId, uint entityId, float radius, MyMwcVoxelHandModeTypeEnum handMode, MyMwcVoxelMaterialsEnum? material) { var msg = new MyEventAddVoxelHand(); msg.EntityId = entityId; msg.Radius = radius; msg.HandMode = handMode; msg.VoxelMaterial = material; msg.VoxelMapEntityId = voxelMapId; Peers.SendToAll(ref msg, NetDeliveryMethod.ReliableOrdered, 0); }
public static void WriteVoxelHandModeTypeEnum(MyMwcVoxelHandModeTypeEnum val, BinaryWriter binaryWriter) { binaryWriter.Write((byte)val); }
public void SetVoxelProperties(MyMwcVoxelHandModeTypeEnum modeType, MyMwcVoxelMaterialsEnum?materialEnum) { this.ModeType = modeType; this.Material = materialEnum; }
protected MyMwcObjectBuilder_VoxelHand_Shape(MyMwcPositionAndOrientation positionAndOrientation, MyMwcVoxelHandModeTypeEnum voxelHandModeType) : base() { PositionAndOrientation = positionAndOrientation; VoxelHandModeType = voxelHandModeType; }
public MyMwcObjectBuilder_VoxelHand_Sphere(MyMwcPositionAndOrientation positionAndOrientation, float radius, MyMwcVoxelHandModeTypeEnum voxelHandModeType) : base(positionAndOrientation, voxelHandModeType) { Radius = radius; }
public static void SetVoxelProperties(MyVoxelHandShapeType voxelHandShapeType, float distance, MyMwcVoxelHandModeTypeEnum modeType, MyMwcVoxelMaterialsEnum?materialEnum, bool isProjected, bool isProjectedToWaypoints) { IsProjected = isProjected; IsProjectedToWaypoints = isProjectedToWaypoints; // same shape type if (voxelHandShapeType == MyEditorVoxelHand.VoxelHandShape.GetShapeType()) { //if ((size >= MyVoxelConstants.MIN_VOXEL_HAND_SIZE) && (size <= MyVoxelConstants.MAX_VOXEL_HAND_SIZE)) { //MyEditorVoxelHand.VoxelHandShape.SetShapeSize(size); //MyEditorVoxelHand.VoxelHandShape.SetShapeSize2(size2); //MyEditorVoxelHand.VoxelHandShape.SetShapeSize3(size3); MyEditorVoxelHand.VoxelHandShape.ModeType = modeType; MyEditorVoxelHand.VoxelHandShape.Material = materialEnum; } } // another shape type else { // float newShapeSize = size; // if ((newShapeSize < MyVoxelConstants.MIN_VOXEL_HAND_SIZE) && (newShapeSize > MyVoxelConstants.MAX_VOXEL_HAND_SIZE)) float newShapeSize = MyVoxelConstants.DEFAULT_VOXEL_HAND_SIZE; MyMwcPositionAndOrientation positionAndOritentation = new MyMwcPositionAndOrientation(MySpectator.Position, Vector3.Forward, Vector3.Up); switch (voxelHandShapeType) { case MyVoxelHandShapeType.Sphere: MyMwcObjectBuilder_VoxelHand_Sphere sphereObjectBuilder = new MyMwcObjectBuilder_VoxelHand_Sphere(positionAndOritentation, newShapeSize, modeType); MyEditorVoxelHand.VoxelHandShape = new MyVoxelHandSphere(); ((MyVoxelHandSphere)MyEditorVoxelHand.VoxelHandShape).Init(sphereObjectBuilder, null); break; case MyVoxelHandShapeType.Box: MyMwcObjectBuilder_VoxelHand_Box boxObjectBuilder = new MyMwcObjectBuilder_VoxelHand_Box(positionAndOritentation, newShapeSize, modeType); MyEditorVoxelHand.VoxelHandShape = new MyVoxelHandBox(); ((MyVoxelHandBox)MyEditorVoxelHand.VoxelHandShape).Init(boxObjectBuilder, null); break; case MyVoxelHandShapeType.Cuboid: MyMwcObjectBuilder_VoxelHand_Cuboid cuboidObjectBuilder = new MyMwcObjectBuilder_VoxelHand_Cuboid(positionAndOritentation, newShapeSize, newShapeSize, newShapeSize, newShapeSize, newShapeSize, modeType); MyEditorVoxelHand.VoxelHandShape = new MyVoxelHandCuboid(); ((MyVoxelHandCuboid)MyEditorVoxelHand.VoxelHandShape).Init(cuboidObjectBuilder, null); break; case MyVoxelHandShapeType.Cylinder: MyMwcObjectBuilder_VoxelHand_Cylinder cylinderObjectBuilder = new MyMwcObjectBuilder_VoxelHand_Cylinder(positionAndOritentation, newShapeSize, newShapeSize, newShapeSize, modeType); MyEditorVoxelHand.VoxelHandShape = new MyVoxelHandCylinder(); ((MyVoxelHandCylinder)MyEditorVoxelHand.VoxelHandShape).Init(cylinderObjectBuilder, null); break; default: System.Diagnostics.Debug.Assert(false); break; } MyEditorVoxelHand.VoxelHandShape.Material = materialEnum; } if (IsProjected) { if (!MyFakes.MWBUILDER) { if ((distance >= MyVoxelConstants.MIN_PROJECTED_VOXEL_HAND_OFFSET) && (distance <= MyVoxelConstants.MAX_PROJECTED_VOXEL_HAND_OFFSET)) { MyEditorVoxelHand.SetShapeDistance(distance); } } } else if (IsProjectedToWaypoints) { } else { if ((distance >= MyVoxelConstants.MIN_VOXEL_HAND_DISTANCE) && (distance <= MyVoxelConstants.MAX_VOXEL_HAND_DISTANCE)) { MyEditorVoxelHand.SetShapeDistance(distance); } } MyEditorVoxelHand.UpdateShapePosition(); }
public void SetVoxelProperties(MyMwcVoxelHandModeTypeEnum modeType, MyMwcVoxelMaterialsEnum? materialEnum) { this.ModeType = modeType; this.Material = materialEnum; }
public static void SetVoxelProperties(MyVoxelHandShapeType voxelHandShapeType, float distance, MyMwcVoxelHandModeTypeEnum modeType, MyMwcVoxelMaterialsEnum? materialEnum, bool isProjected, bool isProjectedToWaypoints) { IsProjected = isProjected; IsProjectedToWaypoints = isProjectedToWaypoints; // same shape type if (voxelHandShapeType == MyEditorVoxelHand.VoxelHandShape.GetShapeType()) { //if ((size >= MyVoxelConstants.MIN_VOXEL_HAND_SIZE) && (size <= MyVoxelConstants.MAX_VOXEL_HAND_SIZE)) { //MyEditorVoxelHand.VoxelHandShape.SetShapeSize(size); //MyEditorVoxelHand.VoxelHandShape.SetShapeSize2(size2); //MyEditorVoxelHand.VoxelHandShape.SetShapeSize3(size3); MyEditorVoxelHand.VoxelHandShape.ModeType = modeType; MyEditorVoxelHand.VoxelHandShape.Material = materialEnum; } } // another shape type else { // float newShapeSize = size; // if ((newShapeSize < MyVoxelConstants.MIN_VOXEL_HAND_SIZE) && (newShapeSize > MyVoxelConstants.MAX_VOXEL_HAND_SIZE)) float newShapeSize = MyVoxelConstants.DEFAULT_VOXEL_HAND_SIZE; MyMwcPositionAndOrientation positionAndOritentation = new MyMwcPositionAndOrientation(MySpectator.Position, Vector3.Forward, Vector3.Up); switch (voxelHandShapeType) { case MyVoxelHandShapeType.Sphere: MyMwcObjectBuilder_VoxelHand_Sphere sphereObjectBuilder = new MyMwcObjectBuilder_VoxelHand_Sphere(positionAndOritentation, newShapeSize, modeType); MyEditorVoxelHand.VoxelHandShape = new MyVoxelHandSphere(); ((MyVoxelHandSphere)MyEditorVoxelHand.VoxelHandShape).Init(sphereObjectBuilder, null); break; case MyVoxelHandShapeType.Box: MyMwcObjectBuilder_VoxelHand_Box boxObjectBuilder = new MyMwcObjectBuilder_VoxelHand_Box(positionAndOritentation, newShapeSize, modeType); MyEditorVoxelHand.VoxelHandShape = new MyVoxelHandBox(); ((MyVoxelHandBox)MyEditorVoxelHand.VoxelHandShape).Init(boxObjectBuilder, null); break; case MyVoxelHandShapeType.Cuboid: MyMwcObjectBuilder_VoxelHand_Cuboid cuboidObjectBuilder = new MyMwcObjectBuilder_VoxelHand_Cuboid(positionAndOritentation, newShapeSize, newShapeSize, newShapeSize, newShapeSize, newShapeSize, modeType); MyEditorVoxelHand.VoxelHandShape = new MyVoxelHandCuboid(); ((MyVoxelHandCuboid)MyEditorVoxelHand.VoxelHandShape).Init(cuboidObjectBuilder, null); break; case MyVoxelHandShapeType.Cylinder: MyMwcObjectBuilder_VoxelHand_Cylinder cylinderObjectBuilder = new MyMwcObjectBuilder_VoxelHand_Cylinder(positionAndOritentation, newShapeSize, newShapeSize, newShapeSize, modeType); MyEditorVoxelHand.VoxelHandShape = new MyVoxelHandCylinder(); ((MyVoxelHandCylinder)MyEditorVoxelHand.VoxelHandShape).Init(cylinderObjectBuilder, null); break; default: System.Diagnostics.Debug.Assert(false); break; } MyEditorVoxelHand.VoxelHandShape.Material = materialEnum; } if (IsProjected) { if (!MyFakes.MWBUILDER) { if ((distance >= MyVoxelConstants.MIN_PROJECTED_VOXEL_HAND_OFFSET) && (distance <= MyVoxelConstants.MAX_PROJECTED_VOXEL_HAND_OFFSET)) MyEditorVoxelHand.SetShapeDistance(distance); } } else if (IsProjectedToWaypoints) { } else { if ((distance >= MyVoxelConstants.MIN_VOXEL_HAND_DISTANCE) && (distance <= MyVoxelConstants.MAX_VOXEL_HAND_DISTANCE)) MyEditorVoxelHand.SetShapeDistance(distance); } MyEditorVoxelHand.UpdateShapePosition(); }
public MyMwcObjectBuilder_VoxelHand_Box(MyMwcPositionAndOrientation positionAndOrientation, float size, MyMwcVoxelHandModeTypeEnum voxelHandModeType) : base(positionAndOrientation, voxelHandModeType) { Size = size; Size3 = Size2 = size; //not fully supported yet }