fix
This commit is contained in:
@@ -7,18 +7,20 @@ class Rule:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def count(self, num, interval, factor = 0):
|
||||
self.num = num
|
||||
self.interval = interval
|
||||
self.factor = factor
|
||||
return self
|
||||
def count(cls, num, interval, factor = 0):
|
||||
rule = cls()
|
||||
rule.num = num
|
||||
rule.interval = interval
|
||||
rule.factor = factor
|
||||
return rule
|
||||
|
||||
@classmethod
|
||||
def time(self, duration, interval, factor = 0):
|
||||
self.duration = duration
|
||||
self.interval = interval
|
||||
self.factor = factor
|
||||
return self
|
||||
def time(cls, duration, interval, factor = 0):
|
||||
rule = cls()
|
||||
rule.duration = duration
|
||||
rule.interval = interval
|
||||
rule.factor = factor
|
||||
return rule
|
||||
|
||||
class _App:
|
||||
def __init__(self, name):
|
||||
@@ -121,6 +123,14 @@ class TomatoListen(_App):
|
||||
_App.__init__(self, "番茄畅听")
|
||||
self.device = device
|
||||
|
||||
# 看广告
|
||||
def func_ad(self):
|
||||
button = ui.Button(200, 850, 500, 900)
|
||||
point = button.get_point()
|
||||
self.device.back()
|
||||
self.device.back() # 防止自动进入直播界面
|
||||
self.device.click(point)
|
||||
|
||||
class TomatoFiction(_App):
|
||||
def __init__(self, device):
|
||||
_App.__init__(self, "番茄小说")
|
||||
|
@@ -13,6 +13,8 @@ def main():
|
||||
wikoHi70m = WikoHi70m('3URNU24803102309')
|
||||
|
||||
# 任务
|
||||
watchAdTask = apps.Task("看广告", apps.Rule.count(500, 45, 2),
|
||||
lambda : apps.TomatoListen(wikoHi70m).func_ad())
|
||||
watchVideoTask = apps.Task.watch_video("刷视频", apps.Rule.count(500, 8, 2), wikoHi70m)
|
||||
bgWatchVideoTask = apps.Task("后台刷视频", apps.Rule.count(500, 8, 2),
|
||||
lambda : wikoHi70m.swipe(240 + int(random.uniform(-10, 10)), 1200 + int(random.uniform(-10, 10)), 240 + int(random.uniform(-10, 10)), 1100 + int(random.uniform(-10, 10)), 50))
|
||||
@@ -24,9 +26,9 @@ def main():
|
||||
bgReadBookTask = apps.Task("后台看书", apps.Rule.count(1000, 5, 2),
|
||||
lambda : wikoHi70m.swipe(500 + int(random.uniform(-10, 10)), 1200 + int(random.uniform(-10, 10)), 240 + int(random.uniform(-10, 10)), 1200 + int(random.uniform(-10, 10)), 80))
|
||||
|
||||
|
||||
watchAdTask.start()
|
||||
# 看视频+小窗看书,同步执行
|
||||
sync_task(bgWatchVideoTask, minReadBookTask)
|
||||
# sync_task(bgWatchVideoTask, minReadBookTask)
|
||||
|
||||
# 任务完成锁屏
|
||||
wikoHi70m.lock()
|
||||
|
16
script/ui.py
16
script/ui.py
@@ -8,17 +8,17 @@ class Point:
|
||||
|
||||
# 按纽
|
||||
class Button:
|
||||
def __init__(self, x, y, w = 0, h = 0):
|
||||
self.x = x
|
||||
self.y = y
|
||||
self.w = w
|
||||
self.h = h
|
||||
def __init__(self, x1, y1, x2 = 0, y2 = 0):
|
||||
self.x1 = x1
|
||||
self.y1 = y1
|
||||
self.x2 = x2
|
||||
self.y2 = y2
|
||||
|
||||
def get_point(self, ran = True):
|
||||
if ran == True and self.w > 0 and self.h > 0:
|
||||
return Point(self.x + int(random.uniform(self.w * 4, self.w * 0.7)), self.y + int(random.uniform(self.h * 0.4, self.h * 0.7)))
|
||||
if ran == True and self.x2 > 0 and self.y2 > 0:
|
||||
return Point(int(random.uniform(self.x1, self.x2)), int(random.uniform(self.y1, self.y2)))
|
||||
else:
|
||||
return Point(self.x, self.y)
|
||||
return Point(self.x1, self.y1)
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user