Beispiel #1
0
 def toString(cls):
     
     str = "Highlight time=%d\n" % cls.highlightTime
     str = str + "waitTime=%d\n" % cls.waitTime
     str = str + "screen=%s (available=%d)\n" % (cls.screen, Screen.getNumberScreens())
     str = str + "regionTimeout=%d\n" % cls.regionTimeout
     str = str + "logLevel=%s\n" % cls.loggingLevel
     str = str + "screenshotLogLevel=%s\n" % cls.screenshotLoggingLevel
     
     return str
Beispiel #2
0
    def toString(cls):

        str = "Highlight time=%d\n" % cls.highlightTime
        str = str + "waitTime=%d\n" % cls.waitTime
        str = str + "screen=%s (available=%d)\n" % (cls.screen,
                                                    Screen.getNumberScreens())
        str = str + "regionTimeout=%d\n" % cls.regionTimeout
        str = str + "logLevel=%s\n" % cls.loggingLevel
        str = str + "screenshotLogLevel=%s\n" % cls.screenshotLoggingLevel

        return str
Beispiel #3
0
    def rejigger_mouse(cls, regions, preset):
        """Method to move the mouse to a random X,Y coordinate in the specified
        preset region.

        Args:
            regions (dict): dict of pre-defined kcauto regions
            preset (str): name of preset-area to move the mouse to
        """
        # preset areas are designated as (X_start, X_end, Y_start, Y_end)
        presets = {
            'game': (0, Globals.GAME_WIDTH, 0, Globals.GAME_HEIGHT),
            'center': (225, 975, 180, 540),
            'top': (400, 1200, 12, 42),
            'quest_menu': (790, 895, 50, 95),
            'shipgirl': (700, 1100, 130, 550),
            'lbas': (500, 700, 5, 50),
            'lbas_mode_switch_button': (1150, 1175, 210, 265),
            '7th_next': (386, 413, 400, 427)  # NU
        }

        if isinstance(preset, str):
            x1, x2, y1, y2 = presets[preset]
            # max bounds
            temp_screen = Screen().getBounds()
            max_x = temp_screen.width
            max_y = temp_screen.height

            rand_x = regions['game'].x + cls.random_coord(x1, x2)
            rand_y = regions['game'].y + cls.random_coord(y1, y2)

            rand_x = max_x - 1 if rand_x > max_x else rand_x
            rand_y = max_y - 1 if rand_y > max_y else rand_y
        elif (isinstance(preset, Region) or isinstance(preset, JRegion)
              or isinstance(preset, Match) or isinstance(preset, JMatch)):
            rand_x = cls.random_coord(preset.x, preset.x + preset.w)
            rand_y = cls.random_coord(preset.y, preset.y + preset.h)

        regions['game'].mouseMove(Location(rand_x, rand_y))
Beispiel #4
0
    def rejigger_mouse(cls, regions, preset):
        """Method to move the mouse to a random X,Y coordinate in the specified
        preset region.

        Args:
            regions (dict): dict of pre-defined kcauto-kai regions
            preset (str): name of preset-area to move the mouse to
        """
        # preset areas are designated as (X_start, X_end, Y_start, Y_end)
        presets = {
            'game': (0, 800, 0, 480),
            'center': (150, 650, 130, 350),
            'top': (120, 780, 5, 25),
            'shipgirl': (370, 780, 100, 420),
            'lbas': (350, 450, 5, 50),
            'lbas_mode_switch_button': (763, 788, 137, 179),
            '7th_next': (386, 413, 400, 427)
        }

        if isinstance(preset, str):
            x1, x2, y1, y2 = presets[preset]
            # max bounds
            temp_screen = Screen().getBounds()
            max_x = temp_screen.width
            max_y = temp_screen.height

            rand_x = regions['game'].x + cls.randint_gauss(x1, x2)
            rand_y = regions['game'].y + cls.randint_gauss(y1, y2)

            rand_x = max_x - 1 if rand_x > max_x else rand_x
            rand_y = max_y - 1 if rand_y > max_y else rand_y
        elif (isinstance(preset, Region) or isinstance(preset, JRegion)
                or isinstance(preset, Match) or isinstance(preset, JMatch)):
            rand_x = cls.randint_gauss(preset.x, preset.x + preset.w)
            rand_y = cls.randint_gauss(preset.y, preset.y + preset.h)

        regions['game'].mouseMove(Location(rand_x, rand_y))
Beispiel #5
0
def run(img: str, similarity: float) -> None:
    p = Pattern(img).similar(similarity)
    s = Screen(0)
    s._debug = True
    s.hover(p)
Beispiel #6
0
class Config():

    highlightTime = 1  # When debugging is enabled.. highlight exists, wait, etc
    waitTime = 0

    imageBaseline = "resources/baseline"  # image baseline directory

    loggingLevel = None  # If 'development' file exists in root, we're in dev env
    screenshotLoggingLevel = None

    debugPlaybackMode = False  #debugPlaybackMode = True if os.path.isfile('development') else False

    resultDir = "results/"
    resultAssetDir = "assets/"
    imageSuffix = ".png"
    screen = Screen(0)

    language = "en"
    locale = "CA"
    captureBaseline = False

    regionTimeout = 3

    # Initialize the logger and set the logging level
    logger = None  #log.Logger(level=loggingLevel) - move to bootstrap

    #os = Env.getOS()
    #osVersion = Env.getOSVersion(fullName=True)
    #arch = java.lang.System.getProperty('os.arch')

    mainThread = Thread.currentThread()

    @classmethod
    def setRegionTimeout(cls, timeout):
        cls.regionTimeout = timeout
        JRegion.timeout = Config.regionTimeout

    @classmethod
    def setLogger(cls, logger):
        cls.logger = logger

    @classmethod
    def getLogger(cls):
        return cls.logger

    @classmethod
    def getLoggingLevel(cls):
        return cls.logger.getLoggingLevel()

    @classmethod
    def getScreen(cls):
        return cls.screen

    @classmethod
    def setScreenshotLoggingLevel(cls, level):

        cls.logger.getLogger().log(level, "Changing screenshot logging level")
        cls.screenshotLoggingLevel = level

    @classmethod
    def getScreenshotLoggingLevel(cls):
        return cls.screenshotLoggingLevel

    @classmethod
    def toString(cls):

        str = "Highlight time=%d\n" % cls.highlightTime
        str = str + "waitTime=%d\n" % cls.waitTime
        str = str + "screen=%s (available=%d)\n" % (cls.screen,
                                                    Screen.getNumberScreens())
        str = str + "regionTimeout=%d\n" % cls.regionTimeout
        str = str + "logLevel=%s\n" % cls.loggingLevel
        str = str + "screenshotLogLevel=%s\n" % cls.screenshotLoggingLevel

        return str
# import org.sikuli.script.SikulixForJython
# from sikuli import *
# print ("Hello World!Jython")
# x=1
# print (x)
# any = Screen(0)
# any.click("1m.png")
#
# 不正规的方法
import sys

sys.path.append(
    "C:\\Users\\Administrator\\AppData\\Roaming\\Sikulix\\SikulixLibs_201510051707"
)

from sikuli import *
from sikuli import Screen

print("Hello World!Jython")
x = 1
print(x)
any = Screen(0)
any.click("img\\1m.png")