StarRailCopilot/module/handler/popup.py
LmeSzinc ad73de92dd Refactor: 抽象出处理确认弹窗的逻辑
- 删除了一些无用的assets
- 纠正了一些拼写错误
2020-04-13 23:00:19 +08:00

23 lines
758 B
Python

from module.base.base import ModuleBase
from module.handler.assets import POPUP_CANCEL, POPUP_CONFIRM
class PopupHandler(ModuleBase):
_popup_offset = (3, 30)
def handle_popup_confirm(self):
if self.appear(POPUP_CANCEL, offset=self._popup_offset) \
and self.appear(POPUP_CONFIRM, offset=self._popup_offset, interval=2):
self.device.click(POPUP_CONFIRM)
return True
else:
return False
def handle_popup_cancel(self):
if self.appear(POPUP_CONFIRM, offset=self._popup_offset) \
and self.appear(POPUP_CANCEL, offset=self._popup_offset, interval=2):
self.device.click(POPUP_CANCEL)
return True
else:
return False