コード例 #1
0
        public FunctionCall ifcolor(string arg_txt)
        {
            string[]     args          = arg_txt.Split(',');
            int          X             = Int32.Parse(args[0]);
            int          Y             = Int32.Parse(args[1]);
            ColorChecker color_checker = ColorRule.Parse(args[2]);
            string       file_path     = (args.Length > 3 ? args[3] : null);

            return(delegate()
            {
                if (color_checker(screen_capturer.GetColorOfPx(X + script.XRef,
                                                               Y + script.YRef)))
                {
                    return ExecFileBreakable(file_path);
                }
                return FunctionResult.Continue;
            });
        }
コード例 #2
0
        public FunctionCall waitforpx(string arg_txt)
        {
            string[]        args          = arg_txt.Split(',');
            int             x             = Int32.Parse(args[0]);
            int             y             = Int32.Parse(args[1]);
            ColorChecker    color_checker = ColorRule.Parse(args[2]);
            NumberGenerator timeout_ms    = (args.Length > 3 ? NumberGenerator.Parse(args[3]) : new StaticNumber(0));
            string          file_path     = (args.Length > 4 ? args[4] : null);

            return(delegate()
            {
                if (!screen_color_detector.WaitForPx(new Point(x + script.XRef, y + script.YRef),
                                                     color_checker, timeout_ms.GetInt()))
                {
                    // timed out
                    return ExecFileBreakable(file_path);
                }
                return FunctionResult.Continue;
            });
        }
コード例 #3
0
        public FunctionCall ifarea(string arg_txt)
        {
            string[]     args          = arg_txt.Split(',');
            int          x1            = Int32.Parse(args[0]);
            int          y1            = Int32.Parse(args[1]);
            int          x2            = Int32.Parse(args[2]);
            int          y2            = Int32.Parse(args[3]);
            ColorChecker color_checker = ColorRule.Parse(args[4]);
            string       file_path     = args.Length > 5 ? args[5] : null;

            return(delegate()
            {
                Rectangle screen_area = Rectangle.FromLTRB(x1 + script.XRef,
                                                           script.YRef + y1, script.XRef + x2, script.YRef + y2);
                if (screen_color_detector.ScreenAreaIncludesColor(screen_area, color_checker))
                {
                    return ExecFileBreakable(file_path);
                }
                return FunctionResult.Continue;
            });
        }
コード例 #4
0
        public FunctionCall movetocolor(string arg_txt)
        {
            string[]        args          = arg_txt.Split(',');
            NumberGenerator x1            = NumberGenerator.Parse(args[0]);
            NumberGenerator y1            = NumberGenerator.Parse(args[1]);
            NumberGenerator x2            = NumberGenerator.Parse(args[2]);
            NumberGenerator y2            = NumberGenerator.Parse(args[3]);
            ColorChecker    color_checker = ColorRule.Parse(args[4]);
            NumberGenerator timeout       = new StaticNumber(0);

            string file_path = null;

            if (args.Length > 5)
            {
                timeout = NumberGenerator.Parse(args[5]);
                if (args.Length > 6)
                {
                    file_path = args[6];
                }
            }

            return(delegate()
            {
                if (!script.MouseMover.MoveToColor(
                        Rectangle.FromLTRB(x1.GetInt() + script.XRef,
                                           y1.GetInt() + script.YRef,
                                           x2.GetInt() + script.XRef,
                                           y2.GetInt() + script.YRef),
                        color_checker, timeout.GetInt(), script.MouseSpeed.GetDouble()))
                {
                    // timed out
                    return ExecFileBreakable(file_path);
                }

                return FunctionResult.Continue;
            });
        }