4 files added
1 files renamed
12 files modified
| | |
| | | <MenuItem Header="识别"> |
| | | <MenuItem Header="查找选区" Click="FindSelection" /> |
| | | <MenuItem Header="HSV模式查找选区" Click="FindSelectionForHsv" /> |
| | | <MenuItem Header="Thresold模式查找选区" Click="FindSelectionForThresold" /> |
| | | |
| | | <MenuItem Header="查找方块" Click="FindBlock" /> |
| | | <MenuItem Header="查找方框" Click="FindRectangle" /> |
| | | <MenuItem Header="查找加百利" Click="FindJiaBaili" /> |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | //Hsv查找选区 |
| | | private void FindSelectionForHsv(object sender, RoutedEventArgs e) |
| | | { |
| | | Int32 thresholdValue = (Int32)this.ThresholdSlider.Value; |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Thresold查找选取 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void FindSelectionForThresold(object sender, RoutedEventArgs e) |
| | | { |
| | | Int32 thresholdValue = (Int32)this.ThresholdSlider.Value; |
| | | string colorString = SerialToString(); |
| | | ColorArray colorArray = ColorArray.FromThresholdString(thresholdValue, colorString); |
| | | |
| | | ZTRectangle rect = ZTRectangle.Empty; |
| | | ZTRectangle limit = new ZTRectangle(0, 0, this.targetImage.Width - 1, this.targetImage.Height - 1); |
| | | bool result = CVHelper.FindColorArrayForThreshold(out rect, this.sourceImage, colorArray, limit); |
| | | if (result) |
| | | { |
| | | DrawRectangle(rect.Start.X, rect.Start.Y, rect.End.X - rect.Start.X + 1, rect.End.Y - rect.Start.Y + 1, Colors.Green); |
| | | } |
| | | else |
| | | { |
| | | MessageBox.Show("未找到"); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 查找所有方块 |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using Orientation = RichCreator.Utility.Structs.Orientation; |
| | | using RichCreator.Utility.Captures; |
| | | |
| | | namespace RichCreator.Utility.CV |
| | | { |
| | |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 是否在指定颜色在区域内 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static bool RectExistsArray(ZTRectangle rect,ColorArray colorArray) |
| | | { |
| | | ZTRectangle colorRect = ZTRectangle.Empty; |
| | | return RectExistsArray(out colorRect, rect, colorArray); |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 是否在指定颜色在区域内 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static bool RectExistsArray(out ZTRectangle arrayRect,ZTRectangle rect, ColorArray colorArray) |
| | | { |
| | | |
| | | //截图 |
| | | System.Drawing.Bitmap bitmap = ScreenCapture.Instance.CaptureScreen(); |
| | | Image<Rgb, byte> image = new Image<Rgb, byte>(bitmap); |
| | | |
| | | //查找地图右上边是否存在时空之门文字 |
| | | if (CVHelper.FindColorArray(out arrayRect, image, colorArray, rect)) |
| | | { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| New file |
| | |
| | | using RichCreator.Utility.CV; |
| | | using RichCreator.Utility.Structs; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using Emgu.CV; |
| | | using Emgu.CV.Structure; |
| | | using System.Threading; |
| | | using RichCreator.Utility.Captures; |
| | | using ZTImage.Configuration; |
| | | using RichCreator.Utility.Utilitys; |
| | | using System.Diagnostics; |
| | | using ZTImage.Collections; |
| | | |
| | | namespace RichCreator.Utility.CV |
| | | { |
| | | /// <summary> |
| | | /// 频道识别 |
| | | /// </summary> |
| | | public class ChannelCVHelper |
| | | { |
| | | //-133,10点击范围 |
| | | //-200,30识别范围 |
| | | //1,时空之门 |
| | | private static ColorArray ShikongzhimenText = ColorArray.FromHsvFloatString(0.002f, 0.002f, 0.002f, "1259,34,225,197,147$1224,35,225,197,147$1226,35,225,197,147$1227,35,225,197,147$1233,35,225,197,147$1233,34,225,197,147$1240,34,225,197,147$1241,35,225,197,147$1252,35,225,197,147$1251,34,225,197,147$1260,35,225,197,147$1262,34,225,197,147$1263,34,225,197,147$1268,34,225,197,147$1268,35,225,197,147$1268,37,225,197,147$1259,37,225,197,147$1256,37,225,197,147$1254,37,225,197,147$1251,37,225,197,147$1248,37,225,197,147$1246,37,225,197,147$1243,37,225,197,147$1239,37,225,197,147$1236,37,225,197,147$1234,37,225,197,147$1232,37,225,197,147$1229,37,225,197,147$1227,37,225,197,147$1224,37,225,197,147$1224,39,225,197,147$1226,39,225,197,147$1227,39,225,197,147$1233,39,225,197,147$1237,39,225,197,147$1245,39,225,197,147$1254,39,225,197,147$1259,39,225,197,147$1268,39,225,197,147$1268,42,225,197,147$1259,42,225,197,147$1251,42,225,197,147$1241,42,225,197,147$1233,42,225,197,147$1231,42,225,197,147$1227,42,225,197,147$1224,42,225,197,147$1224,44,225,197,147$1227,44,225,197,147$1233,44,225,197,147$1241,44,225,197,147$1249,44,225,197,147$1251,44,225,197,147$1259,44,225,197,147$1268,44,225,197,147$1268,45,225,197,147$1266,45,225,197,147$1259,45,225,197,147$1257,45,225,197,147$1254,45,225,197,147$1252,45,225,197,147$1248,45,225,197,147$1246,45,225,197,147$1242,45,225,197,147$1238,45,225,197,147$1236,45,225,197,147$1233,45,225,197,147$1231,45,225,197,147"); |
| | | /// <summary> |
| | | /// 是否在时空之门频道 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static bool IsInShikongzhimenChannel(ZTRectangle gameRect) |
| | | { |
| | | ZTRectangle limit = new ZTRectangle(gameRect.End.X - 200, gameRect.Start.Y, gameRect.End.X, gameRect.Start.Y + 30); |
| | | return CVHelper.RectExistsArray(limit, ShikongzhimenText); |
| | | } |
| | | |
| | | |
| | | //2,寂静城 |
| | | private static ColorArray JijingchengText = ColorArray.FromHsvFloatString(0.002f, 0.002f, 0.002f, "1226,43,225,197,147$1229,34,225,197,147$1238,34,225,197,147$1242,34,225,197,147$1249,34,225,197,147$1256,34,225,197,147$1258,34,225,197,147$1258,36,225,197,147$1257,36,225,197,147$1256,36,225,197,147$1255,36,225,197,147$1253,36,225,197,147$1252,36,225,197,147$1249,36,225,197,147$1244,36,225,197,147$1241,36,225,197,147$1238,36,225,197,147$1234,36,225,197,147$1224,36,225,197,147$1226,38,225,197,147$1228,38,225,197,147$1230,38,225,197,147$1233,38,225,197,147$1238,38,225,197,147$1241,38,225,197,147$1243,38,225,197,147$1245,38,225,197,147$1249,38,225,197,147$1252,38,225,197,147$1256,38,225,197,147$1258,40,225,197,147$1256,40,225,197,147$1254,40,225,197,147$1252,40,225,197,147$1249,40,225,197,147$1246,40,225,197,147$1244,40,225,197,147$1242,40,225,197,147$1241,40,225,197,147$1239,40,225,197,147$1237,40,225,197,147$1233,40,225,197,147$1230,40,225,197,147$1228,40,225,197,147$1225,40,225,197,147$1224,40,225,197,147$1225,42,225,197,147$1226,42,225,197,147$1227,42,225,197,147$1230,42,225,197,147$1232,42,225,197,147$1237,42,225,197,147$1239,42,225,197,147$1241,42,225,197,147$1243,42,225,197,147$1245,42,225,197,147$1249,42,225,197,147$1250,42,225,197,147$1252,42,225,197,147$1254,42,225,197,147$1256,42,225,197,147$1258,43,225,197,147$1256,43,225,197,147$1254,43,225,197,147$1253,43,225,197,147$1251,43,225,197,147$1248,43,225,197,147$1245,43,225,197,147$1243,43,225,197,147$1239,43,225,197,147$1237,43,225,197,147$1231,43,225,197,147$1228,43,225,197,147$1224,43,225,197,147$1225,45,225,197,147$1226,45,225,197,147$1229,45,225,197,147$1233,45,225,197,147$1234,45,225,197,147$1237,45,225,197,147$1239,45,225,197,147$1242,45,225,197,147$1243,45,225,197,147$1250,45,225,197,147$1254,45,225,197,147$1258,45,225,197,147"); |
| | | /// <summary> |
| | | /// 是否在寂静城频道 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static bool IsInJijingchengChannel(ZTRectangle gameRect) |
| | | { |
| | | ZTRectangle limit = new ZTRectangle(gameRect.End.X - 200, gameRect.Start.Y, gameRect.End.X, gameRect.Start.Y + 30); |
| | | return CVHelper.RectExistsArray(limit, JijingchengText); |
| | | } |
| | | |
| | | |
| | | //频道选择文字 |
| | | private static ColorArray ChannelChoiceText = ColorArray.FromHsvFloatString(0.002f, 0.002f, 0.002f, "684,132,255,255,255$678,132,0,0,0$679,132,255,255,255$681,132,0,0,0$680,132,0,0,0$682,132,255,255,255$686,132,255,255,255$687,132,0,0,0$688,132,0,0,0$689,132,255,255,255$690,132,0,0,0$692,132,0,0,0$693,132,255,255,255$694,132,0,0,0$696,132,0,0,0$697,132,255,255,255$698,132,0,0,0$700,132,0,0,0$701,132,255,255,255$702,132,0,0,0$706,132,0,0,0$707,132,255,255,255$708,132,0,0,0$713,132,0,0,0$714,132,255,255,255$715,132,0,0,0$716,132,255,255,255$719,132,255,255,255$721,132,255,255,255$722,132,0,0,0$722,137,255,255,255$721,137,255,255,255$720,137,0,0,0$719,137,255,255,255$718,137,0,0,0$717,137,255,255,255$716,137,255,255,255$715,137,0,0,0$714,137,255,255,255$713,137,0,0,0$711,137,0,0,0$710,137,255,255,255$707,137,255,255,255$704,137,255,255,255$703,137,0,0,0$702,137,255,255,255$701,137,0,0,0$699,137,0,0,0$698,137,255,255,255$695,137,255,255,255$692,137,255,255,255$691,137,0,0,0$690,137,255,255,255$689,137,0,0,0$687,137,0,0,0$686,137,255,255,255$685,137,0,0,0$684,137,255,255,255$683,137,0,0,0$682,137,255,255,255$681,137,0,0,0$680,137,0,0,0$679,137,255,255,255$678,137,0,0,0$677,137,0,0,0$676,137,0,0,0$675,143,0,0,0$676,143,255,255,255$677,143,255,255,255$678,143,0,0,0$681,143,0,0,0$682,143,255,255,255$684,143,0,0,0$687,143,0,0,0$688,143,255,255,255$691,143,0,0,0$692,143,255,255,255$695,143,255,255,255$698,143,255,255,255$700,143,255,255,255$702,143,0,0,0$704,143,255,255,255$708,143,255,255,255$710,143,255,255,255$711,143,0,0,0$712,143,0,0,0$713,143,255,255,255$714,143,255,255,255$715,143,0,0,0$719,143,255,255,255$720,143,0,0,0$718,143,0,0,0"); |
| | | /// <summary> |
| | | /// 是否打开频道选择窗口 |
| | | /// </summary> |
| | | /// <param name="gameRect"></param> |
| | | /// <returns></returns> |
| | | public static bool IsOpenChannelChoiceWindow(out ZTRectangle textRect, ZTRectangle gameRect) |
| | | { |
| | | return CVHelper.RectExistsArray(out textRect,gameRect, ChannelChoiceText); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | //公告:爆满频道服务器自动连接失败,请再次连接或选择其他频道 |
| | | private static ColorArray BaomanText = ColorArray.FromHsvFloatString(0.002f, 0.002f, 0.002f, "720,329,0,0,0$699,329,0,0,0$700,329,255,255,255$701,329,0,0,0$705,329,0,0,0$706,329,255,255,255$707,329,0,0,0$710,329,0,0,0$711,329,255,255,255$712,329,0,0,0$715,329,255,255,255$714,329,0,0,0$716,329,0,0,0$720,336,0,0,0$719,336,255,255,255$716,336,255,255,255$714,336,255,255,255$711,336,255,255,255$710,336,0,0,0$708,336,0,0,0$707,336,255,255,255$702,336,255,255,255$699,336,255,255,255$698,336,0,0,0$636,365,255,255,255$638,365,255,255,255$641,365,255,255,255$643,365,255,255,255$645,365,255,255,255$650,365,255,255,255$653,365,255,255,255$656,365,255,255,255$658,365,255,255,255$660,365,255,255,255$663,365,255,255,255$666,365,255,255,255$670,365,255,255,255$672,365,255,255,255$674,365,255,255,255$676,365,255,255,255$682,365,255,255,255$685,365,255,255,255$687,365,255,255,255$688,365,255,255,255$690,365,255,255,255$692,365,255,255,255$693,365,255,255,255$698,365,255,255,255$699,365,255,255,255$703,365,255,255,255$704,365,255,255,255$713,365,255,255,255$717,365,255,255,255$720,365,255,255,255$728,365,255,255,255$730,365,255,255,255$733,365,255,255,255$734,365,255,255,255$737,365,255,255,255$740,365,255,255,255$746,365,255,255,255$749,365,255,255,255$756,365,255,255,255$760,365,255,255,255$762,365,255,255,255$767,365,255,255,255$771,365,255,255,255$774,385,255,255,255$772,385,255,255,255$770,385,255,255,255$766,385,255,255,255$761,385,255,255,255$753,385,255,255,255$747,385,255,255,255$742,385,255,255,255$741,385,255,255,255$738,385,255,255,255$734,385,255,255,255$732,385,255,255,255$728,385,255,255,255$726,385,255,255,255$720,385,255,255,255$714,385,255,255,255$713,385,255,255,255$710,385,255,255,255$708,385,255,255,255$706,385,255,255,255$705,385,255,255,255$702,385,255,255,255$699,385,255,255,255$696,385,255,255,255$694,385,255,255,255$692,385,255,255,255$690,385,255,255,255$682,385,255,255,255$677,385,255,255,255$675,385,255,255,255$669,385,255,255,255$665,385,255,255,255$664,385,255,255,255$660,385,255,255,255$657,385,255,255,255$646,385,255,255,255$645,385,255,255,255$641,385,255,255,255$640,385,255,255,255$636,385,255,255,255$646,398,255,255,255$646,395,255,255,255$646,392,255,255,255$646,390,255,255,255$646,387,255,255,255$646,385,255,255,255$646,377,255,255,255$646,371,255,255,255$646,369,255,255,255"); |
| | | |
| | | /// <summary> |
| | | /// 是否切换失败 |
| | | /// </summary> |
| | | /// <param name="gameRect"></param> |
| | | /// <returns></returns> |
| | | public static bool IsChangeFailed(ZTRectangle gameRect) |
| | | { |
| | | ZTRectangle rect = ZTRectangle.Empty; |
| | | return CVHelper.RectExistsArray(out rect, gameRect, BaomanText); |
| | | } |
| | | |
| | | //网格连接中断 |
| | | //关闭后自动打开了频道选择 |
| | | private static ColorArray NetDisConnection = ColorArray.FromHsvFloatString(0.002f, 0.002f, 0.002f, ""); |
| | | |
| | | |
| | | // 公告:连接失败!请稍候几份钟再登录,不便之处,敬请谅解。 |
| | | // 在选择角色界面,点击确认后自动连接其它频道,失败后还可能跳至选角色界面 |
| | | private static ColorArray ConnectionErrorInChoiceRole = ColorArray.FromThresholdString(130, "717,422,0,0,0$712,421,255,255,255$719,421,255,255,255$694,422,0,0,0$695,422,0,0,0$702,422,0,0,0$703,422,255,255,255$704,422,255,255,255$709,422,0,0,0$710,422,0,0,0$715,422,0,0,0$716,422,0,0,0$719,422,255,255,255$721,422,0,0,0$722,422,0,0,0$723,422,0,0,0$694,423,0,0,0$695,423,0,0,0$697,423,255,255,255$698,423,255,255,255$699,423,255,255,255$700,423,255,255,255$704,423,255,255,255$705,423,255,255,255$706,423,255,255,255$707,423,255,255,255$709,423,0,0,0$710,423,0,0,0$711,423,0,0,0$712,423,0,0,0$715,423,0,0,0$716,423,0,0,0$717,423,0,0,0$719,423,255,255,255$721,423,0,0,0$722,423,0,0,0$723,423,0,0,0$694,424,0,0,0$695,424,0,0,0$696,424,0,0,0$697,424,0,0,0$699,424,255,255,255$700,424,0,0,0$701,424,0,0,0$702,424,255,255,255$703,424,0,0,0$704,424,0,0,0$705,424,0,0,0$706,424,0,0,0$707,424,255,255,255$709,424,0,0,0$710,424,0,0,0$711,424,0,0,0$712,424,0,0,0$713,424,0,0,0$714,424,0,0,0$715,424,0,0,0$716,424,0,0,0$717,424,0,0,0$718,424,0,0,0$719,424,255,255,255$721,424,0,0,0$722,424,0,0,0$723,424,0,0,0$694,425,0,0,0$695,425,0,0,0$696,425,0,0,0$697,425,0,0,0$699,425,255,255,255$700,425,0,0,0$701,425,0,0,0$702,425,0,0,0$703,425,0,0,0$704,425,0,0,0$706,425,255,255,255$707,425,0,0,0$708,425,0,0,0$709,425,0,0,0$710,425,0,0,0$711,425,0,0,0$712,425,0,0,0$713,425,0,0,0$714,425,0,0,0$715,425,0,0,0$716,425,0,0,0$717,425,0,0,0$718,425,0,0,0$719,425,255,255,255$721,425,0,0,0$722,425,0,0,0$723,425,0,0,0$694,426,0,0,0$695,426,0,0,0$696,426,0,0,0$699,426,0,0,0$700,426,0,0,0$701,426,0,0,0$703,426,255,255,255$704,426,255,255,255$705,426,255,255,255$706,426,255,255,255$707,426,255,255,255$708,426,255,255,255$711,426,255,255,255$712,426,255,255,255$713,426,255,255,255$715,426,0,0,0$716,426,0,0,0$717,426,0,0,0$718,426,0,0,0$719,426,255,255,255$721,426,0,0,0$722,426,0,0,0$723,426,0,0,0$694,427,0,0,0$695,427,0,0,0$696,427,0,0,0$698,427,255,255,255$701,427,0,0,0$702,427,255,255,255$705,427,255,255,255$708,427,255,255,255$710,427,0,0,0$713,427,255,255,255$715,427,0,0,0$716,427,0,0,0$717,427,0,0,0$718,427,0,0,0$719,427,255,255,255$721,427,0,0,0$722,427,0,0,0$723,427,0,0,0$694,428,0,0,0$695,428,0,0,0$697,428,255,255,255$698,428,255,255,255$700,428,255,255,255$701,428,0,0,0$702,428,255,255,255$705,428,255,255,255$708,428,255,255,255$710,428,0,0,0$711,428,0,0,0$712,428,0,0,0$713,428,255,255,255$715,428,0,0,0$716,428,0,0,0$717,428,0,0,0$721,428,0,0,0$722,428,0,0,0$723,428,0,0,0$694,429,0,0,0$695,429,0,0,0$697,429,255,255,255$699,429,0,0,0$700,429,255,255,255$701,429,0,0,0$702,429,255,255,255$703,429,255,255,255$704,429,255,255,255$705,429,255,255,255$706,429,255,255,255$707,429,255,255,255$708,429,255,255,255$710,429,0,0,0$711,429,0,0,0$712,429,0,0,0$713,429,255,255,255$714,429,0,0,0$715,429,0,0,0$716,429,0,0,0$717,429,0,0,0$718,429,255,255,255$719,429,0,0,0$720,429,255,255,255$722,429,0,0,0$723,429,0,0,0$694,430,0,0,0$695,430,0,0,0$696,430,0,0,0$699,430,0,0,0$700,430,255,255,255$701,430,0,0,0$702,430,255,255,255$705,430,255,255,255$706,430,0,0,0$707,430,0,0,0$708,430,255,255,255$710,430,0,0,0$711,430,0,0,0$712,430,0,0,0$713,430,255,255,255$714,430,0,0,0$715,430,0,0,0$716,430,0,0,0$717,430,0,0,0$718,430,255,255,255$719,430,0,0,0$720,430,255,255,255$722,430,0,0,0$723,430,0,0,0$694,431,0,0,0$695,431,0,0,0$696,431,0,0,0$699,431,0,0,0$700,431,255,255,255$701,431,0,0,0$702,431,255,255,255$703,431,255,255,255$704,431,255,255,255$705,431,255,255,255$706,431,255,255,255$707,431,255,255,255$708,431,255,255,255$710,431,0,0,0$711,431,0,0,0$712,431,0,0,0$713,431,255,255,255$714,431,0,0,0$717,431,0,0,0$718,431,255,255,255$719,431,0,0,0$720,431,255,255,255$722,431,0,0,0$723,431,0,0,0$694,432,0,0,0$695,432,0,0,0$696,432,0,0,0$698,432,255,255,255$699,432,255,255,255$700,432,255,255,255$701,432,0,0,0$702,432,255,255,255$705,432,255,255,255$706,432,0,0,0$707,432,0,0,0$708,432,255,255,255$710,432,0,0,0$711,432,0,0,0$712,432,0,0,0$713,432,255,255,255$714,432,255,255,255$718,432,0,0,0$719,432,0,0,0$720,432,0,0,0$723,432,0,0,0$694,433,0,0,0$695,433,0,0,0$696,433,0,0,0$698,433,255,255,255$700,433,255,255,255$701,433,0,0,0$702,433,255,255,255$705,433,255,255,255$706,433,0,0,0$707,433,0,0,0$708,433,255,255,255$710,433,0,0,0$711,433,0,0,0$712,433,0,0,0$713,433,255,255,255$715,433,0,0,0$717,433,255,255,255$718,433,0,0,0$719,433,0,0,0$720,433,0,0,0$723,433,0,0,0$694,434,0,0,0$695,434,0,0,0$696,434,0,0,0$698,434,0,0,0$699,434,0,0,0$703,434,0,0,0$704,434,0,0,0$706,434,0,0,0$708,434,255,255,255$710,434,0,0,0$711,434,0,0,0$712,434,0,0,0$714,434,0,0,0$715,434,0,0,0$718,434,0,0,0$719,434,0,0,0$720,434,0,0,0$694,435,0,0,0$695,435,0,0,0$696,435,0,0,0$697,435,0,0,0$698,435,0,0,0$699,435,0,0,0$700,435,0,0,0$702,435,0,0,0$703,435,0,0,0$704,435,0,0,0$705,435,0,0,0$706,435,0,0,0$708,435,255,255,255$710,435,0,0,0$711,435,0,0,0$712,435,0,0,0$713,435,0,0,0$714,435,0,0,0$717,435,0,0,0$718,435,0,0,0$719,435,0,0,0$720,435,0,0,0$721,435,0,0,0$722,435,0,0,0$694,436,0,0,0$695,436,0,0,0$696,436,0,0,0$697,436,0,0,0$698,436,0,0,0$699,436,0,0,0$700,436,0,0,0$701,436,0,0,0$702,436,0,0,0$703,436,0,0,0$704,436,0,0,0$705,436,0,0,0$706,436,0,0,0$707,436,0,0,0$708,436,0,0,0$709,436,0,0,0$710,436,0,0,0$711,436,0,0,0$712,436,0,0,0$713,436,0,0,0$714,436,0,0,0$715,436,0,0,0$716,436,0,0,0$717,436,0,0,0$718,436,0,0,0$719,436,0,0,0$720,436,0,0,0$721,436,0,0,0$722,436,0,0,0$723,436,0,0,0$694,437,0,0,0$695,437,0,0,0$696,437,0,0,0$697,437,0,0,0$698,437,0,0,0$699,437,0,0,0$700,437,0,0,0$701,437,0,0,0$702,437,0,0,0$703,437,0,0,0$704,437,0,0,0$705,437,0,0,0$706,437,0,0,0$707,437,0,0,0$708,437,0,0,0$709,437,0,0,0$710,437,0,0,0$711,437,0,0,0$712,437,0,0,0$713,437,0,0,0$714,437,0,0,0$715,437,0,0,0$716,437,0,0,0$717,437,0,0,0$718,437,0,0,0$719,437,0,0,0$720,437,0,0,0$721,437,0,0,0$722,437,0,0,0$723,437,0,0,0"); |
| | | public static bool HasConnectionErrorInChoiceRole(out ZTRectangle confirmButtonRect) |
| | | { |
| | | confirmButtonRect = ZTRectangle.Empty; |
| | | System.Drawing.Bitmap bitmap = ScreenCapture.Instance.CaptureScreen(); |
| | | Image<Rgb, byte> image = new Image<Rgb, byte>(bitmap); |
| | | |
| | | ZTRectangle limit = new ZTRectangle(0, 0, image.Width, image.Height); |
| | | |
| | | //查找开始游戏按钮 |
| | | if (CVHelper.FindColorArrayForThreshold(out confirmButtonRect, image, ConnectionErrorInChoiceRole, limit)) |
| | | { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | //公告:网络连接中断 |
| | | private static ColorArray DisconnectionWhiteText = ColorArray.FromHsvFloatString(0.002f, 0.002f, 0.002f, "734,309,255,255,255$729,307,0,0,0$730,307,255,255,255$731,307,0,0,0$733,307,0,0,0$734,307,255,255,255$743,307,0,0,0$744,307,255,255,255$745,307,0,0,0$749,309,0,0,0$748,309,255,255,255$744,309,255,255,255$741,309,255,255,255$740,309,0,0,0$736,309,0,0,0$733,309,0,0,0$731,309,0,0,0$730,309,255,255,255$729,309,0,0,0$730,314,0,0,0$731,314,255,255,255$732,314,0,0,0$739,314,0,0,0$740,314,255,255,255$745,314,255,255,255$748,314,255,255,255$749,314,0,0,0$769,343,255,255,255$767,343,255,255,255$765,343,255,255,255$763,343,255,255,255$761,343,255,255,255$754,343,255,255,255$745,343,255,255,255$740,343,255,255,255$732,343,255,255,255$727,343,255,255,255$723,343,255,255,255$720,343,255,255,255$716,343,255,255,255$712,343,255,255,255$702,343,255,255,255$702,348,255,255,255$705,348,255,255,255$709,348,255,255,255$712,348,255,255,255$715,348,255,255,255$718,348,255,255,255$719,348,255,255,255$723,348,255,255,255$724,348,255,255,255$727,348,255,255,255$733,348,255,255,255$740,348,255,255,255$741,348,255,255,255$745,348,255,255,255$750,348,255,255,255$754,348,255,255,255$758,348,255,255,255$760,348,255,255,255$762,348,255,255,255$763,348,255,255,255$764,348,255,255,255$767,348,255,255,255$769,348,255,255,255$747,372,255,255,184$742,372,255,255,184$737,372,255,255,184$734,372,255,255,184$731,372,255,255,184$728,372,255,255,184$728,377,255,255,184$729,377,255,255,184$731,377,255,255,184$733,377,255,255,184$735,377,255,255,184$737,377,255,255,184$738,377,255,255,184$742,377,255,255,184$746,377,255,255,184$748,377,255,255,184"); |
| | | private static ColorArray DisconnectionGrayText = ColorArray.FromHsvFloatString(0.002f, 0.002f, 0.002f, "745,307,0,0,0$729,307,0,0,0$730,307,170,170,170$731,307,0,0,0$733,307,0,0,0$734,307,170,170,170$735,307,0,0,0$740,307,0,0,0$743,307,0,0,0$744,307,170,170,170$749,309,0,0,0$748,309,170,170,170$744,309,170,170,170$741,309,170,170,170$740,309,0,0,0$736,309,0,0,0$735,309,0,0,0$734,309,170,170,170$733,309,0,0,0$731,309,0,0,0$730,309,170,170,170$729,309,0,0,0$728,310,0,0,0$729,310,170,170,170$730,310,0,0,0$734,310,0,0,0$735,310,170,170,170$736,310,0,0,0$739,310,0,0,0$740,310,170,170,170$743,310,0,0,0$744,310,170,170,170$745,310,0,0,0$750,312,0,0,0$749,312,170,170,170$739,312,170,170,170$736,312,170,170,170$732,312,170,170,170$728,312,170,170,170$729,312,0,0,0$727,312,0,0,0$702,345,255,255,255$703,345,255,255,255$707,345,255,255,255$711,345,255,255,255$712,345,255,255,255$714,345,255,255,255$717,345,255,255,255$718,345,255,255,255$720,345,255,255,255$722,345,255,255,255$731,345,255,255,255$738,345,255,255,255$740,345,255,255,255$741,345,255,255,255$743,345,255,255,255$747,345,255,255,255$750,345,255,255,255$754,345,255,255,255$758,345,255,255,255$760,345,255,255,255$763,345,255,255,255$767,345,255,255,255$769,350,255,255,255$767,350,255,255,255$763,350,255,255,255$760,350,255,255,255$758,350,255,255,255$754,350,255,255,255$750,350,255,255,255$747,350,255,255,255$744,350,255,255,255$740,350,255,255,255$736,350,255,255,255$733,350,255,255,255$730,350,255,255,255$729,350,255,255,255$727,350,255,255,255$723,350,255,255,255$719,350,255,255,255$712,350,255,255,255$711,350,255,255,255$707,350,255,255,255$703,350,255,255,255$702,350,255,255,255$728,372,255,255,184$731,372,255,255,184$734,372,255,255,184$736,372,255,255,184$737,372,255,255,184$742,372,255,255,184$747,372,255,255,184$749,380,255,255,184$745,380,255,255,184$743,380,255,255,184$742,380,255,255,184$738,380,255,255,184$735,380,255,255,184$733,380,255,255,184$731,380,255,255,184$730,380,255,255,184$729,380,255,255,184"); |
| | | /// <summary> |
| | | /// 是否存在网络连接中断窗 |
| | | /// </summary> |
| | | /// <param name="confirmButtonPoint"></param> |
| | | /// <param name="gameRect"></param> |
| | | /// <returns></returns> |
| | | public static bool HasConnectIsVaildWindow(out ZTPoint confirmButtonPoint, ZTRectangle gameRect) |
| | | { |
| | | confirmButtonPoint = ZTPoint.Empty; |
| | | ZTRectangle tempRect = ZTRectangle.Empty; |
| | | if (!CVHelper.RectExistsArray(out tempRect, gameRect, DisconnectionWhiteText)) |
| | | { |
| | | if (!CVHelper.RectExistsArray(out tempRect, gameRect, DisconnectionGrayText)) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | confirmButtonPoint = new ZTPoint(tempRect.GetCenterPoint().X, tempRect.End.Y); |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | |
| | | return true; |
| | | } |
| | | |
| | | //邀请入门标题文字 |
| | | private static ColorArray YaoqingZuduiWindowTitle = ColorArray.FromHsvFloatString(0.002f, 0.002f, 0.002f, "1162,491,255,255,255$1163,481,255,255,255$1162,480,255,255,255$1162,484,255,255,255$1163,484,255,255,255$1163,487,255,255,255$1163,490,255,255,255$1164,491,255,255,255$1167,491,255,255,255$1172,491,255,255,255$1172,490,255,255,255$1171,489,255,255,255$1169,489,255,255,255$1170,488,255,255,255$1170,487,255,255,255$1171,486,255,255,255$1171,482,255,255,255$1172,482,255,255,255$1169,482,255,255,255$1169,480,255,255,255$1166,480,255,255,255$1166,481,255,255,255$1165,481,255,255,255$1167,481,255,255,255$1167,483,255,255,255$1165,483,255,255,255$1165,485,255,255,255$1167,485,255,255,255$1166,487,255,255,255$1164,487,255,255,255$1168,487,255,255,255$1167,489,255,255,255$1175,491,255,255,255$1176,490,255,255,255$1175,487,255,255,255$1175,484,255,255,255$1174,484,255,255,255$1174,480,255,255,255$1175,481,255,255,255$1177,481,255,255,255$1180,481,255,255,255$1180,480,255,255,255$1183,481,255,255,255$1184,481,255,255,255$1205,480,255,255,255$1205,485,255,255,255$1204,486,255,255,255$1204,488,255,255,255$1203,489,255,255,255$1203,490,255,255,255$1202,491,255,255,255$1208,491,255,255,255$1207,490,255,255,255$1206,486,255,255,255$1198,485,255,255,255$1200,485,255,255,255$1201,488,255,255,255$1198,488,255,255,255$1198,491,255,255,255$1200,489,255,255,255"); |
| | | //申请入门文字 |
| | | private static ColorArray ShengqingruduiText = ColorArray.FromHsvFloatString(0.002f, 0.002f, 0.002f, "1239,637,221,197,147$1137,627,221,197,147$1136,626,221,197,147$1135,630,221,197,147$1137,630,221,197,147$1137,633,221,197,147$1137,636,221,197,147$1138,635,221,197,147$1144,633,221,197,147$1145,632,221,197,147$1145,637,221,197,147$1151,637,221,197,147$1157,637,221,197,147$1157,636,221,197,147$1157,635,221,197,147$1159,636,221,197,147$1161,636,221,197,147$1162,635,221,197,147$1163,635,221,197,147$1164,634,221,197,147$1167,634,221,197,147$1171,635,221,197,147$1175,635,221,197,147$1175,637,221,197,147$1179,635,221,197,147$1179,628,221,197,147$1171,628,221,197,147$1175,626,221,197,147$1181,626,221,197,147$1182,627,221,197,147$1182,637,221,197,147$1183,636,221,197,147$1185,637,221,197,147$1189,637,221,197,147$1190,637,221,197,147$1190,636,221,197,147$1191,631,221,197,147$1231,626,221,197,147$1231,627,221,197,147$1230,628,221,197,147$1230,629,221,197,147$1230,630,221,197,147$1229,630,221,197,147$1230,637,221,197,147$1230,632,221,197,147$1233,631,221,197,147$1238,631,221,197,147$1238,637,221,197,147$1232,637,221,197,147"); |
| | | /// <summary> |
| | | /// 查找邀请组队窗口 |
| | | /// </summary> |
| | | /// <param name="yesPoint"></param> |
| | | /// <param name="noPoint"></param> |
| | | /// <param name="limitRect"></param> |
| | | /// <returns></returns> |
| | | public static bool FindYaoqingZuduiWindow(out ZTPoint yesPoint,out ZTPoint noPoint, ZTRectangle limitRect) |
| | | { |
| | | ZTRectangle textRect = ZTRectangle.Empty; |
| | | yesPoint = ZTPoint.Empty; |
| | | noPoint = ZTPoint.Empty; |
| | | Image<Rgb, byte> image = ScreenCapture.Instance.CaptureScreenReturnImage(); |
| | | |
| | | if (!CVHelper.FindColorArray(out textRect, image, YaoqingZuduiWindowTitle, limitRect)) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | ZTRectangle shengqingTextRect = ZTRectangle.Empty; |
| | | if (!CVHelper.FindColorArray(out shengqingTextRect, image, ShengqingruduiText, limitRect)) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | ZTPoint center = textRect.GetCenterPoint(); |
| | | yesPoint = new ZTPoint(center.X - 28, center.Y + 186); |
| | | noPoint = new ZTPoint(center.X + 28, center.Y + 186); |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 频道项 |
| | | /// </summary> |
| | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 鼠标移动指定位置并点击 |
| | | /// 鼠标移动指定位置并单击 |
| | | /// </summary> |
| | | /// <param name="point"></param> |
| | | public void MoveToAndClick(ZTPoint point) |
| | |
| | | Move(0, 0, false, false, false); |
| | | Thread.Sleep(RandomUtils.MouseClickDuration); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 鼠标移动指定位置并双击 |
| | | /// </summary> |
| | | /// <param name="point"></param> |
| | | public void MoveToAndDClick(ZTPoint point) |
| | | { |
| | | MoveTo(point.X, point.Y, false, false, false); |
| | | Thread.Sleep(RandomUtils.G(500, 800)); |
| | | |
| | | Move(0, 0, true, false, false); |
| | | Thread.Sleep(RandomUtils.MouseClickDuration); |
| | | Move(0, 0, false, false, false); |
| | | Thread.Sleep(RandomUtils.MouseClickDuration); |
| | | |
| | | Move(0, 0, true, false, false); |
| | | Thread.Sleep(RandomUtils.MouseClickDuration); |
| | | Move(0, 0, false, false, false); |
| | | Thread.Sleep(RandomUtils.MouseClickDuration); |
| | | } |
| | | #endregion |
| | | |
| | | #region 键盘 |
| | |
| | | <DefineConstants>TRACE</DefineConstants> |
| | | <ErrorReport>prompt</ErrorReport> |
| | | <WarningLevel>4</WarningLevel> |
| | | <AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
| | | </PropertyGroup> |
| | | <ItemGroup> |
| | | <Reference Include="Emgu.CV.UI, Version=4.1.0.3420, Culture=neutral, PublicKeyToken=7281126722ab4438, processorArchitecture=MSIL"> |
| | |
| | | <Compile Include="Captures\ICapture.cs" /> |
| | | <Compile Include="Captures\ScreenCapture.cs" /> |
| | | <Compile Include="CV\CVHelper.cs" /> |
| | | <Compile Include="CV\ChannelCVHelper.cs" /> |
| | | <Compile Include="CV\GroupCVHelper.cs" /> |
| | | <Compile Include="CV\SkillCVHelper.cs" /> |
| | | <Compile Include="CV\DnfCVHelper.cs" /> |
| | |
| | | <Grid.RowDefinitions> |
| | | <RowDefinition Height="48" /> |
| | | <RowDefinition Height="48" /> |
| | | <RowDefinition Height="48" /> |
| | | <RowDefinition Height="Auto" /> |
| | | <RowDefinition Height="48" /> |
| | | <RowDefinition Height="48" /> |
| | |
| | | <ColumnDefinition Width="*" /> |
| | | </Grid.ColumnDefinitions> |
| | | |
| | | |
| | | |
| | | <Border Grid.Row="0" Grid.Column="0" Style="{StaticResource RowBorderStyle}" > |
| | | <TextBlock Text="是否组队:" Style="{StaticResource TextHeaderStyle}" /> |
| | | </Border> |
| | | <Border Grid.Row="0" Grid.Column="1" Style="{StaticResource RowBorderStyle}" > |
| | | <CheckBox IsChecked="{Binding IsGroup}" VerticalAlignment="Center" /> |
| | | </Border> |
| | | |
| | | |
| | | |
| | | <Border Grid.Row="1" Grid.Column="0" Style="{StaticResource RowBorderStyle}" > |
| | | <TextBlock Text="WeGame路径:" Style="{StaticResource TextHeaderStyle}" /> |
| | | </Border> |
| | | |
| | | <Border Grid.Row="0" Grid.Column="1" Style="{StaticResource RowBorderStyle}" > |
| | | <Border Grid.Row="1" Grid.Column="1" Style="{StaticResource RowBorderStyle}" > |
| | | <StackPanel Orientation="Horizontal" VerticalAlignment="Stretch" > |
| | | <TextBox Width="300" Text="{Binding TGPDaemonPath}" IsReadOnly="True" VerticalContentAlignment="Center" /> |
| | | <Button Content="浏览" Padding="15 0 15 0" Margin="5" Click="BrowserGPDPath_Click" /> |
| | | </StackPanel> |
| | | </Border> |
| | | |
| | | <Border Grid.Row="1" Grid.Column="0" Style="{StaticResource RowBorderStyle}" > |
| | | |
| | | |
| | | <Border Grid.Row="2" Grid.Column="0" Style="{StaticResource RowBorderStyle}" > |
| | | <TextBlock Text="游戏启动等待时长:" Style="{StaticResource TextHeaderStyle}" /> |
| | | </Border> |
| | | |
| | | <Border Grid.Row="1" Grid.Column="1" Style="{StaticResource RowBorderStyle}" > |
| | | <Border Grid.Row="2" Grid.Column="1" Style="{StaticResource RowBorderStyle}" > |
| | | <StackPanel Orientation="Horizontal" VerticalAlignment="Stretch" > |
| | | <TextBox Width="300" Text="{Binding StartWaitSecond}" VerticalContentAlignment="Center" /> |
| | | <TextBlock Text="秒" VerticalAlignment="Center" /> |
| | | </StackPanel> |
| | | </Border> |
| | | |
| | | |
| | | |
| | | |
| | | <Border Grid.Row="2" Grid.Column="0" Style="{StaticResource RowBorderStyle}"> |
| | | <Border Grid.Row="3" Grid.Column="0" Style="{StaticResource RowBorderStyle}"> |
| | | <TextBlock Grid.Column="0" Text="游戏帐号:" Style="{StaticResource TextHeaderStyle}" /> |
| | | </Border> |
| | | <Border Grid.Row="2" Grid.Column="1" Style="{StaticResource RowBorderStyle}"> |
| | | <Border Grid.Row="3" Grid.Column="1" Style="{StaticResource RowBorderStyle}"> |
| | | <Grid > |
| | | <Grid.ColumnDefinitions> |
| | | <ColumnDefinition Width="120" /> |
| | |
| | | </Border> |
| | | |
| | | |
| | | <Border Grid.Row="3" Grid.Column="0" Style="{StaticResource RowBorderStyle}"> |
| | | |
| | | <Border Grid.Row="4" Grid.Column="0" Style="{StaticResource RowBorderStyle}"> |
| | | <TextBlock Text="运行状态:" Style="{StaticResource TextHeaderStyle}" /> |
| | | </Border> |
| | | <Border Grid.Row="3" Grid.Column="1" Style="{StaticResource RowBorderStyle}"> |
| | | <Border Grid.Row="4" Grid.Column="1" Style="{StaticResource RowBorderStyle}"> |
| | | <Grid> |
| | | <Grid.ColumnDefinitions> |
| | | <ColumnDefinition Width="120" /> |
| | |
| | | |
| | | </Border> |
| | | |
| | | <Border Grid.Row="4" Grid.Column="0" Style="{StaticResource RowBorderStyle}"> |
| | | |
| | | <Border Grid.Row="5" Grid.Column="0" Style="{StaticResource RowBorderStyle}"> |
| | | <TextBlock Text="是否微信通知:" Style="{StaticResource TextHeaderStyle}" /> |
| | | </Border> |
| | | <Border Grid.Row="4" Grid.Column="1" Style="{StaticResource RowBorderStyle}"> |
| | | <Border Grid.Row="5" Grid.Column="1" Style="{StaticResource RowBorderStyle}"> |
| | | <CheckBox IsChecked="{Binding NotificationWechat}" VerticalAlignment="Center" /> |
| | | </Border> |
| | | |
| | | |
| | | <StackPanel Grid.Row="6" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right"> |
| | | <StackPanel Grid.Row="7" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right"> |
| | | <Button Content="保存" Padding="15 0 15 0" Margin="5" Click="ConfigSave_Click" /> |
| | | </StackPanel> |
| | | </Grid> |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Threading; |
| | | using static RichCreator.Utility.CV.GroupCVHelper; |
| | | using RichCreator.StateMachines; |
| | | |
| | | namespace RichCreator.Maps |
| | | { |
| | |
| | | |
| | | public CancellationToken cancellationToken { get; set; } |
| | | |
| | | private const bool isCreateGroup = false; |
| | | private const bool isCreateGroup = true; |
| | | |
| | | public override bool Start(ZTRectangle gameRect, CancellationToken cancelToken, Int32 runningStep) |
| | | { |
| | |
| | | this.cancellationToken = cancelToken; |
| | | |
| | | WindowUtils.SetDnfToTop(); |
| | | |
| | | |
| | | ChannelStateMachine csm = new ChannelStateMachine(); |
| | | ZTResult workResult = csm.Work(this.GameRect, true, cancelToken, 5 * 60 * 1000); |
| | | if (workResult != ZTResult.Success) |
| | | { |
| | | G.Instance.InfoWriter("切换频道没有成功,"+workResult); |
| | | Thread.Sleep(5 * 60 * 1000); |
| | | return false; |
| | | } |
| | | G.Instance.InfoWriter("切换频道成功,开始组队逻辑"); |
| | | |
| | | string groupName = "aabbccddee"; |
| | | if (isCreateGroup) |
| | | { |
| | |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | //沉默一段时间 |
| | | Thread.Sleep(50000000); |
| | | CloseAllAlertWindow(this.cancellationToken, this.GameRect); |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 切换频道 |
| | | /// </summary> |
| | | /// <param name="channelItem"></param> |
| | | /// <returns></returns> |
| | | private bool ChangeChannel(ChannelItem channelItem) |
| | | { |
| | | |
| | | return true; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 创建队伍 |
| | | /// 创建队伍 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | private bool CreateGroup(string groupName) |
| | |
| | | }); |
| | | if (result) |
| | | { |
| | | G.Instance.InfoWriter("group ok"); |
| | | return true; |
| | | G.Instance.InfoWriter("create group ok"); |
| | | //点击组队“确定”按钮 |
| | | result = FuncUtils.TimeoutCancelableWrap(15 * 60 * 1000,this.cancellationToken, () => { |
| | | ZTPoint yes = ZTPoint.Empty; |
| | | ZTPoint no = ZTPoint.Empty; |
| | | bool retFind = GroupCVHelper.FindYaoqingZuduiWindow(out yes, out no, this.GameRect); |
| | | if (retFind) |
| | | { |
| | | G.Instance.InputControl.MoveToAndClick(yes); |
| | | G.Instance.InfoWriter("other join group ok:"+yes); |
| | | } |
| | | return retFind; |
| | | }); |
| | | |
| | | |
| | | return result; |
| | | } |
| | | return false; |
| | | } |
| | |
| | | G.Instance.InfoWriter("group item not finded"); |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | //点组名打开窗口 |
| | | G.Instance.InputControl.MoveToAndClick(groupItemRect.GetCenterPoint()); |
| | | |
| | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 打开技能窗 |
| | | /// 打开组队窗 |
| | | /// </summary> |
| | | /// <param name="titleRect"></param> |
| | | /// <param name="lvRect"></param> |
| | |
| | | G.Instance.InfoWriter("打开创建队伍信息对话框失败"); |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 关闭所有弹出窗 |
| | | /// </summary> |
| | |
| | | Thread.Sleep(500); |
| | | } |
| | | } |
| | | //private bool InitSkills() |
| | | //{ |
| | | // //点击初始化 |
| | | // ZTPoint initButton = new ZTPoint(this.upKeyRect.Start.X - 37, this.upKeyRect.Start.Y - 86); |
| | | // G.Instance.InputControl.MoveToAndClick(initButton); |
| | | |
| | | // //是否已打开确认对话框 |
| | | // ZTRectangle notificationRect = ZTRectangle.Empty; |
| | | // bool result = FuncUtils.TimeoutCancelableWrap(3000, this.cancellationToken, () => { |
| | | // return SkillCVHelper.ExistsNotificationText(out notificationRect,this.GameRect); |
| | | // }); |
| | | // if (!result) |
| | | // { |
| | | // G.Instance.DebugWriter("公告未找到"); |
| | | // return false; |
| | | // } |
| | | // //点击确认 |
| | | // G.Instance.InputControl.Move(0, 0, true, false, false); |
| | | // Thread.Sleep(RandomUtils.MouseClickDuration); |
| | | // G.Instance.InputControl.Move(0, 0, false, false, false); |
| | | |
| | | // //是否已打开完毕对话框 |
| | | // result = FuncUtils.TimeoutCancelableWrap(3000, this.cancellationToken, () => { |
| | | // return SkillCVHelper.ExistsNotificationText(out notificationRect, this.GameRect); |
| | | // }); |
| | | // if (!result) |
| | | // { |
| | | // G.Instance.DebugWriter("完毕公告未找到"); |
| | | // return false; |
| | | // } |
| | | // //点击确认 |
| | | // ZTPoint okPosition = new ZTPoint(notificationRect.GetCenterPoint().X, notificationRect.End.Y + 70); |
| | | // G.Instance.InputControl.MoveToAndClick(okPosition); |
| | | // Thread.Sleep(RandomUtils.G(500,800)); |
| | | // return true; |
| | | //} |
| | | |
| | | |
| | | |
| | | ///// <summary> |
| | | ///// 设置顶端技能 |
| | | ///// </summary> |
| | | ///// <returns></returns> |
| | | //private bool SettingTopSkills() |
| | | //{ |
| | | // //物理暴击 |
| | | // ZTPoint skillPoint = new ZTPoint(lvRect.End.X + 200, lvRect.Start.Y - 42); |
| | | // SettingSkill(skillPoint); |
| | | |
| | | // //物理背击 |
| | | // skillPoint = new ZTPoint(lvRect.End.X + 280, lvRect.Start.Y - 42); |
| | | // SettingSkill(skillPoint); |
| | | // return true; |
| | | //} |
| | | |
| | | ///// <summary> |
| | | ///// 要点的技能列表 |
| | | ///// 内部为每个节所相对于节的相对位置 |
| | | ///// </summary> |
| | | //private List<ZTPoint>[] toAddLevelSkills = new List<ZTPoint>[] { |
| | | // new List<ZTPoint> (){ |
| | | // new ZTPoint(762-346,450-237),//疾风之棍棒精通 |
| | | // }, |
| | | // new List<ZTPoint> (){ |
| | | // new ZTPoint(182,17),//朔风牵引 |
| | | // new ZTPoint(274,17),//流风决 |
| | | // new ZTPoint(481-251,342-262),//风鸣冲击 |
| | | // new ZTPoint(323,82),//游离之风 |
| | | // new ZTPoint(574-251,409-262),//双翼风刃 |
| | | // new ZTPoint(574-251,477-262),//风暴之眼 |
| | | // new ZTPoint(529-251,544-262),//真空旋风破 |
| | | // }, |
| | | // new List<ZTPoint> (){ |
| | | // new ZTPoint(432-251,275-329),//风暴之拳 |
| | | // new ZTPoint(479-251,342-329),//万象风龙阵 |
| | | // new ZTPoint(572-251,340-329),//御风之力 |
| | | // new ZTPoint(433-251,478-329),//风神决 |
| | | // new ZTPoint(526-251,475-329),//风卷残云 |
| | | // new ZTPoint(574-251,476-329),//游龙惊风破 |
| | | // new ZTPoint(431-251,542-329),//九霄风雷 |
| | | // new ZTPoint(663-295,545-331),//无限风域 |
| | | // } |
| | | //}; |
| | | |
| | | ///// <summary> |
| | | ///// 设置SP技能 |
| | | ///// </summary> |
| | | ///// <returns></returns> |
| | | //private bool SettingSPSkills() |
| | | //{ |
| | | // //选中sp技能学习 |
| | | // ZTPoint spPoint = new ZTPoint(lvRect.End.X + 55, lvRect.Start.Y - 80); |
| | | // G.Instance.InputControl.MoveToAndClick(spPoint); |
| | | |
| | | // ZTRectangle numberLimitArea = new ZTRectangle(lvRect.Start.X-5,lvRect.End.Y,lvRect.End.X+21,lvRect.End.Y+340); |
| | | // bool[] addedFlag = new bool[] {false,false,false }; |
| | | // bool isdown = true; |
| | | // for (int i = 0; i < 4; i++) |
| | | // { |
| | | // for (int count = 0; count < 10; count++) |
| | | // { |
| | | // if (this.cancellationToken.IsCancellationRequested) |
| | | // { |
| | | // return false; |
| | | // } |
| | | |
| | | // //是否有数字 |
| | | // bool result = FuncUtils.TimeoutCancelableWrap(1000, this.cancellationToken, () => { |
| | | // return SkillCVHelper.HasNumberText(numberLimitArea); |
| | | // }, 100); |
| | | // if (!result) |
| | | // { |
| | | // continue; |
| | | // } |
| | | |
| | | // //查找是否是某节, |
| | | // Int32 numberSection = 0; |
| | | // ZTRectangle sectionRect = ZTRectangle.Empty; |
| | | // if (SkillCVHelper.IsNumberSections(out numberSection, out sectionRect, numberLimitArea)) |
| | | // { |
| | | // if (!addedFlag[numberSection]) |
| | | // { |
| | | // //没有添加,则循环把此节下的所有技能都加上 |
| | | // foreach (var item in toAddLevelSkills[numberSection]) |
| | | // { |
| | | // SettingSkill(sectionRect.Start.Add(item)); |
| | | // } |
| | | // addedFlag[numberSection] = true; |
| | | // } |
| | | |
| | | // if (count == 0) |
| | | // { |
| | | // if (numberSection == 0) |
| | | // { |
| | | // //一开始是1区则向下 |
| | | // isdown = true; |
| | | // } |
| | | // if (numberSection == 2) |
| | | // { |
| | | // //一开始是3区则向上 |
| | | // isdown = false; |
| | | // } |
| | | |
| | | // } |
| | | // } |
| | | |
| | | |
| | | // if (isdown) |
| | | // { |
| | | // G.Instance.InputControl.MoveToAndClick(downKeyRect.GetCenterPoint()); |
| | | // } |
| | | // else |
| | | // { |
| | | // G.Instance.InputControl.MoveToAndClick(upKeyRect.GetCenterPoint()); |
| | | // } |
| | | // } |
| | | |
| | | // if (addedFlag[0] == true && addedFlag[1] == true && addedFlag[2] == true) |
| | | // { |
| | | // return true; |
| | | // } |
| | | // isdown = !isdown; |
| | | // } |
| | | |
| | | // return false; |
| | | //} |
| | | |
| | | ///// <summary> |
| | | ///// 设置TP技能 |
| | | ///// </summary> |
| | | ///// <returns></returns> |
| | | //private bool SettingTPSkills() |
| | | //{ |
| | | // //选中tp技能学习 |
| | | // ZTPoint spPoint = new ZTPoint(lvRect.End.X + 253, lvRect.Start.Y - 80); |
| | | // G.Instance.InputControl.MoveToAndClick(spPoint); |
| | | |
| | | // ZTPoint[] skills = new ZTPoint[] { |
| | | |
| | | // new ZTPoint(334-296,277-251),//1.第一行第一个 |
| | | // new ZTPoint(381-296,545-251),//2.第三行第二个 |
| | | // new ZTPoint(664-296,413-251),//3.第二行倒数第三个 |
| | | // new ZTPoint(567-296,410-251),//4.第二行倒数第五个 |
| | | // new ZTPoint(758-296,411-251),//5.第二行倒数第一个 |
| | | // }; |
| | | |
| | | // for (int i = 0; i < skills.Length; i++) |
| | | // { |
| | | // SettingSkill(lvRect.Start.Add(skills[i])); |
| | | // } |
| | | |
| | | // return true; |
| | | //} |
| | | |
| | | ///// <summary> |
| | | ///// 学习 |
| | | ///// </summary> |
| | | ///// <returns></returns> |
| | | //private bool Studay() |
| | | //{ |
| | | // ZTPoint studayPoint = new ZTPoint(this.downKeyRect.Start.X-331,this.downKeyRect.End.Y+27); |
| | | // G.Instance.InputControl.MoveToAndClick(studayPoint); |
| | | // Thread.Sleep(1000); |
| | | // //点击确认 |
| | | // G.Instance.InputControl.Move(0, 0, true, false, false); |
| | | // Thread.Sleep(RandomUtils.MouseClickDuration); |
| | | // G.Instance.InputControl.Move(0, 0, false, false, false); |
| | | // Thread.Sleep(RandomUtils.MouseClickDuration*3); |
| | | // return true; |
| | | //} |
| | | |
| | | ///// <summary> |
| | | ///// 设置技能 |
| | | ///// </summary> |
| | | ///// <param name="skillPoint"></param> |
| | | ///// <returns></returns> |
| | | //private bool SettingSkill(ZTPoint skillPoint) |
| | | //{ |
| | | // //84,71 |
| | | // ZTRectangle limitRect = new ZTRectangle(skillPoint.X-84,skillPoint.Y-71,skillPoint.X+84,skillPoint.Y+71); |
| | | |
| | | // bool result = false; |
| | | // ZTRectangle addSkillLevelButton = ZTRectangle.Empty; |
| | | |
| | | // //选中技能,试两次 |
| | | // int addTry = 0; |
| | | // for (; addTry < 2; addTry++) |
| | | // { |
| | | // bool skillIsFull = false; |
| | | // G.Instance.InputControl.MoveToAndClick(skillPoint); |
| | | // Thread.Sleep(500); |
| | | // result = FuncUtils.TimeoutCancelableWrap(3000, this.cancellationToken, () => { |
| | | // return SkillCVHelper.IsSelectSkill(out addSkillLevelButton, out skillIsFull, limitRect); |
| | | // }); |
| | | // if (result) |
| | | // { |
| | | // if (skillIsFull) |
| | | // { |
| | | // return true; |
| | | // } |
| | | // break; |
| | | // } |
| | | // } |
| | | // if (addTry >= 2) |
| | | // { |
| | | // return false; |
| | | // } |
| | | |
| | | |
| | | // //加技能点,试两次 |
| | | // for (addTry = 0; addTry < 2; addTry++) |
| | | // { |
| | | // G.Instance.InputControl.MoveToAndClick(addSkillLevelButton.GetCenterPoint()); |
| | | // result = FuncUtils.TimeoutCancelableWrap(3000, this.cancellationToken, () => { |
| | | // return SkillCVHelper.SkillIsFullLevel(limitRect); |
| | | // }); |
| | | // if (result) |
| | | // { |
| | | // return true; |
| | | // } |
| | | // } |
| | | |
| | | |
| | | // return false; |
| | | //} |
| | | |
| | | ///// <summary> |
| | | ///// 格式化摆放技能栏 |
| | | ///// </summary> |
| | | ///// <returns></returns> |
| | | //private bool FormatSkillColumn() |
| | | //{ |
| | | // //打开已学技能窗 |
| | | // ZTRectangle studayTextRect = ZTRectangle.Empty; |
| | | // if (!OpenStudaySkillWindow(out studayTextRect)) |
| | | // { |
| | | // G.Instance.DebugWriter("未指开已学技能窗口"); |
| | | // return false; |
| | | // } |
| | | |
| | | // //技能栏全部技能移动已学技能窗 |
| | | // if (!MoveSkillToStudayWindow(studayTextRect)) |
| | | // { |
| | | // G.Instance.DebugWriter("移动至已学技能窗口失败"); |
| | | // return false; |
| | | // } |
| | | |
| | | // //技能窗内容分步移 |
| | | // if (!MoveSkillToExpress(studayTextRect)) |
| | | // { |
| | | // G.Instance.DebugWriter("移动至快捷栏失败"); |
| | | // return false; |
| | | // } |
| | | // return true; |
| | | //} |
| | | |
| | | ///// <summary> |
| | | ///// 打开已学技能窗口 |
| | | ///// </summary> |
| | | ///// <returns></returns> |
| | | //private bool OpenStudaySkillWindow(out ZTRectangle studayTextRect) |
| | | //{ |
| | | // studayTextRect = ZTRectangle.Empty; |
| | | // ZTRectangle innerstudyTextRect = ZTRectangle.Empty; |
| | | // ZTPoint openwindowButton = new ZTPoint(this.titleRect.Start.X + 194, this.titleRect.Start.Y + 517); |
| | | // for (int i = 0; i < 2; i++) |
| | | // { |
| | | // if (this.cancellationToken.IsCancellationRequested) |
| | | // { |
| | | // return false; |
| | | // } |
| | | // G.Instance.InputControl.MoveToAndClick(openwindowButton); |
| | | // bool result = FuncUtils.TimeoutCancelableWrap(3000, this.cancellationToken, () => { |
| | | // return SkillCVHelper.StudaySkillWindowIsOpen(out innerstudyTextRect,this.GameRect); |
| | | // }, 200); |
| | | |
| | | // if (result) |
| | | // { |
| | | // studayTextRect = innerstudyTextRect; |
| | | // return true; |
| | | // } |
| | | // } |
| | | // return false; |
| | | //} |
| | | |
| | | ///// <summary> |
| | | ///// 从快捷栏向已学技能栏移动技能 |
| | | ///// </summary> |
| | | ///// <returns></returns> |
| | | //private bool MoveSkillToStudayWindow(ZTRectangle studayTextRect) |
| | | //{ |
| | | // ZTRectangle targetRect = GetStudaySkillRect(studayTextRect, 27); |
| | | |
| | | // for (int i = 0; i < 12; i++) |
| | | // { |
| | | // ZTRectangle expressRect = GetExpressSkillRect(i); |
| | | // MoveSkill(expressRect.GetCenterPoint(), targetRect.GetCenterPoint()); |
| | | // } |
| | | // return true; |
| | | //} |
| | | |
| | | |
| | | ///// <summary> |
| | | ///// 识别出来的技能索引和在技能快捷栏中的对应关系 |
| | | ///// 对应关系是-1的不放在快捷栏里 |
| | | ///// </summary> |
| | | //Dictionary<Int32, Int32> skillToExpressMap = new Dictionary<int, int>() { |
| | | // { 4 ,0}, |
| | | // { 13,1}, |
| | | // { 8 ,2}, |
| | | // { 9 ,3}, |
| | | // { 15,4}, |
| | | // { 12,5}, |
| | | |
| | | // { 6 ,6}, |
| | | // { 10,7}, |
| | | // { 7 ,8}, |
| | | // { 11,9}, |
| | | // { 14,10}, |
| | | // { 16,11} |
| | | |
| | | //}; |
| | | ///// <summary> |
| | | ///// 从已学技能栏向快捷栏移动技能 |
| | | ///// </summary> |
| | | ///// <param name="studayTextRect"></param> |
| | | ///// <returns></returns> |
| | | //private bool MoveSkillToExpress(ZTRectangle studayTextRect) |
| | | //{ |
| | | // int i = 0; |
| | | // int count = 17; |
| | | // while (i < count) |
| | | // { |
| | | // if (this.cancellationToken.IsCancellationRequested) |
| | | // { |
| | | // return false; |
| | | // } |
| | | // //获取位置,并将鼠标移到位置,显示出技能名 |
| | | // ZTPoint studayPoint = GetStudaySkillRect(studayTextRect, i).GetCenterPoint(); |
| | | // G.Instance.InputControl.MoveTo(studayPoint.X, studayPoint.Y, false, false, false); |
| | | // Thread.Sleep(1000); |
| | | |
| | | // //识别 |
| | | // Int32 skillIndex = 0;//技能索引 |
| | | // ZTRectangle discenrnRect = new ZTRectangle(studayPoint.X - 150, this.GameRect.Start.Y, studayPoint.X, studayPoint.Y); |
| | | // bool result = FuncUtils.TimeoutCancelableWrap(2000, this.cancellationToken, () => { |
| | | // return SkillCVHelper.GetSkillName(out skillIndex, discenrnRect); |
| | | // }, 200); |
| | | // if (result) |
| | | // { |
| | | // if (skillToExpressMap.ContainsKey(skillIndex)) |
| | | // { |
| | | // //要放到技能栏的位置 |
| | | // ZTPoint to = GetExpressSkillRect(skillToExpressMap[skillIndex]).GetCenterPoint(); |
| | | // MoveSkill(studayPoint, to); |
| | | // count--; |
| | | // continue; |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // G.Instance.DebugWriter("识别技能错误,index=" + i.ToString()); |
| | | // } |
| | | // i++; |
| | | // } |
| | | |
| | | // return true; |
| | | //} |
| | | |
| | | |
| | | ///// <summary> |
| | | ///// 移动技能 |
| | | ///// </summary> |
| | | ///// <param name="from"></param> |
| | | ///// <param name="to"></param> |
| | | ///// <returns></returns> |
| | | //private bool MoveSkill(ZTPoint from, ZTPoint to) |
| | | //{ |
| | | // //移动指定位置 |
| | | // G.Instance.InputControl.MoveTo(from.X, from.Y, false, false, false); |
| | | // Thread.Sleep(RandomUtils.MouseClickDuration*2); |
| | | |
| | | // //按下 |
| | | // G.Instance.InputControl.Move(0, 0, true, false, false); |
| | | // Thread.Sleep(RandomUtils.MouseClickDuration * 3); |
| | | |
| | | // //移到目标位置 |
| | | // G.Instance.InputControl.MoveTo(to.X, to.Y, true, false, false); |
| | | // Thread.Sleep(RandomUtils.MouseClickDuration*2); |
| | | |
| | | |
| | | // //松开 |
| | | // G.Instance.InputControl.Move(0, 0, false, false, false); |
| | | // Thread.Sleep(RandomUtils.MouseClickDuration * 2); |
| | | // return true; |
| | | //} |
| | | |
| | | ///// <summary> |
| | | ///// 得到快捷栏技能定位 |
| | | ///// </summary> |
| | | ///// <param name="index"></param> |
| | | ///// <returns></returns> |
| | | //private ZTRectangle GetExpressSkillRect(int index) |
| | | //{ |
| | | // //x209,y488 |
| | | // Int32 row = index / 6; |
| | | // Int32 col = index % 6; |
| | | |
| | | // int x = this.titleRect.Start.X + 209 + col * 33; |
| | | // int y = this.titleRect.Start.Y + 488 + row * 33; |
| | | |
| | | // return new ZTRectangle(x, y, x + 33, y + 33); |
| | | //} |
| | | |
| | | ///// <summary> |
| | | ///// 得到已学技能栏定位 |
| | | ///// </summary> |
| | | ///// <param name="studayTextRect"></param> |
| | | ///// <param name="index"></param> |
| | | ///// <returns></returns> |
| | | //private ZTRectangle GetStudaySkillRect(ZTRectangle studayTextRect, Int32 index) |
| | | //{ |
| | | // //x:-122,y:44 |
| | | // Int32 row = index / 7; |
| | | // Int32 col = index % 7; |
| | | |
| | | // int x = studayTextRect.Start.X + (-122) + col * 31; |
| | | // int y = studayTextRect.Start.Y + 44 + row * 31; |
| | | |
| | | // return new ZTRectangle(x, y, x + 31, y + 31); |
| | | //} |
| | | |
| | | } |
| | | } |
| | |
| | | public class RichCreatorConfig |
| | | { |
| | | /// <summary> |
| | | /// 是否组队 |
| | | /// </summary> |
| | | public bool IsGroup { get; set; } |
| | | |
| | | /// <summary> |
| | | /// tgp_daemon路径 |
| | | /// </summary> |
| | | public string TGPDaemonPath { get; set; } |
| | |
| | | <DefineConstants>TRACE</DefineConstants> |
| | | <ErrorReport>prompt</ErrorReport> |
| | | <WarningLevel>4</WarningLevel> |
| | | <AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
| | | </PropertyGroup> |
| | | <PropertyGroup> |
| | | <ApplicationIcon>program.ico</ApplicationIcon> |
| | |
| | | <Compile Include="PathFinding\Edge.cs" /> |
| | | <Compile Include="PathFinding\Node.cs" /> |
| | | <Compile Include="Services\ServiceMonitor.cs" /> |
| | | <Compile Include="StateMachines\ChannelStateMachine.cs" /> |
| | | <Compile Include="Utilitys\FuncUtils.cs" /> |
| | | <Compile Include="G.cs" /> |
| | | <Compile Include="Jobs\DNFJob.cs" /> |
| | |
| | | <Compile Include="Utilitys\Utils.cs" /> |
| | | <Compile Include="ViewModels\ConfigViewModel.cs" /> |
| | | <Compile Include="ViewModels\NotificationObject.cs" /> |
| | | <Compile Include="ZTResult.cs" /> |
| | | <Page Include="MainWindow.xaml"> |
| | | <Generator>MSBuild:Compile</Generator> |
| | | <SubType>Designer</SubType> |
| New file |
| | |
| | | using Emgu.CV; |
| | | using Emgu.CV.Structure; |
| | | using RichCreator.Utility.Captures; |
| | | using RichCreator.Utility.CV; |
| | | 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.StateMachines |
| | | { |
| | | /// <summary> |
| | | /// 频道状态机 |
| | | /// </summary> |
| | | public class ChannelStateMachine |
| | | { |
| | | //默认状态 |
| | | private ChannelStates currentState = ChannelStates.Start; |
| | | |
| | | |
| | | //频道选择文字的位置 |
| | | private ZTRectangle channelChoiceTextRect = ZTRectangle.Empty; |
| | | |
| | | |
| | | //目前仅支持寂静城 |
| | | private const Int32 channelIndex = 1;//0:时空之门,1:寂静城 |
| | | |
| | | //频道距离“频道选择文字”的偏移 |
| | | private static ZTPoint[] channelOffsets = new ZTPoint[] { |
| | | new ZTPoint(-279,246), |
| | | new ZTPoint(-279,291) |
| | | }; |
| | | |
| | | /// <summary> |
| | | /// 开始工作 |
| | | /// </summary> |
| | | public ZTResult Work(ZTRectangle gameRect,bool isGroupMode,CancellationToken cancelToken,Int64 timeoutMillSecond) |
| | | { |
| | | if (timeoutMillSecond <= 0) |
| | | { |
| | | throw new ArgumentOutOfRangeException("过期时间不能小于等于0"); |
| | | } |
| | | DateTime timeoutTime = DateTime.Now.AddMilliseconds(timeoutMillSecond); |
| | | |
| | | while (true) |
| | | { |
| | | G.Instance.InfoWriter("states:" + currentState.ToString()); |
| | | if (currentState == ChannelStates.Complete) |
| | | { |
| | | //完成 |
| | | break; |
| | | } |
| | | |
| | | |
| | | if (cancelToken.IsCancellationRequested) |
| | | { |
| | | //取消 |
| | | return ZTResult.Cancel; |
| | | } |
| | | |
| | | if (DateTime.Now > timeoutTime) |
| | | { |
| | | //超时 |
| | | return ZTResult.Timeout; |
| | | } |
| | | |
| | | switch (currentState) |
| | | { |
| | | case ChannelStates.Start: |
| | | //开始 |
| | | currentState = ChannelStates.CheckSailiyaHouse; |
| | | break; |
| | | case ChannelStates.CheckSailiyaHouse: |
| | | //检测是否赛丽亚的房间 |
| | | if (DnfCVHelper.IsInSaiLiYaHouse(gameRect)) |
| | | { |
| | | //检测是否组队模式 |
| | | currentState = ChannelStates.CheckGroupMode; |
| | | } |
| | | else |
| | | { |
| | | currentState = ChannelStates.IsChoiceRolePage; |
| | | } |
| | | break; |
| | | case ChannelStates.IsChoiceRolePage: |
| | | //检测是否角色选择界面 |
| | | ZTRectangle startGameButtonRect = ZTRectangle.Empty; |
| | | if (DnfCVHelper.IsSelectRoleWindow(out startGameButtonRect)) |
| | | { |
| | | currentState = ChannelStates.ConfirmAutoChange; |
| | | } |
| | | else |
| | | { |
| | | currentState = ChannelStates.CheckSailiyaHouse; |
| | | Thread.Sleep(1000); |
| | | } |
| | | break; |
| | | |
| | | case ChannelStates.ConfirmAutoChange: |
| | | //查找“确认”按钮并点击,并等待2秒 |
| | | ZTRectangle confirmButtonRect = ZTRectangle.Empty; |
| | | if (ChannelCVHelper.HasConnectionErrorInChoiceRole(out confirmButtonRect)) |
| | | { |
| | | G.Instance.InputControl.MoveToAndClick(confirmButtonRect.GetCenterPoint()); |
| | | } |
| | | currentState = ChannelStates.CheckSailiyaHouse; |
| | | Thread.Sleep(2000); |
| | | break; |
| | | case ChannelStates.CheckGroupMode: |
| | | //是否组队模式 |
| | | if (isGroupMode) |
| | | { |
| | | currentState = ChannelStates.CheckChannel; |
| | | } |
| | | else |
| | | { |
| | | currentState = ChannelStates.CheckConnectIsValid; |
| | | } |
| | | break; |
| | | case ChannelStates.CheckConnectIsValid: |
| | | //是否有效网络连接 |
| | | ZTPoint validButtonPoint = ZTPoint.Empty; |
| | | if (ChannelCVHelper.HasConnectIsVaildWindow(out validButtonPoint, gameRect)) |
| | | { |
| | | G.Instance.InputControl.MoveToAndClick(validButtonPoint); |
| | | currentState = ChannelStates.ChangeChannelPageIsOpen; |
| | | Thread.Sleep(2000); |
| | | |
| | | } |
| | | else |
| | | { |
| | | currentState = ChannelStates.CloseAllWindow; |
| | | } |
| | | break; |
| | | case ChannelStates.CheckChannel: |
| | | //是否指定频道 |
| | | if (ChannelCVHelper.IsInJijingchengChannel(gameRect)) |
| | | { |
| | | currentState = ChannelStates.CheckConnectIsValid; |
| | | } |
| | | else |
| | | { |
| | | currentState = ChannelStates.ChangeChannelPageIsOpen; |
| | | } |
| | | break; |
| | | case ChannelStates.ChangeChannelPageIsOpen: |
| | | //切换频道界面是否打开 |
| | | if (ChannelCVHelper.IsOpenChannelChoiceWindow(out channelChoiceTextRect, gameRect)) |
| | | { |
| | | currentState = ChannelStates.ChangeChannel; |
| | | } |
| | | else |
| | | { |
| | | currentState = ChannelStates.OpenChangeChannelPage; |
| | | } |
| | | break; |
| | | case ChannelStates.ChangeChannel: |
| | | //双击切换频道,等待两秒 |
| | | ZTPoint textCenterPoint = channelChoiceTextRect.GetCenterPoint(); |
| | | ZTPoint clickPoint = textCenterPoint.Add(channelOffsets[channelIndex]); |
| | | G.Instance.InputControl.MoveToAndDClick(clickPoint); |
| | | Thread.Sleep(2000); |
| | | currentState = ChannelStates.CheckSailiyaHouse; |
| | | break; |
| | | case ChannelStates.OpenChangeChannelPage: |
| | | //打开切换频道界面 |
| | | G.Instance.InputControl.MoveToAndClick(new ZTPoint(gameRect.End.X - 136, gameRect.Start.Y + 9)); |
| | | Thread.Sleep(2000); |
| | | currentState = ChannelStates.ChangeChannelPageIsOpen; |
| | | break; |
| | | case ChannelStates.CloseAllWindow: |
| | | //关闭所有窗口 |
| | | CloseAllAlertWindow(cancelToken,gameRect); |
| | | currentState = ChannelStates.Complete; |
| | | break; |
| | | default: |
| | | return ZTResult.Failed; |
| | | } |
| | | } |
| | | |
| | | return ZTResult.Success; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 关闭所有弹出窗 |
| | | /// </summary> |
| | | /// <param name="cancelToken"></param> |
| | | /// <param name="gameRect"></param> |
| | | /// <returns></returns> |
| | | private bool CloseAllAlertWindow(CancellationToken cancelToken, ZTRectangle gameRect) |
| | | { |
| | | while (!cancelToken.IsCancellationRequested) |
| | | { |
| | | G.Instance.InputControl.MoveTo(0, 0, false, false, false); |
| | | Thread.Sleep(10); |
| | | //截图 |
| | | System.Drawing.Bitmap bitmap = ScreenCapture.Instance.CaptureScreen(); |
| | | Image<Rgb, byte> image = new Image<Rgb, byte>(bitmap); |
| | | |
| | | ZTRectangle closeButtonRect = ZTRectangle.Empty; |
| | | if (!DnfCVHelper.GetAlertWindow(out closeButtonRect, image, gameRect)) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | G.Instance.InputControl.MoveToAndClick(closeButtonRect.GetCenterPoint()); |
| | | Thread.Sleep(500); |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 频道状态 |
| | | /// </summary> |
| | | public enum ChannelStates |
| | | { |
| | | Start,//开始 |
| | | CheckSailiyaHouse,//检测是否赛丽亚的房间 |
| | | IsChoiceRolePage,//检测是否角色选择界面 |
| | | ConfirmAutoChange,//查找“确认”按钮并点击 |
| | | CheckGroupMode,//是否组队模式 |
| | | CheckConnectIsValid,//是否有效网络连接 |
| | | CheckChannel,//是否指定频道 |
| | | ChangeChannelPageIsOpen,//切换频道界面是否打开 |
| | | ChangeChannel,//双击切换频道,等待两秒 |
| | | OpenChangeChannelPage,//打开切换频道界面 |
| | | CloseAllWindow,//关闭所有窗口 |
| | | Complete//完成 |
| | | } |
| | | } |
| | | } |
| | |
| | | private RunningModel runModel; |
| | | |
| | | |
| | | |
| | | public bool IsGroup |
| | | { |
| | | get |
| | | { |
| | | return config.IsGroup; |
| | | } |
| | | set |
| | | { |
| | | if (config.IsGroup != value) |
| | | { |
| | | config.IsGroup = value; |
| | | this.RaisePropertyChanged("IsGroup"); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | public string TGPDaemonPath |
| | | { |
| | | get |
| New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace RichCreator |
| | | { |
| | | //结果 |
| | | public enum ZTResult:Int32 |
| | | { |
| | | Failed=0,//失败 |
| | | Success=1,//成功 |
| | | Timeout=2,//超时 |
| | | Cancel=3//取消 |
| | | |
| | | } |
| | | } |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <RichCreatorConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> |
| | | <IsGroup>true</IsGroup> |
| | | <TGPDaemonPath>D:\programs\WeGame\tgp_daemon.exe</TGPDaemonPath> |
| | | <StartWaitSecond>300</StartWaitSecond> |
| | | <RoleCount>10</RoleCount> |