Delays actions by a set time.
Beispiel #1
0
        /// <summary>
        ///     Initializes static members of the <see cref="HUDInfo" /> class.
        /// </summary>
        static HUDInfo()
        {
            double tinfoHeroDown;
            double panelHeroSizeX;
            float  compareWidth;

            ScreenSize = new Vector2(Drawing.Width, Drawing.Height);
            if (ScreenSize.X == 0)
            {
                Console.WriteLine("Ensage couldnt determine your resolution, try to launch in window mode");
                return;
            }

            minimap = new Minimap(new Vector2(-2, 1), new Vector2(0));

            var ratio = Math.Floor((decimal)(ScreenSize.X / ScreenSize.Y * 100));

            var largeMinimap = Game.GetConsoleVar("dota_hud_extra_large_minimap").GetInt() == 1;

            // Console.WriteLine("Your screen ratio is " + ratio);
            if (ratio == 213)
            {
                compareWidth     = 1600;
                panelHeroSizeX   = 45.28;
                tinfoHeroDown    = 25.714;
                DireCompare      = 2.402;
                RadiantCompare   = 3.08;
                HpBarHeight      = 7;
                HpBarWidth       = 69;
                HpBarX           = 36;
                HpBarY           = 23;
                minimap.Size     = new Vector2(0.1070833333333333f * ScreenSize.X, 0.2240740740740741f * ScreenSize.Y);
                minimapMapScaleX = minimap.Size.X / mapWidth;
                minimapMapScaleY = minimap.Size.Y / mapHeight;
            }
            else if (ratio == 177)
            {
                compareWidth     = 1600;
                panelHeroSizeX   = 52.8900000000004;
                tinfoHeroDown    = 25.714;
                DireCompare      = 2.5001;
                RadiantCompare   = 3.409;
                HpBarHeight      = 10;
                HpBarWidth       = 86.5;
                HpBarX           = 44;
                HpBarY           = 27;
                minimap.Size     = new Vector2(0.1280833333333333f * ScreenSize.X, 0.2240740740740741f * ScreenSize.Y);
                minimapMapScaleX = minimap.Size.X / mapWidth;
                minimapMapScaleY = minimap.Size.Y / mapHeight;
            }
            else if (ratio == 166)
            {
                compareWidth     = 1280;
                panelHeroSizeX   = 47.19;
                tinfoHeroDown    = 25.714;
                DireCompare      = 2.59;
                RadiantCompare   = 3.64;
                HpBarHeight      = 7.4;
                HpBarWidth       = 71;
                HpBarX           = 37;
                HpBarY           = 22;
                minimap.Size     = new Vector2(0.1370833333333333f * ScreenSize.X, 0.2240740740740741f * ScreenSize.Y);
                minimapMapScaleX = minimap.Size.X / mapWidth;
                minimapMapScaleY = minimap.Size.Y / mapHeight;
            }
            else if (ratio == 160)
            {
                compareWidth     = 1280;
                panelHeroSizeX   = 48.95;
                tinfoHeroDown    = 25.714;
                DireCompare      = 2.609;
                RadiantCompare   = 3.78;
                HpBarHeight      = 9;
                HpBarWidth       = 75;
                HpBarX           = 38.3;
                HpBarY           = 25;
                minimap.Size     = new Vector2(0.1425833333333333f * ScreenSize.X, 0.2240740740740741f * ScreenSize.Y);
                minimapMapScaleX = minimap.Size.X / mapWidth;
                minimapMapScaleY = minimap.Size.Y / mapHeight;
            }
            else if (ratio == 150)
            {
                compareWidth     = 1024;
                panelHeroSizeX   = 47.21;
                tinfoHeroDown    = 25.714;
                DireCompare      = 2.775;
                RadiantCompare   = 4.57;
                HpBarHeight      = 8;
                HpBarWidth       = 79.2;
                HpBarX           = 40.2;
                HpBarY           = 24;
                minimap.Size     = new Vector2(0.1500233333333333f * ScreenSize.X, 0.2200940740740741f * ScreenSize.Y);
                minimapMapScaleX = minimap.Size.X / mapWidth;
                minimapMapScaleY = minimap.Size.Y / mapHeight;
            }
            else if (ratio == 133)
            {
                compareWidth     = 1280;
                panelHeroSizeX   = 58.3;
                tinfoHeroDown    = 25.714;
                DireCompare      = 2.78;
                RadiantCompare   = 4.65;
                HpBarHeight      = 8;
                HpBarWidth       = 71;
                HpBarX           = 36.6;
                HpBarY           = 23;
                minimap.Size     = new Vector2(0.1690833333333333f * ScreenSize.X, 0.2225740740740741f * ScreenSize.Y);
                minimapMapScaleX = minimap.Size.X / mapWidth;
                minimapMapScaleY = minimap.Size.Y / mapHeight;
            }
            else if (ratio == 125)
            {
                compareWidth     = 1280;
                panelHeroSizeX   = 58.3;
                tinfoHeroDown    = 25.714;
                DireCompare      = 2.78;
                RadiantCompare   = 4.65;
                HpBarHeight      = 11;
                HpBarWidth       = 96.5;
                HpBarX           = 49;
                HpBarY           = 32;
                minimap.Size     = new Vector2(0.1850833333333333f * ScreenSize.X, 0.2240740740740741f * ScreenSize.Y);
                minimapMapScaleX = minimap.Size.X / mapWidth;
                minimapMapScaleY = minimap.Size.Y / mapHeight;
            }
            else
            {
                Console.WriteLine(
                    @"Your screen resolution is not supported and drawings might have wrong size/position, (" + ratio
                    + ")");
                compareWidth     = 1600;
                panelHeroSizeX   = 65;
                tinfoHeroDown    = 25.714;
                DireCompare      = 2.655;
                RadiantCompare   = 5.985;
                HpBarHeight      = 10;
                HpBarWidth       = 83.5;
                HpBarX           = 43;
                HpBarY           = 28;
                minimap.Size     = new Vector2(0.1270833333333333f * ScreenSize.X, 0.2240740740740741f * ScreenSize.Y);
                minimapMapScaleX = minimap.Size.X / mapWidth;
                minimapMapScaleY = minimap.Size.Y / mapHeight;
            }

            if (largeMinimap)
            {
                const float LargeMinimapConstant = 1.1470833333333333f; // © Moones 2017
                minimap.Size    *= LargeMinimapConstant;
                minimapMapScaleX = minimap.Size.X / mapWidth;
                minimapMapScaleY = minimap.Size.Y / mapHeight;
            }

            Monitor = ScreenSize.X / compareWidth;
            Rate    = Math.Max(Monitor, 1);
            X       = panelHeroSizeX * Monitor;
            y       = ScreenSize.Y / tinfoHeroDown;

            var menu           = new Menu.Menu("HUDInfo", nameof(HUDInfo));
            var minimapOnRight = menu.AddItem(
                new MenuItem(menu.Name + "minimapRight", "Minimap is on the right").SetValue(false).SetTooltip("Enable this if you have minimap on the right"));

            minimapOnRight.ValueChanged += (sender, args) => { MinimapIsOnRight = args.GetNewValue <bool>(); };
            MinimapIsOnRight             = minimapOnRight.GetValue <bool>();

            DelayAction.Add(200, () => Menu.Menu.Root.AddSubMenu(menu));
        }
Beispiel #2
0
        /// <summary>
        ///     Initializes static members of the <see cref="HUDInfo" /> class.
        /// </summary>
        static HUDInfo()
        {
            double tinfoHeroDown;
            double panelHeroSizeX;
            float  compareWidth;

            ScreenSize = new Vector2(Drawing.Width, Drawing.Height);
            if (ScreenSize.X == 0)
            {
                Console.WriteLine("Ensage couldnt determine your resolution, try to launch in window mode");
                return;
            }

            minimap = new Minimap(new Vector2(-2, 1), new Vector2(0));

            var ratio = Math.Floor((decimal)(ScreenSize.X / ScreenSize.Y * 100));

            var largeMinimap = Game.GetConsoleVar("dota_hud_extra_large_minimap").GetInt() == 1;

            // Console.WriteLine("Your screen ratio is " + ratio);
            if (ratio == 213)
            {
                compareWidth     = 1600;
                panelHeroSizeX   = 45.28;
                tinfoHeroDown    = 25.714;
                DireCompare      = 2.402;
                RadiantCompare   = 3.08;
                HpBarHeight      = 7;
                HpBarWidth       = 69;
                HpBarX           = 36;
                HpBarY           = 23;
                minimap.Size     = new Vector2(0.1070833333333333f * ScreenSize.X, 0.2240740740740741f * ScreenSize.Y);
                minimapMapScaleX = minimap.Size.X / mapWidth;
                minimapMapScaleY = minimap.Size.Y / mapHeight;
            }
            else if (ratio == 177)
            {
                compareWidth     = 1600;
                panelHeroSizeX   = 55.09;
                tinfoHeroDown    = 25.714;
                DireCompare      = 2.5401;
                RadiantCompare   = 3.499;
                HpBarHeight      = 10;
                HpBarWidth       = 86.5;
                HpBarX           = 44;
                HpBarY           = 27;
                minimap.Size     = new Vector2(0.1280833333333333f * ScreenSize.X, 0.2240740740740741f * ScreenSize.Y);
                minimapMapScaleX = minimap.Size.X / mapWidth;
                minimapMapScaleY = minimap.Size.Y / mapHeight;
            }
            else if (ratio == 166)
            {
                compareWidth     = 1280;
                panelHeroSizeX   = 47.19;
                tinfoHeroDown    = 25.714;
                DireCompare      = 2.59;
                RadiantCompare   = 3.64;
                HpBarHeight      = 7.4;
                HpBarWidth       = 71;
                HpBarX           = 37;
                HpBarY           = 22;
                minimap.Size     = new Vector2(0.1370833333333333f * ScreenSize.X, 0.2240740740740741f * ScreenSize.Y);
                minimapMapScaleX = minimap.Size.X / mapWidth;
                minimapMapScaleY = minimap.Size.Y / mapHeight;
            }
            else if (ratio == 160)
            {
                compareWidth     = 1280;
                panelHeroSizeX   = 48.95;
                tinfoHeroDown    = 25.714;
                DireCompare      = 2.609;
                RadiantCompare   = 3.78;
                HpBarHeight      = 9;
                HpBarWidth       = 75;
                HpBarX           = 38.3;
                HpBarY           = 25;
                minimap.Size     = new Vector2(0.1425833333333333f * ScreenSize.X, 0.2240740740740741f * ScreenSize.Y);
                minimapMapScaleX = minimap.Size.X / mapWidth;
                minimapMapScaleY = minimap.Size.Y / mapHeight;
            }
            else if (ratio == 150)
            {
                compareWidth     = 1280;
                panelHeroSizeX   = 51.39;
                tinfoHeroDown    = 25.714;
                DireCompare      = 2.64;
                RadiantCompare   = 4.02;
                HpBarHeight      = 8;
                HpBarWidth       = 79.2;
                HpBarX           = 40.2;
                HpBarY           = 24;
                minimap.Size     = new Vector2(0.1500233333333333f * ScreenSize.X, 0.2200940740740741f * ScreenSize.Y);
                minimapMapScaleX = minimap.Size.X / mapWidth;
                minimapMapScaleY = minimap.Size.Y / mapHeight;
            }
            else if (ratio == 133)
            {
                compareWidth     = 1024;
                panelHeroSizeX   = 47.21;
                tinfoHeroDown    = 25.714;
                DireCompare      = 2.775;
                RadiantCompare   = 4.57;
                HpBarHeight      = 8;
                HpBarWidth       = 71;
                HpBarX           = 36.6;
                HpBarY           = 23;
                minimap.Size     = new Vector2(0.1690833333333333f * ScreenSize.X, 0.2225740740740741f * ScreenSize.Y);
                minimapMapScaleX = minimap.Size.X / mapWidth;
                minimapMapScaleY = minimap.Size.Y / mapHeight;
            }
            else if (ratio == 125)
            {
                compareWidth     = 1280;
                panelHeroSizeX   = 58.3;
                tinfoHeroDown    = 25.714;
                DireCompare      = 2.78;
                RadiantCompare   = 4.65;
                HpBarHeight      = 11;
                HpBarWidth       = 96.5;
                HpBarX           = 49;
                HpBarY           = 32;
                minimap.Size     = new Vector2(0.1850833333333333f * ScreenSize.X, 0.2240740740740741f * ScreenSize.Y);
                minimapMapScaleX = minimap.Size.X / mapWidth;
                minimapMapScaleY = minimap.Size.Y / mapHeight;
            }
            else
            {
                Console.WriteLine(
                    @"Your screen resolution is not supported and drawings might have wrong size/position, (" + ratio
                    + ")");
                compareWidth     = 1600;
                panelHeroSizeX   = 65;
                tinfoHeroDown    = 25.714;
                DireCompare      = 2.655;
                RadiantCompare   = 5.985;
                HpBarHeight      = 10;
                HpBarWidth       = 83.5;
                HpBarX           = 43;
                HpBarY           = 28;
                minimap.Size     = new Vector2(0.1270833333333333f * ScreenSize.X, 0.2240740740740741f * ScreenSize.Y);
                minimapMapScaleX = minimap.Size.X / mapWidth;
                minimapMapScaleY = minimap.Size.Y / mapHeight;
            }

            if (largeMinimap)
            {
                const float LargeMinimapConstant = 1.1470833333333333f; // © Moones 2017
                minimap.Size    *= LargeMinimapConstant;
                minimapMapScaleX = minimap.Size.X / mapWidth;
                minimapMapScaleY = minimap.Size.Y / mapHeight;
            }

            Monitor = ScreenSize.X / compareWidth;
            Rate    = Math.Max(Monitor, 1);
            X       = panelHeroSizeX * Monitor;
            y       = ScreenSize.Y / tinfoHeroDown;

            var        mouse  = new Rectangle(new Vector2(5, 5), Color.White);
            GameUpdate update = args =>
            {
                var mousePos = Game.MousePosition;

                // if (Utils.SleepCheck("mouse"))
                // {
                // Console.WriteLine(mousePos);
                // Utils.Sleep(500, "mouse");
                // }
                var minimapPos = mousePos.WorldToMinimap();
                mouse.Position = minimapPos;
            };

            var mipos = new Vector3(MapLeft, MapTop, 0).WorldToMinimap();

            rectangle = new Rectangle(minimap.Size, new ColorBGRA(255, 255, 255, 25))
            {
                Position = mipos
            };

            var menu           = new Menu.Menu("HUDInfo", nameof(HUDInfo));
            var minimapOnRight =
                menu.AddItem(
                    new MenuItem(menu.Name + "minimapRight", "Minimap is on the right").SetValue(false)
                    .SetTooltip("Enable this if you have minimap on the right"));

            minimapOnRight.ValueChanged += (sender, args) => { MinimapIsOnRight = args.GetNewValue <bool>(); };
            MinimapIsOnRight             = minimapOnRight.GetValue <bool>();
            var enableRectangle =
                menu.AddItem(
                    new MenuItem(menu.Name + "enablerectangle", "Enable minimap debug").SetTooltip(
                        "Draws rectangle over minimap in current e.common minimap size (requires -dx9), and shows current mouse position on minimap")
                    .SetValue(false));

            enableRectangle.SetValue(false);
            DrawingEndScene draw = eventArgs =>
            {
                rectangle.Render();
                mouse.Render();
            };

            enableRectangle.ValueChanged += (sender, args) =>
            {
                if (args.GetNewValue <bool>())
                {
                    rectangle.Initialize();
                    mouse.Initialize();
                    Drawing.OnEndScene += draw;
                    Game.OnUpdate      += update;
                }
                else
                {
                    rectangle.Dispose();
                    mouse.Dispose();
                    Drawing.OnEndScene -= draw;
                    Game.OnUpdate      -= update;
                }
            };

            DelayAction.Add(200, () => Menu.Menu.Root.AddSubMenu(menu));
        }