Пример #1
0
    public void robotSimulServe(object arg)
    {
        serveType = (int)arg;
        IntPtr roboWin = FindWindow(null, "Robo-Pong 3050XL");

        if (roboWin == IntPtr.Zero)
        {
            Invoke("serve", 0);
            return;
        }
        Rectangle rect = MouseTool.GetWindowRect(roboWin);

        if (rect.Width == 0)
        {
            Invoke("serve", 0);
            return;
        }
        serveCount = 0;
        foreground = GetForegroundWindow();
        Point p = new Point();

        p.X = (int)(rect.Width * 0.1f);
        p.Y = (int)(rect.Height * 0.76f);
        if (foreground != roboWin)
        {
            MouseTool.SetForegroundWindow(roboWin);
        }
        MouseTool.ClickOnPoint(roboWin, p, true);
        // time from newgy app until serve: about 10.15
        // time from serve until bounce on user side: about 0.4649997
        //Invoke("serve", 10.15f);
        //Invoke("serveMultiple", 10.15f);

        StartCoroutine(InvokeRealtimeCoroutine(serveMultiple, firstDelay));
        EventManager.TriggerEvent("ConutdownUntilServe", firstDelay);
        if (foreground != roboWin)
        {
            //Invoke("robotSimulServePostWork", 0.5f);
            StartCoroutine(InvokeRealtimeCoroutine(robotSimulServePostWork, 0.5f));
        }
    }
Пример #2
0
 private void robotSimulServePostWork()
 {
     MouseTool.SetForegroundWindow(foreground);
 }