| | |
| | | using System.Threading; |
| | | using static RichCreator.Utility.CV.GroupCVHelper; |
| | | using RichCreator.StateMachines; |
| | | using RichCreator.Utility.Maps; |
| | | using RichCreator.Dnf; |
| | | |
| | | namespace RichCreator.Maps |
| | | namespace RichCreator.Maps.Test |
| | | { |
| | | /// <summary> |
| | | /// 测试地图 |
| | | /// </summary> |
| | | public class TestMap : MapInfo |
| | | { |
| | | /// <summary> |
| | | /// 游戏区域 |
| | | /// </summary> |
| | | public ZTRectangle GameRect { get; set; } |
| | | public TestMap(ZTRectangle gameRect, CancellationToken cancelToken) :base(MapType.Test, gameRect, cancelToken) |
| | | { |
| | | |
| | | public CancellationToken cancellationToken { get; set; } |
| | | } |
| | | |
| | | private const bool isCreateGroup = true; |
| | | |
| | | public override ZTResult Start(ZTRectangle gameRect, CancellationToken cancelToken, Int32 runningStep) |
| | | { |
| | | this.GameRect = gameRect; |
| | | this.cancellationToken = cancelToken; |
| | | |
| | | WindowUtils.SetDnfToTop(); |
| | | public override ZTResult Start(Int32 runningStep) |
| | | {WindowUtils.SetDnfToTop(); |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | //沉默一段时间 |
| | | Thread.Sleep(50000000); |
| | | CloseAllAlertWindow(this.cancellationToken, this.GameRect); |
| | | CloseAllAlertWindow(this.CancelToken, this.GameRect); |
| | | return ZTResult.Success; |
| | | } |
| | | |
| | |
| | | //点击创建 |
| | | G.Instance.InputControl.MoveToAndClick(okButtonRect.GetCenterPoint()); |
| | | |
| | | bool result = FuncUtils.TimeoutCancelableWrap(5000, this.cancellationToken, () => { |
| | | bool result = FuncUtils.TimeoutCancelableWrap(5000, this.CancelToken, () => { |
| | | //识别是否有我的队伍按钮 |
| | | return GroupCVHelper.ExistsMyGroupButton(out mygroupButtonRect, this.GameRect); |
| | | }); |
| | |
| | | { |
| | | G.Instance.InfoWriter("create group ok"); |
| | | //点击组队“确定”按钮 |
| | | result = FuncUtils.TimeoutCancelableWrap(15 * 60 * 1000,this.cancellationToken, () => { |
| | | result = FuncUtils.TimeoutCancelableWrap(15 * 60 * 1000,this.CancelToken, () => { |
| | | Utility.Structs.ZTPoint yes = Utility.Structs.ZTPoint.Empty; |
| | | Utility.Structs.ZTPoint no = Utility.Structs.ZTPoint.Empty; |
| | | bool retFind = GroupCVHelper.FindYaoqingZuduiWindow(out yes, out no, this.GameRect); |
| | |
| | | return true; |
| | | } |
| | | |
| | | Utility.Structs.ZTPoint searchButtonCenerPoint = searchButtonRect.GetCenterPoint(); |
| | | ZTPoint searchButtonCenerPoint = searchButtonRect.GetCenterPoint(); |
| | | //输入组名 |
| | | G.Instance.InputControl.MoveToAndClick(new Utility.Structs.ZTPoint (searchButtonCenerPoint.X-80, searchButtonCenerPoint.Y)); |
| | | DeleteAllChar(groupName.Length + 3); |
| | |
| | | |
| | | //查找组项 |
| | | ZTRectangle groupItemRect = ZTRectangle.Empty; |
| | | bool result = FuncUtils.TimeoutCancelableWrap(5000, this.cancellationToken, () => { |
| | | bool result = FuncUtils.TimeoutCancelableWrap(5000, this.CancelToken, () => { |
| | | //识别组项 |
| | | return GroupCVHelper.FindGroupItem(out groupItemRect, this.GameRect); |
| | | }); |
| | |
| | | |
| | | //查找是否打开成员列表窗 |
| | | ZTRectangle joinButtonRect = ZTRectangle.Empty; |
| | | result = FuncUtils.TimeoutCancelableWrap(5000, this.cancellationToken, () => { |
| | | result = FuncUtils.TimeoutCancelableWrap(5000, this.CancelToken, () => { |
| | | //识别是否打开成员列表窗 |
| | | return GroupCVHelper.FindGroupMemberWindow(out joinButtonRect, this.GameRect); |
| | | }); |
| | |
| | | G.Instance.InputControl.MoveToAndClick(joinButtonRect.GetCenterPoint()); |
| | | |
| | | //查找是否已经组队成功,30秒 |
| | | result = FuncUtils.TimeoutCancelableWrap(30000, this.cancellationToken, () => { |
| | | result = FuncUtils.TimeoutCancelableWrap(30000, this.CancelToken, () => { |
| | | //识别是否有我的队伍按钮 |
| | | return GroupCVHelper.ExistsMyGroupButton(out mygroupButtonRect, this.GameRect); |
| | | }); |
| | |
| | | ZTRectangle innerGroupWindowTextRect = ZTRectangle.Empty, innerSearchButtonRect = ZTRectangle.Empty, innerCreateGroupButton = ZTRectangle.Empty; |
| | | for (int i = 0; i < 2; i++) |
| | | { |
| | | CloseAllAlertWindow(this.cancellationToken, this.GameRect); |
| | | CloseAllAlertWindow(this.CancelToken, this.GameRect); |
| | | G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.RightSquarebrackets); |
| | | |
| | | bool result = FuncUtils.TimeoutCancelableWrap(5000, this.cancellationToken, () => { |
| | | bool result = FuncUtils.TimeoutCancelableWrap(5000, this.CancelToken, () => { |
| | | //识别队伍窗 |
| | | return GroupCVHelper.FindGroupWindow(out innerGroupWindowTextRect, out innerSearchButtonRect, out innerCreateGroupButton,out innerHasGroup, this.GameRect); |
| | | }); |
| | |
| | | { |
| | | //点击创建队伍 |
| | | G.Instance.InputControl.MoveToAndClick(createGroupButtonRect.GetCenterPoint()); |
| | | bool result = FuncUtils.TimeoutCancelableWrap(5000, this.cancellationToken, () => { |
| | | bool result = FuncUtils.TimeoutCancelableWrap(5000, this.CancelToken, () => { |
| | | //识别创建队伍窗 |
| | | return GroupCVHelper.FindCreateGroupWindow(out innerCreateGroupWindowTextRect, out innerOkButtonRect, this.GameRect); |
| | | }); |