Ejemplo n.º 1
0
 public SimulationKeys(MemRWer g, CallTool.Function f)
 {
     WinIo.KeyUpEx(VKKey.VK_DOWN);
     WinIo.KeyUpEx(VKKey.VK_UP);
     WinIo.KeyUpEx(VKKey.VK_LEFT);
     WinIo.KeyUpEx(VKKey.VK_RIGHT);
     gMrw = g;
     fun  = f;
 }
Ejemplo n.º 2
0
        public void moveThread()
        {
            if (targetX > 0 && targetY > 0)
            {
                int addr = gMrw.readInt32(baseAddr.dwBase_Character);
                int currX, currY;                                                   //当前x , y
                if (firstMovDir)                                                    //上下优先模式
                {
                    if (Math.Abs((currY = fun.getObjPos(addr).y) - targetY) > alwY) //当y轴当前坐标小于容差
                    {
                        if (currY - targetY > 0)                                    // 当前坐标位于目标坐标上边
                        {
                            WinIo.KeyPressEx(VKKey.VK_UP);
                        }
                        else
                        {
                            WinIo.KeyPressEx(VKKey.VK_DOWN);
                        }
                    }

                    if (Math.Abs((currX = fun.getObjPos(addr).x) - targetX) > alwX) //当x轴当前坐标小于容差
                    {
                        if (currX - targetX > 0)                                    // 当前坐标位于目标坐标上边
                        {
                            WinIo.KeyPressEx(VKKey.VK_LEFT);
                        }
                        else
                        {
                            WinIo.KeyPressEx(VKKey.VK_RIGHT);
                        }
                    }

                    WinIo.KeyUpEx(VKKey.VK_LEFT);
                    WinIo.KeyUpEx(VKKey.VK_RIGHT);
                    WinIo.KeyUpEx(VKKey.VK_DOWN);
                    WinIo.KeyUpEx(VKKey.VK_UP);
                }
                else
                {
                    if (Math.Abs((currX = fun.getObjPos(addr).x) - targetX) > alwX) //当x轴当前坐标小于容差
                    {
                        if (currX - targetX > 0)                                    // 当前坐标位于目标坐标上边
                        {
                            WinIo.KeyPressEx(VKKey.VK_LEFT);
                        }
                        else
                        {
                            WinIo.KeyPressEx(VKKey.VK_RIGHT);
                        }
                    }
                    if (Math.Abs((currY = fun.getObjPos(addr).y) - targetY) > alwY) //当y轴当前坐标小于容差
                    {
                        if (currY - targetY > 0)                                    // 当前坐标位于目标坐标上边
                        {
                            WinIo.KeyPressEx(VKKey.VK_UP);
                        }
                        else
                        {
                            WinIo.KeyPressEx(VKKey.VK_DOWN);
                        }
                    }
                    WinIo.KeyUpEx(VKKey.VK_LEFT);
                    WinIo.KeyUpEx(VKKey.VK_RIGHT);
                    WinIo.KeyUpEx(VKKey.VK_DOWN);
                    WinIo.KeyUpEx(VKKey.VK_UP);
                }
            }
        }