def enter_activity(self, activity):
    vh = self.vh
    act_name = get_activity_name(activity)
    if (act_name not in get_available_activity()):
        raise RuntimeError(f'无效的活动: {act_name}')
    self.open_terminal()
    if (activity['displayType'] == 'BRANCHLINE'):
        self.tap_branch_line()
    else:
        self.tap_side_story()
    crop_flag = (activity['displayType'] == 'SIDESTORY')
    act_pos_map = self.get_all_act_pos(crop_flag)
    if (act_name not in act_pos_map):
        if (activity['displayType'] == 'BRANCHLINE'):
            raise RuntimeError(f'找不到相应活动: {act_name}')
        last_acts = act_pos_map.keys()
        while True:
            origin_x = random.randint(int((5.833 * vh)), int((24.861 * vh)))
            origin_y = random.randint(int((57.222 * vh)), int((77.917 * vh)))
            move = (- random.randint(int((vh // 5)), int((vh // 4))))
            self.helper.adb.touch_swipe2((origin_x, origin_y), (random.randint((- 20), 20), move), random.randint(900, 1200))
            act_pos_map = self.get_all_act_pos(crop_flag)
            if (act_name in act_pos_map):
                break
            if (last_acts == act_pos_map.keys()):
                raise RuntimeError(f'找不到相应活动: {act_name}')
            last_acts = act_pos_map.keys()
    logger.info(f'switch to {act_name}')
    self.click(act_pos_map[act_name], 1)
    self.tap_enter_activity()
def enter_activity(self, activity):
    vh = self.vh
    act_name = get_activity_name(activity)
    if (act_name not in get_available_activity()):
        raise RuntimeError(f'无效的活动: {act_name}')
    self.open_terminal()
    if (activity['displayType'] == 'BRANCHLINE'):
        self.tap_branch_line()
    else:
        self.tap_side_story()
    crop_flag = (activity['displayType'] == 'SIDESTORY')
    act_pos_map = self.get_all_act_pos(crop_flag)
    if (act_name not in act_pos_map):
        if (activity['displayType'] == 'BRANCHLINE'):
            raise RuntimeError(f'找不到相应活动: {act_name}')
        last_acts = act_pos_map.keys()
        while True:
            origin_x = random.randint(int((5.833 * vh)), int((24.861 * vh)))
            origin_y = random.randint(int((57.222 * vh)), int((77.917 * vh)))
            move = (- random.randint(int((vh // 5)), int((vh // 4))))
            self.helper.adb.touch_swipe2((origin_x, origin_y), (random.randint((- 20), 20), move), random.randint(900, 1200))
            act_pos_map = self.get_all_act_pos(crop_flag)
            if (act_name in act_pos_map):
                break
            if (last_acts == act_pos_map.keys()):
                raise RuntimeError(f'找不到相应活动: {act_name}')
            last_acts = act_pos_map.keys()
    logger.info(f'switch to {act_name}')
    self.click(act_pos_map[act_name], 1)
    self.tap_enter_activity()