示例#1
0
def init():
    print('kill Trubasa app')
    utils.kill_app()
    utils.sleep_wait(3)
    print('launch Trubasa app')
    utils.launch_app()
    utils.sleep_wait(20)
示例#2
0
    def execute(self):
        # already sleep in this one.
        BaseActionInfo.execute(self)

        if not self.pattern_file:
            utils.sleep_wait(3)
            utils.tap_screen(self.xpos, self.ypos)
        else:
            matched, centerX, centerY = utils.sleep_detect_pattern(
                0, self.detect_times, self.pattern_file)
            if matched > 0:
                utils.tap_screen(centerX, centerY)
            else:
                ScenarioExecutor("s6_launch_app.json").execute()
                utils.exit_current_round = 1
示例#3
0
    def execute(self):
        BaseActionInfo.execute(self)
        containsPattern = 0
        for j in range(self.detect_times):
            print("Detect rounds {}!".format(j))
            utils.tap_screen(1760, 1030)
            utils.sleep_wait(1)
            containsPattern, _, _ = utils.patternDetect(self.pattern_file)
            if containsPattern > 0:
                break

        if containsPattern > 0:
            #found it.
            return
        else:
            print("No Sharing at all")
            sys.exit(0)
示例#4
0
    def execute(self):
        # only check for not play first.
        if utils.has_easy > 0:
            for i in range(0, 7):
                all_match, xpox, ypos = utils.patternDetect(
                    "all_match_left_pattern.png")
                print("Find all_match match result {}  {}   {}!".format(
                    all_match, xpox, ypos))
                if all_match > 0:
                    utils.accurate_tap_screen(xpox, ypos)
                    utils.sleep_wait(1)
                    ScenarioExecutor(
                        "s6_check_all_match_run_easy.json").execute()
                    # execute the script
                    return

                print("swipe")
                utils.horizontal_swipe_screen_once()

            #swipe back
            utils.horizontal_swipe_screen_back()
            utils.sleep_wait(1)

        # check others.
        for i in range(0, 7):
            middle_match, xpox, ypos = utils.patternDetect(
                "only_easy_done_pattern.png")
            print("Find middle match result {}  {}   {}!".format(
                middle_match, xpox, ypos))
            if middle_match > 0:
                utils.accurate_tap_screen(xpox, ypos)
                utils.sleep_wait(1)
                ScenarioExecutor(
                    "s6_check_all_match_run_others.json").execute()
                return
            elif utils.run_hard > 0:
                hard_match, xpox, ypos = utils.patternDetect(
                    "only_hard_left_pattern.png")
                print("Find hard match result {}  {}   {}!".format(
                    hard_match, xpox, ypos))
                if hard_match > 0:
                    utils.accurate_tap_screen(xpox, ypos)
                    utils.sleep_wait(1)
                    ScenarioExecutor(
                        "s6_check_all_match_run_others.json").execute()
                    return
                #dd
            # not found
            print("swipe")
            utils.horizontal_swipe_screen_once()

        print("No Game category available!")
        BaseActionInfo.execute(self)
示例#5
0
    def execute(self):
        for i in range(0, 10):
            easymatch, xpox, ypos = utils.patternDetect("match_easy.png")
            print("Easy match result {}  {}   {}!".format(
                easymatch, xpox, ypos))
            if easymatch > 0:
                utils.accurate_tap_screen(xpox, ypos)
                utils.sleep_wait(1)
                ScenarioExecutor("s6_partial_match.json").execute()
                return
            elif utils.run_middle > 0:
                middleMatch, xpox, ypos = utils.patternDetect(
                    "match_middle.png")
                print("Middle match result {}  {}   {}!".format(
                    middleMatch, xpox, ypos))
                if middleMatch > 0:
                    utils.accurate_tap_screen(xpox, ypos)
                    utils.sleep_wait(1)
                    ScenarioExecutor("s6_partial_match.json").execute()
                    return
                elif utils.run_hard > 0:
                    hard_match, xpox, ypos = utils.patternDetect(
                        "match_hard.png")
                    print("Hard match result {}  {}   {}!".format(
                        hard_match, xpox, ypos))
                    if hard_match > 0:
                        utils.accurate_tap_screen(xpox, ypos)
                        utils.sleep_wait(1)
                        ScenarioExecutor("s6_partial_match.json").execute()
                        return
                #dd
            # not found
            utils.vertical_swipe_screen_down()

        BaseActionInfo.execute(self)
示例#6
0
 def execute(self):
     BaseActionInfo.execute(self)
     utils.sleep_wait(self.sleepTime)
示例#7
0
 def execute(self):
     print(self.message)
     if self.actionDelay > 0:
         utils.sleep_wait(self.actionDelay + self.globalDelay)