Пример #1
0
        public void locate(string dest, bool auto_trans = false)
        {
            setState("寻找坐标中");
            var p = findImage("自动寻路|自动寻路2");

            if (p.X <= 0)
            {
                clear();
            }
            while (p.X <= 0)
            {
                dm.KeyPress(Keys.M);
                Thread.Sleep(1000);
                p = findImage("自动寻路|自动寻路2");
            }
            setState("寻路中");
            var arr = dest.Split(new string[] { ",", "," }, StringSplitOptions.None);

            dblclick(p.X + 120, p.Y - 8);
            //await Task.Delay(30);
            //await send_chars(new char[] { (char)8, (char)8, (char)8 });
            //await Task.Delay(30);
            dm.SendString(hwnd, arr[0]);
            Thread.Sleep(60);
            //await Task.Delay(100);
            dblclick(p.X + 120, p.Y + 26);
            //await Task.Delay(30);
            //await send_chars(new char[] { (char)8, (char)8, (char)8 });
            //await Task.Delay(30);
            dm.SendString(hwnd, arr[1]);
            //send_normal_string(arr[1]);
            Thread.Sleep(60);
            click(p.X, p.Y);
            if (auto_trans)
            {
                var x1 = p.X - 450;
                var y1 = p.Y - 450;
                var x2 = p.X + 200;
                var y2 = p.Y;
                Thread.Sleep(1000);
                p = findImage("flag", x1, y1, x2, y2);
                click(p.X + 1, p.Y + 17);
                Thread.Sleep(1000);
                p = findImage("cloud", x1, y1, x2, y2);
                click(p.X + 4, p.Y + 4);
            }
            dm.KeyPress(Keys.Escape);
            Thread.Sleep(2000);
            waitCompleteLocate();
            setState("寻路完成");
        }
Пример #2
0
 private void ctrl_btn_key_Click(object sender, EventArgs e)
 {
     dm.KeyPress((Keys)last_key);
 }