示例#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);
            }
        }
示例#2
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);
            }
        }