asmrobot
2019-11-21 589ed88a5924a7494e21b95b6bbff5e46ff49ddd
src/RichCreator/Maps/Test/TestMap.cs
@@ -28,14 +28,11 @@
        }
        
        private const bool isCreateGroup = true;
        public override ZTResult Start(Int32 runningStep)
        {WindowUtils.SetDnfToTop();
        {
            WindowUtils.SetDnfToTop();
            const bool isCreateGroup = true;
            string groupName = "aabbccddee";
            if (isCreateGroup)
            {
@@ -57,7 +54,7 @@
            }
            //沉默一段时间
            Thread.Sleep(50000000);
            CloseAllAlertWindow(this.CancelToken, this.GameRect);
            CloseAllAlertWindowByX(this.CancelToken, this.GameRect);
            return ZTResult.Success;
        }
        
@@ -233,7 +230,7 @@
            ZTRectangle innerGroupWindowTextRect = ZTRectangle.Empty, innerSearchButtonRect = ZTRectangle.Empty, innerCreateGroupButton = ZTRectangle.Empty;
            for (int i = 0; i < 2; i++)
            {
                CloseAllAlertWindow(this.CancelToken, this.GameRect);
                CloseAllAlertWindowByX(this.CancelToken, this.GameRect);
                G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.RightSquarebrackets);
                bool result = FuncUtils.TimeoutCancelableWrap(5000, this.CancelToken, () => {
@@ -296,31 +293,6 @@
            return false;
        }
        
        /// <summary>
        /// 关闭所有弹出窗
        /// </summary>
        /// <param name="cancelToken"></param>
        /// <param name="gameRect"></param>
        /// <returns></returns>
        private void CloseAllAlertWindow(CancellationToken cancelToken, ZTRectangle gameRect)
        {
            while (!cancelToken.IsCancellationRequested)
            {
                //G.Instance.InputControl.MoveTo(gameRect.Start.X,gameRect.Start.Y, false, false, false);
                //Thread.Sleep(10);
                //截图
                Image<Rgb, byte> image = ScreenCapture.Instance.CaptureScreenReturnImage();
                ZTRectangle closeButtonRect = ZTRectangle.Empty;
                if (!DnfCVHelper.GetAlertWindow(out closeButtonRect, image, gameRect))
                {
                    return;
                }
                G.Instance.InputControl.MoveToAndClick(closeButtonRect.GetCenterPoint());
                Thread.Sleep(500);
            }
        }
       
    }
}