mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-16 06:25:24 +00:00
Add: [ALAS] Returns in Scroll.set()
This commit is contained in:
parent
b1048748d0
commit
a2e2221829
@ -1,7 +1,7 @@
|
||||
import numpy as np
|
||||
|
||||
from module.base.base import ModuleBase
|
||||
from module.base.button import Button
|
||||
from module.base.button import Button, ButtonWrapper
|
||||
from module.base.timer import Timer
|
||||
from module.base.utils import color_similarity_2d, random_rectangle_point
|
||||
from module.logger import logger
|
||||
@ -21,7 +21,7 @@ class Scroll:
|
||||
is_vertical (bool): True if vertical, false if horizontal.
|
||||
name (str):
|
||||
"""
|
||||
if isinstance(area, Button):
|
||||
if isinstance(area, (Button, ButtonWrapper)):
|
||||
# name = area.name
|
||||
area = area.area
|
||||
self.area = area
|
||||
@ -126,10 +126,14 @@ class Scroll:
|
||||
random_range (tuple(int, float)):
|
||||
distance_check (bool): Whether to drop short swipes
|
||||
skip_first_screenshot:
|
||||
|
||||
Returns:
|
||||
bool: If dragged.
|
||||
"""
|
||||
logger.info(f'{self.name} set to {position}')
|
||||
self.drag_interval.clear()
|
||||
self.drag_timeout.reset()
|
||||
dragged = 0
|
||||
if position <= self.edge_threshold:
|
||||
random_range = np.subtract(0, self.edge_add)
|
||||
if position >= 1 - self.edge_threshold:
|
||||
@ -158,6 +162,9 @@ class Scroll:
|
||||
p2 = random_rectangle_point(self.position_to_screen(position, random_range=random_range), n=1)
|
||||
main.device.swipe(p1, p2, name=self.name, distance_check=distance_check)
|
||||
self.drag_interval.reset()
|
||||
dragged += 1
|
||||
|
||||
return dragged
|
||||
|
||||
def set_top(self, main, random_range=(-0.05, 0.05), skip_first_screenshot=True):
|
||||
return self.set(0.00, main=main, random_range=random_range, skip_first_screenshot=skip_first_screenshot)
|
||||
|
Loading…
Reference in New Issue
Block a user