Example #1
0
 /// <summary>
 ///     Sends the message.
 /// </summary>
 /// <param name="key">
 ///     The key.
 /// </param>
 /// <param name="message">
 ///     The message.
 /// </param>
 public static void SendMessage(uint key, WindowsMessages message, WndEventComposition args)
 {
     foreach (var menu in RootMenus)
     {
         menu.Value.OnReceiveMessage(message, Utils.GetCursorPos(), key, args);
     }
 }
Example #2
0
        /// <summary>
        ///     The windows process event messages.
        /// </summary>
        /// <param name="args">
        ///     The event args.
        /// </param>
        private static void OnWndProc(WndEventComposition args)
        {
            if (!isVisible)
            {
                return;
            }

            LuminositySlider.OnWndProc(args);
            AlphaSlider.OnWndProc(args);

            var pos = Utils.GetCursorPos();

            if (args.Msg == WindowsMessages.WM_LBUTTONDOWN)
            {
                isMoving = Utils.IsUnderRectangle(pos, X, Y, BackgroundSprite.Width, 25);

                // Apply Button
                if (Utils.IsUnderRectangle(pos, X + 290, Y + 297, 74, 12))
                {
                    Close();
                    return;
                }

                // Cancel Button
                if (Utils.IsUnderRectangle(pos, X + 370, Y + 296, 73, 14))
                {
                    FireEvent(initialColor);
                    Close();
                    return;
                }

                if (Utils.IsUnderRectangle(pos, ColorPickerX, ColorPickerY, ColorPickerW, ColorPickerH))
                {
                    isSelecting = true;
                    UpdateColor();
                }
            }
            else if (args.Msg == WindowsMessages.WM_LBUTTONUP)
            {
                isMoving = isSelecting = false;
            }
            else if (args.Msg == WindowsMessages.WM_MOUSEMOVE)
            {
                if (isSelecting)
                {
                    if (Utils.IsUnderRectangle(pos, ColorPickerX, ColorPickerY, ColorPickerW, ColorPickerH))
                    {
                        UpdateColor();
                    }
                }

                if (isMoving)
                {
                    X += (int)(pos.X - previousPos.X);
                    Y += (int)(pos.Y - previousPos.Y);
                }

                previousPos = pos;
            }
        }
Example #3
0
        /// <summary>
        ///     Called per Windows Message.
        /// </summary>
        /// <param name="args">WndEventArgs</param>
        public void OnWndProc(WndEventArgs args)
        {
            if (Utils.IsUnderRectangle(Utils.GetCursorPos(), this.position.X, this.position.Y, this.line.Width, 25f))
            {
                #region Mouse

                var message = (WindowsMessages)args.Msg;
                if (message == WindowsMessages.WM_LBUTTONDOWN)
                {
                    if (Utils.TickCount - this.clickTick < 0x5DC)
                    {
                        this.clickTick = Utils.TickCount;

                        Notifications.RemoveNotification(this);

                        this.Draw = this.Update = false;
                        if (this.autoDispose)
                        {
                            this.Dispose();
                        }
                        return;
                    }
                    this.clickTick = Utils.TickCount;
                }

                #endregion
            }
        }
Example #4
0
        private static bool MouseOverArea()
        {
            Vector2 pos = Utils.GetCursorPos();

            return((pos.X >= BoxPosition.X - (PermaShowWidth / 2f)) && pos.X <= (BoxPosition.X + (PermaShowWidth / 2f)) &&
                   pos.Y >= BoxPosition.Y && pos.Y <= (BoxPosition.Y + PermaShowItems.Count() * (Text.Description.Height)));
        }
Example #5
0
        /// <summary>
        ///     Fired when the window receives a message.
        /// </summary>
        /// <param name="args">The <see cref="WndEventArgs" /> instance containing the event data.</param>
        private static void OnWndProc(WndEventArgs args)
        {
            if (MenuSettings.DrawMenu || !placetosave.Item("moveable").GetValue <bool>())
            {
                Dragging = false;
                return;
            }

            if (Dragging)
            {
                BoxPosition = Utils.GetCursorPos();
            }

            if (MouseOverArea() && args.Msg == (uint)WindowsMessages.WM_LBUTTONDOWN)
            {
                if (!Dragging)
                {
                    Dragging = true;
                }
            }
            else if (Dragging && args.Msg == (uint)WindowsMessages.WM_LBUTTONUP)
            {
                Dragging    = false;
                BoxPosition = Utils.GetCursorPos();
                SavePosition();
            }
        }
Example #6
0
        /// <summary>
        ///     The windows event process message event.
        /// </summary>
        /// <param name="args">
        ///     The arguments.
        /// </param>
        public void OnWndProc(WndEventComposition args)
        {
            switch (args.Msg)
            {
            case WindowsMessages.WM_LBUTTONDOWN:
                if (Utils.IsUnderRectangle(
                        Utils.GetCursorPos(),
                        this.X,
                        this.Y,
                        this.Width,
                        this.Height + Resources.SliderActive.Height))
                {
                    this.ActiveSprite.Visible   = this.Moving = true;
                    this.InactiveSprite.Visible = false;
                    this.UpdatePercent();
                }
                break;

            case WindowsMessages.WM_MOUSEMOVE:
                if (this.Moving)
                {
                    this.UpdatePercent();
                }
                break;

            case WindowsMessages.WM_LBUTTONUP:
                this.ActiveSprite.Visible   = this.Moving = false;
                this.InactiveSprite.Visible = true;
                break;
            }
        }
Example #7
0
        /// <summary>
        ///     Gets if the mouse of over the perma show.
        /// </summary>
        /// <returns><c>true</c> if the mouse of over the perma show, <c>false</c> otherwise.</returns>
        private static bool MouseOverArea()
        {
            if (Text == null)
            {
                return(false);
            }

            var pos = Utils.GetCursorPos();

            return((pos.X >= BoxPosition.X - (PermaShowWidth / 2f)) && pos.X <= (BoxPosition.X + (PermaShowWidth / 2f)) &&
                   pos.Y >= BoxPosition.Y &&
                   pos.Y <= (BoxPosition.Y + PermaShowItems.Count * (Text.Description.Height * 1.2f)));
        }
Example #8
0
        /// <summary>
        ///     Updates the color picker color.
        /// </summary>
        internal static void UpdateColor()
        {
            if (isSelecting)
            {
                var pos   = Utils.GetCursorPos();
                var color = BackgroundSprite.Bitmap.GetPixel((int)pos.X - X, (int)pos.Y - Y);
                sHue        = ((HSLColor)color).Hue;
                sSaturation = ((HSLColor)color).Saturation;
                UpdateLuminosityBitmap(color);
            }

            sColor.Hue        = sHue;
            sColor.Saturation = sSaturation;
            sColor.Luminosity = (LuminositySlider.Percent * 100d);
            var r = Color.FromArgb(((int)(AlphaSlider.Percent * 255)), sColor);

            PreviewRectangle.Color = new ColorBGRA(r.R, r.G, r.B, r.A);
            UpdateOpacityBitmap(r);
            FireEvent(r);
        }
Example #9
0
        /// <summary>
        ///    Dragging / Moving the menu
        /// </summary>

        private static void OnWndProc(WndEventArgs args)
        {
            if (Dragging)
            {
                BoxPosition = Utils.GetCursorPos();
            }

            if (MouseOverArea() && args.Msg == (uint)WindowsMessages.WM_LBUTTONDOWN)
            {
                if (!Dragging)
                {
                    Dragging = true;
                }
            }
            else if (Dragging && args.Msg == (uint)WindowsMessages.WM_LBUTTONUP)
            {
                Dragging    = false;
                BoxPosition = Utils.GetCursorPos();
                SavePosition();
            }
        }
Example #10
0
 /// <summary>
 ///     Fired when the game receives a window event.
 /// </summary>
 /// <param name="args">
 ///     The windows event process message args.
 /// </param>
 internal void OnWndProc(WndEventComposition args)
 {
     this.OnReceiveMessage(args.Msg, Utils.GetCursorPos(), args.WParam, args);
 }
Example #11
0
        private void OnGameWndProc(WndEventArgs args)
        {
            try
            {
                if (!Menu.Item(Name + "Clickable").GetValue <bool>())
                {
                    return;
                }

                var index = 0;

                var hudWidth  = (float)Math.Ceiling(HudWidth * _scale);
                var hudHeight = (float)Math.Ceiling(HudHeight * _scale);

                var spacing =
                    (float)
                    Math.Ceiling((10f + Menu.Item(Menu.Name + "DrawingSpacing").GetValue <Slider>().Value) * _scale) +
                    hudHeight;

                var offsetTop   = Menu.Item(Menu.Name + "DrawingOffsetTop").GetValue <Slider>().Value + hudHeight / 2;
                var offsetRight = Drawing.Width - Menu.Item(Menu.Name + "DrawingOffsetRight").GetValue <Slider>().Value -
                                  (hudWidth + (float)Math.Ceiling(4 * _scale)) / 2f;

                if (args.Msg == (uint)WindowsMessages.WM_RBUTTONUP ||
                    args.Msg == (uint)WindowsMessages.WM_LBUTTONDBLCLK)
                {
                    var pos = Utils.GetCursorPos();
                    foreach (var enemy in _enemyObjects)
                    {
                        var offset = spacing * index;
                        if (args.Msg == (uint)WindowsMessages.WM_LBUTTONDBLCLK)
                        {
                            var spellData = _spellDatas[enemy.Unit.NetworkId];
                            for (var i = 0; spellData.Count > i; i++)
                            {
                                var spell = spellData[i];
                                if (spell != null)
                                {
                                    if (Utils.IsUnderRectangle(
                                            pos, offsetRight + hudWidth * 0.359f - SummonerWidth / 2f,
                                            offsetTop - hudHeight * 0.28f + offset + (float)Math.Ceiling(26 * _scale) * i -
                                            SummonerHeight / 2f, SummonerWidth, SummonerHeight))
                                    {
                                        var teleportCd = 0f;
                                        if (spell.Name.Contains("Teleport", StringComparison.OrdinalIgnoreCase) &&
                                            _teleports.ContainsKey(enemy.Unit.NetworkId))
                                        {
                                            _teleports.TryGetValue(enemy.Unit.NetworkId, out teleportCd);
                                        }
                                        var time = (teleportCd > 0.1f ? teleportCd : spell.CooldownExpires) - Game.Time;
                                        if (time > 0 && Environment.TickCount > _lastChatSend + 1500)
                                        {
                                            _lastChatSend = Environment.TickCount;
                                            var sName = ReadableSummonerName(spell.Name);
                                            Game.Say(
                                                string.Format(
                                                    "{0} {1} {2}", enemy.Unit.ChampionName, sName,
                                                    ((float)(Math.Round(time * 2f, MidpointRounding.AwayFromZero) / 2f))
                                                    .FormatTime()));
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (enemy.Unit.IsVisible && !enemy.Unit.IsDead &&
                                Utils.IsUnderRectangle(
                                    pos, offsetRight - hudWidth / 2f + hudWidth * 0.1f,
                                    offsetTop + offset - hudHeight / 2f, hudWidth, hudHeight))
                            {
                                ObjectManager.Player.IssueOrder(GameObjectOrder.MoveTo, enemy.Unit);
                            }
                        }
                        index++;
                    }
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
        }
Example #12
0
 /// <summary>
 ///     Updates the percent.
 /// </summary>
 private void UpdatePercent()
 {
     this.Percent = (Utils.GetCursorPos().Y - (Resources.SliderActive.Height / 2f) - this.Y) / this.Height;
     ColorPicker.UpdateColor();
     this.ActiveSprite.Y = this.InactiveSprite.Y = this.Y + (int)(this.percent * this.Height);
 }
Example #13
0
        /// <summary>
        ///     Fired when everything has been drawn.
        /// </summary>
        /// <param name="args">The <see cref="EventArgs" /> instance containing the event data.</param>
        /// <exception cref="Exception">[PermaShow] - MenuItem not supported</exception>
        private static void Drawing_OnEndScene(EventArgs args)
        {
            if (Drawing.Direct3DDevice == null || Drawing.Direct3DDevice.IsDisposed)
            {
                return;
            }

            if (Dragging)
            {
                BoxPosition = Utils.GetCursorPos();
            }

            if (!wasSet)
            {
                PrepareDrawing();
            }

            if (!placetosave.Item("enablepermashow").GetValue <bool>())
            {
                Unsub();
                return;
            }

            PermaArea();

            var halfwidth = 0.96f * (PermaShowWidth / 2);

            var baseposition = new Vector2(BoxPosition.X - halfwidth, BoxPosition.Y);

            var boxx = BoxPosition.X + (PermaShowWidth / 2) - (SmallBoxWidth / 2);

            foreach (var permaitem in PermaShowItems)
            {
                var index  = PermaShowItems.IndexOf(permaitem);
                var boxpos = new Vector2(boxx, baseposition.Y + (Text.Description.Height * 1.2f * index));
                var endpos = new Vector2(
                    BoxPosition.X + (PermaShowWidth / 2),
                    baseposition.Y + (Text.Description.Height * 1.2f * index));
                var itempos = new Vector2(baseposition.X, baseposition.Y + (Text.Description.Height * 1.2f * index));

                var textpos = (int)(endpos.X - (SmallBoxWidth / 1.2f));

                switch (permaitem.Item.ValueType)
                {
                case MenuValueType.Boolean:
                    DrawBox(boxpos, permaitem.Item.GetValue <bool>());
                    Text.DrawText(
                        null,
                        permaitem.DisplayName + ":",
                        (int)itempos.X,
                        (int)itempos.Y,
                        permaitem.Color);
                    Text.DrawText(
                        null,
                        permaitem.Item.GetValue <bool>().ToString(),
                        textpos,
                        (int)itempos.Y,
                        permaitem.Color);
                    break;

                case MenuValueType.Slider:
                    Text.DrawText(
                        null,
                        permaitem.DisplayName + ":",
                        (int)itempos.X,
                        (int)itempos.Y,
                        permaitem.Color);
                    Text.DrawText(
                        null,
                        permaitem.Item.GetValue <Slider>().Value.ToString(),
                        textpos,
                        (int)itempos.Y,
                        permaitem.Color);
                    break;

                case MenuValueType.KeyBind:
                    DrawBox(boxpos, permaitem.Item.GetValue <KeyBind>().Active);
                    Text.DrawText(
                        null,
                        permaitem.DisplayName + " [" + Utils.KeyToText(permaitem.Item.GetValue <KeyBind>().Key)
                        + "] :",
                        (int)itempos.X,
                        (int)itempos.Y,
                        permaitem.Color);

                    Text.DrawText(
                        null,
                        permaitem.Item.GetValue <KeyBind>().Active.ToString(),
                        textpos,
                        (int)(boxpos.Y),
                        permaitem.Color);
                    break;

                case MenuValueType.StringList:
                    Text.DrawText(
                        null,
                        permaitem.DisplayName + ":",
                        (int)itempos.X,
                        (int)itempos.Y,
                        permaitem.Color);
                    var dimen = Text.MeasureText(sprite, permaitem.Item.GetValue <StringList>().SelectedValue);
                    Text.DrawText(
                        null,
                        permaitem.Item.GetValue <StringList>().SelectedValue,
                        (int)(textpos + dimen.Width < endpos.X ? textpos : endpos.X - dimen.Width),
                        (int)itempos.Y,
                        permaitem.Color);
                    break;

                case MenuValueType.Integer:
                    Text.DrawText(
                        null,
                        permaitem.DisplayName + ":",
                        (int)itempos.X,
                        (int)itempos.Y,
                        permaitem.Color);
                    Text.DrawText(
                        null,
                        permaitem.Item.GetValue <int>().ToString(),
                        textpos,
                        (int)itempos.Y,
                        permaitem.Color);
                    break;

                case MenuValueType.None:
                    break;

                default:
                    throw new Exception("[PermaShow] - MenuItem not supported");
                }
            }
        }