Ejemplo n.º 1
0
        /// <summary>
        /// 检查toolName是否存在
        /// </summary>
        /// <param name="toolName"></param>
        /// <returns></returns>
        public bool CheckToolsStatus(string toolName)
        {
            //移动鼠标到边上
            MoveToConer();
            string subPic = Singleton.GetInstance().PicRootDir + "tools\\" + toolName + ".png";

            if (!File.Exists(subPic))
            {
                log.Error("不存在路径" + subPic);
                return(false);
            }
            Bitmap       bm   = PicUtil.GetScreen(CenterPoint.X + 200, CenterPoint.Y + 40, 120, 200);
            List <Point> list = PicCorFinder.FindPicture(subPic, bm, Rectangle.Empty, 2);

            //没有被找到
            if (list.Count == 0)
            {
                return(false);
            }
            else
            {
                Point p1 = Singleton.GetInstance().dicWindows[WindowNum].Point;
                WindowAPI.MMouseMoveTo(0, p1.X + 540, p1.Y - 170);
                return(true);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取所需用时
        /// </summary>
        /// <param name="cityName"></param>
        /// <returns></returns>
        public int GetWalkSeconds(string cityName)
        {
            WindowAPI.MMouseMoveTo(0, 0, 0);
            Point  p1 = Singleton.GetInstance().dicWindows[WindowNum].Point;
            Bitmap bm = PicUtil.GetScreen(p1.X, p1.Y - 480, 640, 480);
            //数点的个数,100px与等于15秒,ZZ100px约等于10点,1个点的时间2.3倍
            //平均每个点为3.5/XS
            City city = new City()
            {
                CityName       = cityName,
                MapMaxGameCoor = new GameCoordinate(191, 119),
                MapSize        = new int[2] {
                    441, 276
                }
            };
            List <Point> list = PicCorFinder.FindPicture(Singleton.GetInstance().PicRootDir + "wp.png", bm, Rectangle.Empty, 2, 0.9, true);

            //额外加出3个点,防止几类情况 1、最后个棋子的挡住1个+自己一个2、大红点挡住一个
            return((int)((list.Count + 3) * 3.5 / city.XS));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 检查Dialog打开状态
        /// </summary>
        /// <param name="dialogName"></param>
        /// <returns></returns>
        public bool CheckDialogStatus(string dialogName)
        {
            //移动鼠标到边上
            MoveToConer();
            string subPic = Singleton.GetInstance().PicRootDir + "dialog\\" + dialogName + ".png";

            if (!File.Exists(subPic))
            {
                log.Error("不存在路径" + subPic);
                return(false);
            }
            Bitmap       bm   = PicUtil.GetScreen(CenterPoint.X, CenterPoint.Y - 240, 320, 240);
            List <Point> list = PicCorFinder.FindPicture(subPic, bm, Rectangle.Empty, 2);

            //没有被找到
            if (list.Count == 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }