public void OnKeyEvent(IKeyEvent keyEvent)
        {
            if (keyEvent.IsPressed && PressKeyEvent.Matches(keyEvent))
            {
                Cursor.Position = new Point(Hud.Window.Size.Width / 2, Hud.Window.Size.Height / 2);
                Process.Start("D:\\Game\\click.exe");

                string value = "0 to clear circle";
                if (InputBox("Drawing Circle", "Yard,R,G,B,SW,Dash(d)", ref value) == DialogResult.OK)
                {
                    string sep = ", ";
                    value = value.Trim();
                    string[] CircleInfoList = value.Split(sep.ToCharArray());
                    var      cnt            = 0;
                    bool     Success;
                    int      number;
                    UserDashStyle = false;

                    foreach (string CircleInfo in CircleInfoList)
                    {
                        cnt++;
                        string tmp = CircleInfo;
                        switch (cnt)
                        {
                        case 1:
                            Success = Int32.TryParse(tmp, out number);
                            if ((Success && number == 0) || !Success)
                            {
                                Circle = false;
                            }
                            else
                            {
                                Circle = true;
                            }
                            if (Success && number >= 1 && number <= 60)
                            {
                                UserRadius = number;
                            }
                            else
                            {
                                UserRadius = 20;
                            }
                            break;

                        case 2:
                            Success = Int32.TryParse(tmp, out number);
                            if (Success)
                            {
                                UserRGB_R = number;
                            }
                            else
                            {
                                UserRGB_R = 255;
                            }
                            break;

                        case 3:
                            Success = Int32.TryParse(tmp, out number);
                            if (Success)
                            {
                                UserRGB_G = number;
                            }
                            else
                            {
                                UserRGB_G = 0;
                            }
                            break;

                        case 4:
                            Success = Int32.TryParse(tmp, out number);
                            if (Success)
                            {
                                UserRGB_B = number;
                            }
                            else
                            {
                                UserRGB_B = 0;
                            }
                            break;

                        case 5:
                            float fnum;
                            Success = float.TryParse(tmp, out fnum);
                            if (Success && (fnum >= 1.0f && fnum <= 20.0f))
                            {
                                UserStrokeWidth = fnum;
                            }
                            else
                            {
                                UserStrokeWidth = 2.0f;
                            }
                            break;

                        case 6:
                            var style = tmp.ToLower();
                            if (style == "d")
                            {
                                UserDashStyle = true;
                            }
                            break;
                        }
                    }

                    if (UserRGB_R < 0 || UserRGB_R > 255 || UserRGB_G < 0 || UserRGB_G > 255 || UserRGB_B < 0 || UserRGB_B > 255)
                    {
                        UserRGB_R = 255;
                        UserRGB_G = 0;
                        UserRGB_B = 0;
                    }

                    Load(Hud);
                }
            }
        }
Exemple #2
0
        public void OnKeyEvent(IKeyEvent keyEvent)
        {
            if (keyEvent.IsPressed && PressKeyEvent.Matches(keyEvent))
            {
                ClickTimer           = new System.Timers.Timer();
                ClickTimer.Interval  = 50;
                ClickTimer.Elapsed  += DoClick;
                ClickTimer.AutoReset = false;
                ClickTimer.Enabled   = true;

                string value = "0 to clear circle";
                if (InputBox("Drawing Circle", "Yard,R,G,B,SW,Dash(d)", ref value) == DialogResult.OK)
                {
                    string sep = ", ";
                    value = value.Trim();
                    string[] CircleInfoList = value.Split(sep.ToCharArray());
                    var      cnt            = 0;
                    bool     Success;
                    int      number;
                    UserDashStyle = false;

                    foreach (string CircleInfo in CircleInfoList)
                    {
                        cnt++;
                        string tmp = CircleInfo;
                        switch (cnt)
                        {
                        case 1:
                            Success = Int32.TryParse(tmp, out number);
                            if ((Success && number == 0) || !Success)
                            {
                                Circle = false;
                            }
                            else
                            {
                                Circle = true;
                            }
                            if (Success && number >= 1 && number <= 60)
                            {
                                UserRadius = number;
                            }
                            else
                            {
                                UserRadius = 20;
                            }
                            break;

                        case 2:
                            Success = Int32.TryParse(tmp, out number);
                            if (Success)
                            {
                                UserRGB_R = number;
                            }
                            else
                            {
                                UserRGB_R = 255;
                            }
                            break;

                        case 3:
                            Success = Int32.TryParse(tmp, out number);
                            if (Success)
                            {
                                UserRGB_G = number;
                            }
                            else
                            {
                                UserRGB_G = 0;
                            }
                            break;

                        case 4:
                            Success = Int32.TryParse(tmp, out number);
                            if (Success)
                            {
                                UserRGB_B = number;
                            }
                            else
                            {
                                UserRGB_B = 0;
                            }
                            break;

                        case 5:
                            float fnum;
                            Success = float.TryParse(tmp, out fnum);
                            if (Success && (fnum >= 1.0f && fnum <= 20.0f))
                            {
                                UserStrokeWidth = fnum;
                            }
                            else
                            {
                                UserStrokeWidth = 2.0f;
                            }
                            break;

                        case 6:
                            var style = tmp.ToLower();
                            if (style == "d")
                            {
                                UserDashStyle = true;
                            }
                            break;
                        }
                    }

                    if (UserRGB_R < 0 || UserRGB_R > 255 || UserRGB_G < 0 || UserRGB_G > 255 || UserRGB_B < 0 || UserRGB_B > 255)
                    {
                        UserRGB_R = 255;
                        UserRGB_G = 0;
                        UserRGB_B = 0;
                    }

                    Load(Hud);
                }
            }
        }