Exemplo n.º 1
0
        private void RednerIconsOnLargeMap(RenderingContext rc)
        {
            var        camera    = model.Internal.Game.IngameState.Camera;
            var        cw        = camera.Width;
            var        ch        = camera.Height;
            BigMinimap mapWindow = model.Internal.Game.IngameState.IngameUi.Minimap;
            Rect       rcMap     = mapWindow.GetClientRect();

            Vec2  playerPos    = model.Player.GetComponent <Positioned>().GridPos;
            float pPosZ        = model.Player.GetComponent <Render>().Z;
            Vec2  screenCenter = new Vec2(rcMap.W / 2, rcMap.H / 2) + new Vec2(rcMap.X, rcMap.Y) + new Vec2((int)mapWindow.ShiftX, (int)mapWindow.ShiftY);
            float diag         = (float)Math.Sqrt(cw * cw + ch * ch);

            // const float scale = 1280f;
            var   k     = cw < 1024 ? 1120 : 1024;
            float scale = (float)k / ch * cw * 3 / 4;

            foreach (MapIcon icon in _getIcons())
            {
                if (ShouldSkipIcon(icon))
                {
                    continue;
                }

                float iZ    = icon.Entity.GetComponent <Render>().Z;
                Vec2  point = screenCenter + MapIcon.deltaInWorldToMinimapDelta(icon.WorldPosition - playerPos, diag, scale, (int)((iZ - pPosZ) / 10));

                var  texture = icon.LargeMapIcon ?? icon.MinimapIcon;
                int  size    = icon.SizeOfLargeIcon.GetValueOrDefault(icon.Size * 2);
                Rect rect    = new Rect(point.X - size / 2, point.Y - size / 2, size, size);
                texture.DrawAt(rc, point, rect);
            }
        }
Exemplo n.º 2
0
        private void RenderIconsOnMiniMap(RenderingContext rc, Element smallMinimap)
        {
            Vec2  playerPos = model.Player.GetComponent <Positioned>().GridPos;
            float pPosZ     = model.Player.GetComponent <Render>().Z;

            const float scale         = 240f;
            Rect        clientRect    = smallMinimap.GetClientRect();
            Vec2        minimapCenter = new Vec2(clientRect.X + clientRect.W / 2, clientRect.Y + clientRect.H / 2);
            double      diag          = Math.Sqrt(clientRect.W * clientRect.W + clientRect.H * clientRect.H) / 2.0;

            foreach (MapIcon icon in _getIcons())
            {
                if (ShouldSkipIcon(icon))
                {
                    continue;
                }

                float iZ    = icon.Entity.GetComponent <Render>().Z;
                Vec2  point = minimapCenter + MapIcon.deltaInWorldToMinimapDelta(icon.WorldPosition - playerPos, diag, scale, (int)((iZ - pPosZ) / 20));

                var  texture = icon.MinimapIcon;
                int  size    = icon.Size;
                Rect rect    = new Rect(point.X - size / 2, point.Y - size / 2, size, size);
                texture.DrawAt(rc, point, rect);
            }
        }
Exemplo n.º 3
0
        public override void Render(RenderingContext rc, Dictionary <UiMountPoint, Vec2> mountPoints)
        {
            if (!model.InGame || !Settings.GetBool("MinimapIcons"))
            {
                return;
            }
            bool largeMapVisible = model.Internal.IngameState.IngameUi.Minimap.OrangeWords.IsVisible;

            if (!largeMapVisible)
            {
                return;
            }

            var        camera    = model.Internal.game.IngameState.Camera;
            BigMinimap mapWindow = model.Internal.game.IngameState.IngameUi.Minimap;
            Rect       rcMap     = mapWindow.GetClientRect();

            Vec2  playerPos    = model.Player.GetComponent <Positioned>().GridPos;
            float pPosZ        = model.Player.GetComponent <Render>().Z;
            Vec2  screenCenter = new Vec2(rcMap.W / 2, rcMap.H / 2) + new Vec2(rcMap.X, rcMap.Y);
            float diag         = (float)Math.Sqrt(camera.Width * camera.Width + camera.Height * camera.Height);

            const float scale = 1280f;

            foreach (MapIcon icon in getIcons())
            {
                if (icon.ShouldSkip())
                {
                    continue;
                }

                float iZ    = icon.Entity.GetComponent <Render>().Z;
                Vec2  point = screenCenter + MapIcon.deltaInWorldToMinimapDelta(icon.WorldPosition - playerPos, diag, scale, (int)((iZ - pPosZ) / 10));

                var  texture = icon.LargeMapIcon ?? icon.MinimapIcon;
                int  size    = icon.SizeOfLargeIcon.GetValueOrDefault(icon.Size * 2);
                Rect rect    = new Rect(point.X - size / 2, point.Y - size / 2, size, size);
                texture.DrawAt(rc, point, rect);
            }
        }
Exemplo n.º 4
0
        public override void Render(RenderingContext rc, Dictionary <UiMountPoint, Vec2> mountPoints)
        {
            if (!model.InGame || !Settings.GetBool("MinimapIcons"))
            {
                return;
            }
            Element smallMinimap = model.Internal.IngameState.IngameUi.Minimap.SmallMinimap;

            if (!smallMinimap.IsVisible)
            {
                return;
            }


            Vec2  playerPos = model.Player.GetComponent <Positioned>().GridPos;
            float pPosZ     = model.Player.GetComponent <Render>().Z;

            const float scale         = 240f;
            Rect        clientRect    = smallMinimap.GetClientRect();
            Vec2        minimapCenter = new Vec2(clientRect.X + clientRect.W / 2, clientRect.Y + clientRect.H / 2);
            double      diag          = Math.Sqrt(clientRect.W * clientRect.W + clientRect.H * clientRect.H) / 2.0;

            foreach (MapIcon icon in getIcons())
            {
                if (icon.ShouldSkip())
                {
                    continue;
                }

                float iZ    = icon.Entity.GetComponent <Render>().Z;
                Vec2  point = minimapCenter + MapIcon.deltaInWorldToMinimapDelta(icon.WorldPosition - playerPos, diag, scale, (int)((iZ - pPosZ) / 20));

                var  texture = icon.MinimapIcon;
                int  size    = icon.Size;
                Rect rect    = new Rect(point.X - size / 2, point.Y - size / 2, size, size);
                texture.DrawAt(rc, point, rect);
            }
        }