public void RegisterMarker(MyEntity entity, MyHudEntityParams hudParams) { if (hudParams.Entity == null) { hudParams.Entity = entity; } m_markerEntities[entity] = hudParams; }
public MyGuiScreenHudSpace() : base() { RecreateControls(true); m_markerRender = new MyHudMarkerRender(this); m_oreHudMarkerStyle = m_markerRender.AllocateMarkerStyle(MyFontEnum.White, MyHudTexturesEnum.DirectionIndicator, MyHudTexturesEnum.Target_neutral, Color.White); m_gpsHudMarkerStyle = m_markerRender.AllocateMarkerStyle(MyFontEnum.DarkBlue, MyHudTexturesEnum.DirectionIndicator, MyHudTexturesEnum.Target_me, MyHudConstants.GPS_COLOR); m_buttonPanelHudMarkerStyle = m_markerRender.AllocateMarkerStyle(MyFontEnum.DarkBlue, MyHudTexturesEnum.DirectionIndicator, MyHudTexturesEnum.Target_me, MyHudConstants.GPS_COLOR); m_tmpHudEntityParams = new MyHudEntityParams() { Text = new StringBuilder(), FlagsEnum = MyHudIndicatorFlagsEnum.SHOW_ALL, IconColor = MyHudConstants.GPS_COLOR, OffsetText = true }; }
public MyGuiScreenHudSpace() : base() { RecreateControls(true); m_markerRender = new MyHudMarkerRender(this); m_oreHudMarkerStyle = m_markerRender.AllocateMarkerStyle(MyFontEnum.White, MyHudTexturesEnum.DirectionIndicator, MyHudTexturesEnum.Target_neutral, Color.White); m_gpsHudMarkerStyle = m_markerRender.AllocateMarkerStyle(MyFontEnum.DarkBlue, MyHudTexturesEnum.DirectionIndicator, MyHudTexturesEnum.Target_me, MyHudConstants.GPS_COLOR); m_buttonPanelHudMarkerStyle = m_markerRender.AllocateMarkerStyle(MyFontEnum.DarkBlue, MyHudTexturesEnum.DirectionIndicator, MyHudTexturesEnum.Target_me, MyHudConstants.GPS_COLOR); m_tmpHudEntityParams = new MyHudEntityParams() { Text = new StringBuilder(), FlagsEnum = MyHudIndicatorFlagsEnum.SHOW_ALL, IconColor = MyHudConstants.GPS_COLOR, OffsetText = true }; }
private void DrawHackingMarkers(MyHudHackingMarkers hackingMarkers) { ProfilerShort.Begin("MyGuiScreenHud.DrawHackingMarkers"); try { hackingMarkers.UpdateMarkers(); if (MySandboxGame.TotalTimeInMilliseconds % 200 > 100) { return; } foreach (var entityMarker in hackingMarkers.MarkerEntities) { MyEntity entity = entityMarker.Key; MyHudEntityParams hudParams = entityMarker.Value; if (hudParams.ShouldDraw != null && !hudParams.ShouldDraw()) { continue; } var hudParams2 = hudParams; //hudParams2.Text = new StringBuilder("sdsdff"); Vector3 position = Vector3.Transform(hudParams2.RelativePosition, (Matrix)hudParams2.Parent.WorldMatrix); m_markerRender.DrawLocationMarker( m_markerRender.GetStyleForRelation(hudParams.TargetMode), (Vector3)entity.LocationForHudMarker, hudParams2, 0, 0); } DrawTexts(); } finally { ProfilerShort.End(); } }
private void DrawLargeTurretTargets(MyHudLargeTurretTargets largeTurretTargets) { ProfilerShort.Begin("MyGuiScreenHud.DrawLargeTurretTargets"); foreach (var target in largeTurretTargets.Targets) { MyHudEntityParams hudParams = target.Value; if (hudParams.ShouldDraw != null && !hudParams.ShouldDraw()) { continue; } m_markerRender.DrawLocationMarker( m_markerRender.GetStyleForRelation(MyRelationsBetweenPlayerAndBlock.Enemies), target.Key.PositionComp.WorldAABB.Center, hudParams, 0, 0 ); } ProfilerShort.End(); }
internal void RegisterMarker(MyEntity target, MyHudEntityParams hudParams) { m_markers[target] = hudParams; }
internal void RegisterMarker(MyEntity target, MyHudEntityParams hudParams) { m_markers[target] = hudParams; }
public void RegisterMarker(MyEntity entity, MyHudEntityParams hudParams) { if (hudParams.Entity == null) hudParams.Entity = entity; m_markerEntities[entity] = hudParams; }
private void DrawOreMarkers(MyHudOreMarkers oreMarkers) { ProfilerShort.Begin("MyGuiScreenHud.DrawOreMarkers"); if (m_nearestOreDeposits == null || m_nearestOreDeposits.Length < MyDefinitionManager.Static.VoxelMaterialCount) { m_nearestOreDeposits = new OreDepositMarker[MyDefinitionManager.Static.VoxelMaterialCount]; m_nearestDistanceSquared = new float[m_nearestOreDeposits.Length]; } for (int i = 0; i < m_nearestOreDeposits.Length; i++) { m_nearestOreDeposits[i] = default(OreDepositMarker); m_nearestDistanceSquared[i] = float.MaxValue; } foreach (var oreMarker in oreMarkers) { bool debugBoxDrawn = false; foreach (var depositData in oreMarker.Materials) { var oreMaterial = depositData.Material; Vector3D oreWorldPosition; depositData.ComputeWorldPosition(oreMarker.VoxelMap, out oreWorldPosition); var distanceSquared = Vector3.DistanceSquared((Vector3)oreWorldPosition, (Vector3)((MyEntity)MySession.ControlledEntity).WorldMatrix.Translation); float nearestDistanceSquared = m_nearestDistanceSquared[oreMaterial.Index]; if (distanceSquared < nearestDistanceSquared) { m_nearestOreDeposits[oreMaterial.Index] = MyTuple.Create(oreWorldPosition, oreMarker); m_nearestDistanceSquared[oreMaterial.Index] = distanceSquared; } if (false && !debugBoxDrawn) { const int shift = MyOreDetectorComponent.CELL_SIZE_IN_VOXELS_BITS + MyOreDetectorComponent.QUERY_LOD; var worldPosition = oreWorldPosition; Vector3I cellCoord; MyVoxelCoordSystems.WorldPositionToVoxelCoord(oreMarker.VoxelMap.PositionLeftBottomCorner, ref worldPosition, out cellCoord); cellCoord >>= shift; worldPosition = cellCoord * MyOreDetectorComponent.CELL_SIZE_IN_METERS + MyVoxelConstants.VOXEL_SIZE_IN_METRES_HALF; worldPosition += oreMarker.VoxelMap.PositionLeftBottomCorner; var bbox = new BoundingBoxD(worldPosition, worldPosition + MyOreDetectorComponent.CELL_SIZE_IN_METERS); VRageRender.MyRenderProxy.DebugDrawAABB(bbox, Vector3.One, 1f, 1f, false); debugBoxDrawn = true; } } } for (int i = 0; i < m_nearestOreDeposits.Length; i++) { var nearestOreDeposit = m_nearestOreDeposits[i]; if (nearestOreDeposit.Item2 == null || nearestOreDeposit.Item2.VoxelMap == null || nearestOreDeposit.Item2.VoxelMap.Closed) continue; MyVoxelMaterialDefinition voxelMaterial = MyDefinitionManager.Static.GetVoxelMaterialDefinition((byte)i); string oreSubtype = voxelMaterial.MinedOre; var hudParams = new MyHudEntityParams() { FlagsEnum = MyHudIndicatorFlagsEnum.SHOW_ALL, Text = new StringBuilder(oreSubtype), OffsetText = true, Icon = MyHudTexturesEnum.HudOre, IconSize = new Vector2(0.02f, 0.02f) }; m_markerRender.DrawLocationMarker( m_oreHudMarkerStyle, nearestOreDeposit.Item1, hudParams, 0, 0); } DrawTexts(); ProfilerShort.End(); }
internal void RegisterMarker(MyEntity entity, MyHudEntityParams hudParams) { m_markerEntities[entity] = hudParams; m_blinkingTimes[entity] = hudParams.BlinkingTime; }
internal void RegisterMarker(MyEntity entity, MyHudEntityParams hudParams) { m_markerEntities[entity] = hudParams; m_blinkingTimes[entity] = hudParams.BlinkingTime; }
private void DrawOreMarkers(MyHudOreMarkers oreMarkers) { ProfilerShort.Begin("MyGuiScreenHud.DrawOreMarkers"); if (m_nearestOreDeposits == null || m_nearestOreDeposits.Length < MyDefinitionManager.Static.VoxelMaterialCount) { m_nearestOreDeposits = new OreDepositMarker[MyDefinitionManager.Static.VoxelMaterialCount]; m_nearestDistanceSquared = new float[m_nearestOreDeposits.Length]; } for (int i = 0; i < m_nearestOreDeposits.Length; i++) { m_nearestOreDeposits[i] = default(OreDepositMarker); m_nearestDistanceSquared[i] = float.MaxValue; } foreach (var oreMarker in oreMarkers) { bool debugBoxDrawn = false; foreach (var depositData in oreMarker.Materials) { var oreMaterial = depositData.Material; Vector3D oreWorldPosition; depositData.ComputeWorldPosition(oreMarker.VoxelMap, out oreWorldPosition); var distanceSquared = Vector3.DistanceSquared((Vector3)oreWorldPosition, (Vector3)((MyEntity)MySession.ControlledEntity).WorldMatrix.Translation); float nearestDistanceSquared = m_nearestDistanceSquared[oreMaterial.Index]; if (distanceSquared < nearestDistanceSquared) { m_nearestOreDeposits[oreMaterial.Index] = MyTuple.Create(oreWorldPosition, oreMarker); m_nearestDistanceSquared[oreMaterial.Index] = distanceSquared; } if (false && !debugBoxDrawn) { const int shift = MyOreDetectorComponent.CELL_SIZE_IN_VOXELS_BITS + MyOreDetectorComponent.QUERY_LOD; var worldPosition = oreWorldPosition; Vector3I cellCoord; MyVoxelCoordSystems.WorldPositionToVoxelCoord(oreMarker.VoxelMap.PositionLeftBottomCorner, ref worldPosition, out cellCoord); cellCoord >>= shift; worldPosition = cellCoord * MyOreDetectorComponent.CELL_SIZE_IN_METERS + MyVoxelConstants.VOXEL_SIZE_IN_METRES_HALF; worldPosition += oreMarker.VoxelMap.PositionLeftBottomCorner; var bbox = new BoundingBoxD(worldPosition, worldPosition + MyOreDetectorComponent.CELL_SIZE_IN_METERS); VRageRender.MyRenderProxy.DebugDrawAABB(bbox, Vector3.One, 1f, 1f, false); debugBoxDrawn = true; } } } for (int i = 0; i < m_nearestOreDeposits.Length; i++) { var nearestOreDeposit = m_nearestOreDeposits[i]; if (nearestOreDeposit.Item2 == null || nearestOreDeposit.Item2.VoxelMap == null || nearestOreDeposit.Item2.VoxelMap.Closed) { continue; } MyVoxelMaterialDefinition voxelMaterial = MyDefinitionManager.Static.GetVoxelMaterialDefinition((byte)i); string oreSubtype = voxelMaterial.MinedOre; var hudParams = new MyHudEntityParams() { FlagsEnum = MyHudIndicatorFlagsEnum.SHOW_ALL, Text = new StringBuilder(oreSubtype), OffsetText = true, Icon = MyHudTexturesEnum.HudOre, IconSize = new Vector2(0.02f, 0.02f) }; m_markerRender.DrawLocationMarker( m_oreHudMarkerStyle, nearestOreDeposit.Item1, hudParams, 0, 0); } DrawTexts(); ProfilerShort.End(); }