Exemple #1
0
def goto_sn(sn):
    series = [
        {
            'position': uis['btn_Main_Profile'],
            'interval': 2
        },
        {
            'position': uis['btn_profile_settings'],
            'interval': 2
        },
        {
            'position': uis['btn_profile_settings_characterMangement'],
            'interval': 20
        },
    ]
    mouse_click_series(series=series)
    sn = 'img_avatar_login_' + sn

    ## Note: 드래그 하면서 확인 필요!!!
    mouse_click_match(template=img_path(sn, where='CHARACTERS'),
                      image=uis['box_characterMangement'])
    time.sleep(2)

    mouse_click(uis['btn_characterMangement_login_YES'])

    time.sleep(10)
    connect()
Exemple #2
0
def connect():
    """
    기능: 
        - 연결 상태, 접속 에러 등을 확인하고, ROK 접속
        - (quicklaunch bar에 있는) LDPLAYER를 켜고, (플레이어 바탕화면에 있는) ROK를 실행시키고, 풀스크린으로 만든 후, 게임 로딩이 완성되면, 메뉴 버튼(우측 하단)을 누름
    Note:
        - 로딩 도중 네트워크 에러 처리 필요
        - action의 첫 클릭시 네트워크 에러 처리 필요
    """
    turn_on_emulator()
    restart_ROK(error_type='stop')
    restart_ROK(error_type='otherDevice')

    # 에뮬레이터 켜짐 확인
    template = img_path('img_emulator_status_network')
    image = expand_box(uis['img_emulator_status_network'], offset=[100, 200])
    wait_match_image(template=template, image=image)

    # 광고창 닫기
    clear_ad_win(ui_covered='btn_Player_ROK-mid',
                 btn_close='btn_emulator_adCenter_CLOSE')

    # ROK 앱 클릭
    mouse_click_match(template=img_path('btn_Player_ROK-mid'),
                      image=expand_box(uis['btn_Player_ROK-mid'], offset=[10]),
                      precision=0.99)

    # fullscreen
    full_screen()

    # ROK 인증이 필요한 경우(VERIFICATION)
    clear_verification()

    # 메뉴 unfold
    set_menu_wait()
Exemple #3
0
def click_verifications(centers, attempts=0):
    for center in centers:
        mouse_click(center)
    mouse_click_match(template=img_path('btn_Verification_OK'),
                      image=expand_box(uis['btn_Verification_OK'],
                                       offset=[20, 300]))
    print(centers)
    time.sleep(1)
    btn_OK = match_image_box(template=img_path('btn_Verification_OK'),
                             image=expand_box(uis['btn_Verification_OK'],
                                              offset=[20, 300]))
    if not btn_OK:
        return True
    else:
        return False
Exemple #4
0
def turn_on_emulator():
    """
    기능: 
        - 퀵런치 바에 LDPlayer 아이콘이 활성화 되어 있지 않았다면, 에뮬레이터(ldplayer) 실행
    """
    return mouse_click_match(template=img_path('btn_OS_Player_inactive'),
                             image=uis['box_OS_Quickloanch'],
                             precision=0.999)
Exemple #5
0
def set_menu_wait():
    """
    기능: 
        - ROK가 로딩된 후 menu mode를 'unfold'(메뉴 펼치기)로 설정 <- 게임 로딩 확인
    Note:
        - 
    """
    loaded = wait_match_image(template=img_path('btn_Main_GoAllianceView'),
                              image=expand_box(uis['btn_Main_GoAllianceView'],
                                               offset=[20]),
                              precision=0.99,
                              pause=3,
                              repeat=15,
                              interval=1)
    if loaded:
        clear_ad_win(ui_covered='btn_Main_Menu',
                     btn_close=uis['box_emulator_adSide1_CLOSE'])

    mouse_click_match(template=img_path('btn_Main_Menu'),
                      image=expand_box(uis['btn_Main_Menu'], offset=[20]),
                      precision=0.99)
Exemple #6
0
def goto_account(account):
    # if account != account:
    series = [
        {
            'position': uis['btn_Main_Profile'],
            'interval': 2
        },
        {
            'position': uis['btn_profile_settings'],
            'interval': 2
        },
        {
            'position': uis['btn_profile_settings_account'],
            'interval': 2
        },
        {
            'position': uis['btn_accountSetting_switchAccount'],
            'interval': 2
        },
    ]
    mouse_click_series(series=series)

    mouse_click_match(
        template=img_path('btn_accountSetting_switchAccount_google',
                          where='CHARACTERS'),
        image=expand_box(uis['btn_accountSetting_switchAccount_google'],
                         offset=[50, 200]))
    time.sleep(2)
    mouse_click_match(
        template=img_path('btn_accountSetting_switchAccount_google_' + account,
                          where='CHARACTERS'),
        image=expand_box(uis['btn_accountSetting_switchAccount_google_' +
                             account],
                         offset=[50, 200]))

    print('goto account: {}'.format(account))
    time.sleep(10)
    connect()
Exemple #7
0
def restart_ROK(error_type='stop'):
    """
    기능: 
        - '중지(stop)', '다른 기기(otherDevice)' 등으로 접속이 끊긴 ROK 재실행
    Note:
        - '중지', '다른 기기' 외의 경우가 없는지 확인 필요!!
    """
    if error_type == 'stop':
        ui = 'btn_Player_stop_confirm'
    elif error_type == 'otherDevice':
        ui = 'btn_disconnect_otherDevice_confirm'
    return mouse_click_match(template=img_path(ui),
                             image=expand_box(uis[ui], offset=[10]),
                             precision=0.99)
Exemple #8
0
def do_verification(attempts=0):
    """
    기능: verification 퍼즐 해결
    Note:
        - 
    """
    centers = find_verification_centers()

    if not centers:
        mouse_click_match(template=img_path('btn_Verification_Refresh'),
                          image=expand_box(uis['btn_Verification_Refresh'],
                                           offset=[20, 300]))
        time.sleep(3)
        do_verification(attempts=attempts)
    else:
        if attempts > 4:
            print("verification is not complete!!!")
            return False
        success = click_verifications(centers, attempts=attempts)
        # time.sleep(1)
        if not success:
            do_verification(attempts=attempts + 1)
        else:
            return True