public override void Render()
        {
            if (!Settings.Enable || !GameController.InGame || !Settings.IconsOnLargeMap ||
                !GameController.Game.IngameState.IngameUi.Map.LargeMap.IsVisible)
            {
                return;
            }

            Camera     camera    = GameController.Game.IngameState.Camera;
            Map        mapWindow = GameController.Game.IngameState.IngameUi.Map;
            RectangleF mapRect   = mapWindow.GetClientRect();

            Vector2 playerPos    = GameController.Player.GetComponent <Positioned>().GridPos;
            float   posZ         = GameController.Player.GetComponent <Render>().Z;
            Vector2 screenCenter = new Vector2(mapRect.Width / 2, mapRect.Height / 2).Translate(0, -20) + new Vector2(mapRect.X, mapRect.Y)
                                   + new Vector2(mapWindow.ShiftX, mapWindow.ShiftY);
            var   diag  = (float)Math.Sqrt(camera.Width * camera.Width + camera.Height * camera.Height);
            float k     = camera.Width < 1024f ? 1120f : 1024f;
            float scale = k / camera.Height * camera.Width * 3 / 4;

            foreach (MapIcon icon in getIcons().Where(x => x.IsVisible()))
            {
                float   iconZ = icon.EntityWrapper.GetComponent <Render>().Z;
                Vector2 point = screenCenter
                                + MapIcon.DeltaInWorldToMinimapDelta(icon.WorldPosition - playerPos, diag, scale, (iconZ - posZ) / 20);

                HudTexture texture = icon.TextureIcon;
                int        size    = icon.SizeOfLargeIcon.GetValueOrDefault(icon.Size * 2);
                texture.Draw(Graphics, new RectangleF(point.X - size / 2f, point.Y - size / 2f, size, size));
            }
        }
示例#2
0
        private void DrawToLargeMiniMap(Entity entity)
        {
            var icon = GetMapIcon(entity);

            if (icon == null)
            {
                return;
            }

            var iconZ = entity?.GetComponent <Render>()?.Z;

            if (iconZ == null)
            {
                return;
            }
            try
            {
                var point = LargeMapInformation.ScreenCenter
                            + MapIcon.DeltaInWorldToMinimapDelta(entity.GetComponent <Positioned>().GridPos - LargeMapInformation.PlayerPos,
                                                                 LargeMapInformation.Diag, LargeMapInformation.Scale,
                                                                 ((float)iconZ - LargeMapInformation.PlayerPosZ) /
                                                                 (9f / LargeMapInformation.MapWindow.LargeMapZoom));

                var size = icon.Size * 2; // icon.SizeOfLargeIcon.GetValueOrDefault(icon.Size * 2);
                                          // LogMessage($"{Name}: entity.Path - {entity.Path}");
                Graphics.DrawImage(icon.Texture, new RectangleF(point.X - size / 2f, point.Y - size / 2f, size, size), icon.Color);
            }
            catch (NullReferenceException) { }
        }
示例#3
0
        private void DrawToSmallMiniMapText(StoredEntity entity, MinimapTextInfo info)
        {
            var camera       = GameController.Game.IngameState.Camera;
            var mapWindow    = GameController.Game.IngameState.IngameUi.Map;
            var mapRect      = mapWindow.SmallMiniMap.GetClientRect();
            var playerPos    = GameController.Player.GetComponent <Positioned>().GridPos;
            var posZ         = GameController.Player.GetComponent <Render>().Z;
            var screenCenter = new Vector2(mapRect.Width / 2, mapRect.Height / 2).Translate(0, -20) + new Vector2(mapRect.X, mapRect.Y) + new Vector2(mapWindow.SmallMinMapX, mapWindow.SmallMinMapY);
            var diag         = (float)Math.Sqrt(camera.Width * camera.Width + camera.Height * camera.Height);
            var k            = camera.Width < 1024f ? 1120f : 1024f;
            var scale        = k / camera.Height * camera.Width * 3f / 4f / mapWindow.SmallMinMapZoom;
            var iconZ        = entity.EntityZ;
            var point        = screenCenter + MapIcon.DeltaInWorldToMinimapDelta(entity.GridPos - playerPos, diag, scale, (iconZ - posZ) / (9f / mapWindow.SmallMinMapZoom));

            point.Y += info.TextOffsetY;
            if (!mapRect.Contains(point))
            {
                return;
            }
            var   size      = Graphics.DrawText(WordWrap(info.Text, info.TextWrapLength), point, info.FontColor, info.FontSize, FontAlign.Center);
            float maxWidth  = 0;
            float maxheight = 0;

            //not sure about sizes below, need test
            point.Y   += size.Y;
            maxheight += size.Y;
            maxWidth   = Math.Max(maxWidth, size.X);
            var background = new RectangleF(point.X - maxWidth / 2 - 3, point.Y - maxheight, maxWidth + 6, maxheight);

            Graphics.DrawBox(background, info.FontBackgroundColor);
        }
示例#4
0
        private void DrawToLargeMiniMapText(StoredEntity entity, MinimapTextInfo info)
        {
            var camera       = GameController.Game.IngameState.Camera;
            var mapWindow    = GameController.Game.IngameState.IngameUi.Map;
            var mapRect      = mapWindow.GetClientRect();
            var playerPos    = GameController.Player.GetComponent <Positioned>().GridPos;
            var posZ         = GameController.Player.GetComponent <Render>().Z;
            var screenCenter = new Vector2(mapRect.Width / 2, mapRect.Height / 2).Translate(0, -20) + new Vector2(mapRect.X, mapRect.Y) + new Vector2(mapWindow.LargeMapShiftX, mapWindow.LargeMapShiftY);
            var diag         = (float)Math.Sqrt(camera.Width * camera.Width + camera.Height * camera.Height);
            var k            = camera.Width < 1024f ? 1120f : 1024f;
            var scale        = k / camera.Height * camera.Width * 3f / 4f / mapWindow.LargeMapZoom;
            var iconZ        = entity.EntityZ;
            var point        = screenCenter + MapIcon.DeltaInWorldToMinimapDelta(entity.GridPos - playerPos, diag, scale, (iconZ - posZ) / (9f / mapWindow.LargeMapZoom));

            point.Y += Settings.AreaTransitionLargeMapYOffset;
            var   size      = Graphics.DrawText(WordWrap(info.Text, info.TextWrapLength), info.FontSize, point, info.FontColor, FontDrawFlags.Center);
            float maxWidth  = 0;
            float maxheight = 0;

            point.Y   += size.Height;
            maxheight += size.Height;
            maxWidth   = Math.Max(maxWidth, size.Width);
            var background = new RectangleF(point.X - maxWidth / 2 - 3, point.Y - maxheight, maxWidth + 6, maxheight);

            Graphics.DrawBox(background, info.FontBackgroundColor);
        }
示例#5
0
文件: Delve.cs 项目: Arecurius0/Delve
        private void DrawToSmallMiniMap(EntityWrapper entity)
        {
            var icon = GetMapIcon(entity);

            if (icon == null)
            {
                return;
            }

            var         smallMinimap = GameController.Game.IngameState.IngameUi.Map.SmallMinimap;
            var         playerPos    = GameController.Player.GetComponent <Positioned>().GridPos;
            var         posZ         = GameController.Player.GetComponent <Render>().Z;
            const float scale        = 240f;
            var         mapRect      = smallMinimap.GetClientRect();
            var         mapCenter    = new Vector2(mapRect.X + mapRect.Width / 2, mapRect.Y + mapRect.Height / 2).Translate(0, 0);
            var         diag         = Math.Sqrt(mapRect.Width * mapRect.Width + mapRect.Height * mapRect.Height) / 2.0;
            var         iconZ        = icon.EntityWrapper.GetComponent <Render>().Z;
            var         point        = mapCenter + MapIcon.DeltaInWorldToMinimapDelta(icon.WorldPosition - playerPos, diag, scale, (iconZ - posZ) / 20);
            var         texture      = icon.TextureIcon;
            var         size         = icon.Size;
            var         rect         = new RectangleF(point.X - size / 2f, point.Y - size / 2f, size, size);

            mapRect.Contains(ref rect, out var isContain);
            if (isContain)
            {
                texture.DrawPluginImage(Graphics, rect);
            }
        }
示例#6
0
        public override void Render()
        {
            try
            {
                if (!Settings.Enable || !GameController.InGame || !Settings.IconsOnMinimap)
                {
                    return;
                }

                Element smallMinimap = GameController.Game.IngameState.IngameUi.Map.SmallMinimap;
                if (!smallMinimap.IsVisible)
                {
                    return;
                }

                if (GameController.Game.IngameState.IngameUi.AtlasPanel.IsVisible)
                {
                    return;
                }
                if (GameController.Game.IngameState.IngameUi.TreePanel.IsVisible)
                {
                    return;
                }

                Vector2 playerPos = GameController.Player.GetComponent <Positioned>().GridPos;
                float   posZ      = GameController.Player.GetComponent <Render>().Z;

                const float SCALE     = 240f;
                RectangleF  mapRect   = smallMinimap.GetClientRect();
                var         mapCenter = new Vector2(mapRect.X + mapRect.Width / 2, mapRect.Y + mapRect.Height / 2).Translate(0, 0);
                double      diag      = Math.Sqrt(mapRect.Width * mapRect.Width + mapRect.Height * mapRect.Height) / 2.0;
                foreach (MapIcon icon in getIcons().Where(x => x.IsVisible()))
                {
                    float   iconZ = icon.EntityWrapper.GetComponent <Render>().Z;
                    Vector2 point = mapCenter
                                    + MapIcon.DeltaInWorldToMinimapDelta(icon.WorldPosition - playerPos, diag, SCALE, (iconZ - posZ) / 20);

                    HudTexture texture = icon.TextureIcon;
                    float      size    = icon.Size;
                    var        rect    = new RectangleF(point.X - size / 2f, point.Y - size / 2f, size, size);
                    bool       isContain;
                    mapRect.Contains(ref rect, out isContain);
                    if (isContain)
                    {
                        texture.Draw(Graphics, rect);
                    }
                }
            }
            catch
            {
                // do nothing
            }
        }
示例#7
0
文件: Delve.cs 项目: Arecurius0/Delve
        private void DrawToLargeMiniMap(EntityWrapper entity)
        {
            var icon = GetMapIcon(entity);

            if (icon == null)
            {
                return;
            }

            var iconZ = icon.EntityWrapper.GetComponent <Render>().Z;
            var point = LargeMapInformation.ScreenCenter
                        + MapIcon.DeltaInWorldToMinimapDelta(icon.WorldPosition - LargeMapInformation.PlayerPos,
                                                             LargeMapInformation.Diag, LargeMapInformation.Scale,
                                                             (iconZ - LargeMapInformation.PlayerPosZ) /
                                                             (9f / LargeMapInformation.MapWindow.LargeMapZoom));

            var texture = icon.TextureIcon;
            var size    = icon.Size * 2;          // icon.SizeOfLargeIcon.GetValueOrDefault(icon.Size * 2);

            texture.DrawPluginImage(Graphics, new RectangleF(point.X - size / 2f, point.Y - size / 2f, size, size));
        }
示例#8
0
        private void DrawToSmallMiniMap(Entity entity)
        {
            var icon = GetMapIcon(entity);

            if (icon == null)
            {
                return;
            }

            var         smallMinimap = GameController.Game.IngameState.IngameUi.Map.SmallMiniMap;
            var         playerPos    = GameController.Player.GetComponent <Positioned>().GridPos;
            var         posZ         = GameController.Player.GetComponent <Render>().Z;
            const float scale        = 240f;
            var         mapRect      = smallMinimap.GetClientRect();
            var         mapCenter    = new Vector2(mapRect.X + mapRect.Width / 2, mapRect.Y + mapRect.Height / 2).Translate(0, 0);
            var         diag         = Math.Sqrt(mapRect.Width * mapRect.Width + mapRect.Height * mapRect.Height) / 2.0;
            var         iconZ        = entity?.GetComponent <Render>()?.Z;

            if (iconZ == null)
            {
                return;
            }

            try
            {
                var point = mapCenter + MapIcon.DeltaInWorldToMinimapDelta(entity.GetComponent <Positioned>().GridPos - playerPos, diag, scale, ((float)iconZ - posZ) / 20);
                var size  = icon.Size;
                var rect  = new RectangleF(point.X - size / 2f, point.Y - size / 2f, size, size);
                mapRect.Contains(ref rect, out var isContain);
                if (isContain)
                {
                    // LogMessage($"{Name}: entity.Path - {entity.Path}");
                    Graphics.DrawImage(icon.Texture, rect, icon.Color);
                }
            }
            catch (NullReferenceException) { }
        }
示例#9
0
        private void DrawToSmallMiniMap(EntityWrapper entity)
        {
            var icon = GetMapIcon(entity);

            if (icon == null)
            {
                return;
            }

            var         smallMinimap = GameController.Game.IngameState.IngameUi.Map.SmallMinimap;
            var         playerPos    = GameController.Player.GetComponent <Positioned>().GridPos;
            var         posZ         = GameController.Player.GetComponent <Render>().Z;
            const float scale        = 240f;
            var         mapRect      = smallMinimap.GetClientRect();
            var         mapCenter    = new Vector2(mapRect.X + mapRect.Width / 2, mapRect.Y + mapRect.Height / 2).Translate(0, 0);
            var         diag         = Math.Sqrt(mapRect.Width * mapRect.Width + mapRect.Height * mapRect.Height) / 2.0;
            var         iconZ        = icon.EntityWrapper.GetComponent <Render>().Z;
            var         point        = mapCenter + MapIcon.DeltaInWorldToMinimapDelta(icon.WorldPosition - playerPos, diag, scale, (iconZ - posZ) / 20);
            var         texture      = icon.TextureIcon;
            var         size         = icon.Size;
            var         rect         = new RectangleF(point.X - size / 2f, point.Y - size / 2f, size, size);

            mapRect.Contains(ref rect, out var isContain);
            if (isContain)
            {
                if (!Settings.TextLabelsOnly)
                {
                    texture.DrawPluginImage(Graphics, rect);
                }

                if (Settings.TextLabels && !entity.Path.StartsWith("Metadata/Terrain/Leagues/Legion/Objects/LegionInitiator"))
                {
                    var    varPath   = entity.Path.ToLower();
                    var    iconColor = GetColorForPath(varPath);
                    string textOut   = "";
                    if (Settings.LootTextLabels)
                    {
                        string file = System.IO.Path.GetFileNameWithoutExtension(icon.TextureIcon.FileName.ToString());
                        textOut = file.Remove(1).ToUpper() + file.Substring(1);
                        if (varPath.Contains("chest") && varPath.Contains("epic"))
                        {
                            textOut += " War Hoard";
                        }
                        else if (varPath.Contains("chest") && !varPath.Contains("epic"))
                        {
                            textOut += " Chest";
                        }
                    }
                    else
                    {
                        if (varPath.Contains("karui"))
                        {
                            textOut = "Karui";
                        }
                        else if (varPath.Contains("eternal"))
                        {
                            textOut = "Eternal";
                        }
                        else if (varPath.Contains("templar"))
                        {
                            textOut = "Templar";
                        }
                        else if (varPath.Contains("vaal"))
                        {
                            textOut = "Vaal";
                        }
                        else if (varPath.Contains("maraketh"))
                        {
                            textOut = "Maraketh";
                        }
                    }
                    if (varPath.Contains("monsterchest") || varPath.Contains("general"))
                    {
                        textOut = entity.GetComponent <Render>().Name;
                    }
                    if (textOut.Contains("{"))
                    {
                        textOut = textOut.Split('{', '}')[1];
                    }


                    if (Settings.TextLabelsOnly)
                    {
                        point.Y = point.Y - size / 2f;
                    }
                    else
                    {
                        point.Y = point.Y + 3;
                    }

                    point.Y += (size / 2f) - Settings.TextYAdjust;
                    var textSize = Graphics.MeasureText(WordWrap(textOut, Settings.TextWrap), Settings.TextSize, FontDrawFlags.Center | FontDrawFlags.Top);
                    Graphics.DrawText(WordWrap(textOut, Settings.TextWrap), Settings.TextSize, point, iconColor, FontDrawFlags.Center | FontDrawFlags.Top);
                    float maxWidth  = 0;
                    float maxheight = 0;
                    point.Y   += textSize.Height;
                    maxheight += textSize.Height;
                    maxWidth   = Math.Max(maxWidth, textSize.Width);
                    var background = new RectangleF(point.X - maxWidth / 2 - 3, point.Y - maxheight, maxWidth + 6, maxheight);
                    Graphics.DrawBox(background, new Color(0, 0, 0, 220));
                    Graphics.DrawFrame(background, 1, iconColor);
                }
            }
            DrawImageEntity(entity, icon);
        }
示例#10
0
        private void DrawToLargeMiniMap(EntityWrapper entity)
        {
            var icon = GetMapIcon(entity);

            if (icon == null)
            {
                return;
            }

            var iconZ = icon.EntityWrapper.GetComponent <Render>().Z;
            var point = LargeMapInformation.ScreenCenter
                        + MapIcon.DeltaInWorldToMinimapDelta(icon.WorldPosition - LargeMapInformation.PlayerPos,
                                                             LargeMapInformation.Diag, LargeMapInformation.Scale,
                                                             (iconZ - LargeMapInformation.PlayerPosZ) /
                                                             (9f / LargeMapInformation.MapWindow.LargeMapZoom));

            var texture = icon.TextureIcon;
            var size    = icon.Size * 1.5f;

            if (!Settings.TextLabelsOnly)
            {
                texture.DrawPluginImage(Graphics, new RectangleF(point.X - size / 2f, point.Y - size / 2f, size, size));
            }


            DrawImageEntity(entity, icon);

            if (Settings.TextLabels && !entity.Path.StartsWith("Metadata/Terrain/Leagues/Legion/Objects/LegionInitiator"))
            {
                var    varPath   = entity.Path.ToLower();
                var    iconColor = GetColorForPath(varPath);
                string textOut   = "";
                if (Settings.LootTextLabels)
                {
                    string file = System.IO.Path.GetFileNameWithoutExtension(icon.TextureIcon.FileName.ToString());
                    textOut = file.Remove(1).ToUpper() + file.Substring(1);
                    if (varPath.Contains("chest") && varPath.Contains("epic"))
                    {
                        textOut += " War Hoard";
                    }
                    else if (varPath.Contains("chest") && !varPath.Contains("epic"))
                    {
                        textOut += " Chest";
                    }
                }
                else
                {
                    if (varPath.Contains("karui"))
                    {
                        textOut = "Karui";
                    }
                    else if (varPath.Contains("eternal"))
                    {
                        textOut = "Eternal";
                    }
                    else if (varPath.Contains("templar"))
                    {
                        textOut = "Templar";
                    }
                    else if (varPath.Contains("vaal"))
                    {
                        textOut = "Vaal";
                    }
                    else if (varPath.Contains("maraketh"))
                    {
                        textOut = "Maraketh";
                    }
                }
                if (varPath.Contains("monsterchest") || varPath.Contains("general"))
                {
                    textOut = entity.GetComponent <Render>().Name;
                }
                if (textOut.Contains("{"))
                {
                    textOut = textOut.Split('{', '}')[1];
                }


                if (Settings.TextLabelsOnly)
                {
                    point.Y = point.Y - size / 2f;
                }
                else
                {
                    point.Y = point.Y + 3;
                }

                point.Y += (size / 2f) - Settings.TextYAdjust;
                var textSize = Graphics.MeasureText(WordWrap(textOut, Settings.TextWrap), Settings.TextSize, FontDrawFlags.Center | FontDrawFlags.Top);
                Graphics.DrawText(WordWrap(textOut, Settings.TextWrap), Settings.TextSize, point, iconColor, FontDrawFlags.Center | FontDrawFlags.Top);
                float maxWidth  = 0;
                float maxheight = 0;
                point.Y   += textSize.Height;
                maxheight += textSize.Height;
                maxWidth   = Math.Max(maxWidth, textSize.Width);
                var background = new RectangleF(point.X - maxWidth / 2 - 3, point.Y - maxheight, maxWidth + 6, maxheight);
                Graphics.DrawBox(background, new Color(0, 0, 0, 220));
                Graphics.DrawFrame(background, 1, iconColor);
            }
        }