using Emgu.CV; using Emgu.CV.Structure; using RichCreator.Utility; using RichCreator.Utility.Captures; using RichCreator.Utility.CV; using RichCreator.Utility.InputControl; using RichCreator.Utility.Structs; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace RichCreator.Utilitys { public class GameUtils { /// /// 关闭所有弹出窗 /// /// /// /// public static void CloseAllAlertWindowByEsc(CancellationToken cancelToken, ZTRectangle gameRect) { //关闭系统菜单 Int32 counter = 5; while (!cancelToken.IsCancellationRequested && counter > 0) { G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.Escape); Thread.Sleep(1000); if (!DnfCVHelper.IsOpenSystemPanel(gameRect)) { break; } counter--; } } /// /// 关闭所有弹出窗 /// /// /// /// public static void CloseAllAlertWindowByX(CancellationToken cancelToken, ZTRectangle gameRect) { while (!cancelToken.IsCancellationRequested) { //截图 Image 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); } } } }