Skip to content

Commit

Permalink
从首页进入基建适配夜间主题
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhaoZuohong committed Oct 1, 2023
1 parent 90f9d7a commit deb5b15
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion arknights_mower/solvers/base_construct.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def run(self, arrange: dict[str, tp.BasePlan] = None, clue_collect: bool = False

def transition(self) -> None:
if self.scene() == Scene.INDEX:
self.tap_element('index_infrastructure')
self.tap_themed_element('index_infrastructure')
elif self.scene() == Scene.INFRA_MAIN:
return self.infra_main()
elif self.scene() == Scene.INFRA_TODOLIST:
Expand Down
2 changes: 1 addition & 1 deletion arknights_mower/solvers/base_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def run(self) -> None:
def transition(self) -> None:
self.recog.update()
if self.get_infra_scene() == Scene.INDEX:
self.tap_element('index_infrastructure')
self.tap_themed_element('index_infrastructure')
elif self.get_infra_scene() == Scene.INFRA_MAIN:
return self.infra_main()
elif self.get_infra_scene() == Scene.INFRA_TODOLIST:
Expand Down
15 changes: 14 additions & 1 deletion arknights_mower/utils/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,19 @@ def tap_element(self, element_name: str, x_rate: float = 0.5, y_rate: float = 0.
self.tap(element, x_rate, y_rate, interval, rebuild)
return True


def tap_themed_element(self, name):
themes = ["dark", "sami"]
themed_names = [name] + ["_".join([name, t]) for t in themes]
for i in themed_names:
try:
if self.tap_element(i):
return True
except:
continue
return False


def swipe(self, start: tp.Coordinate, movement: tp.Coordinate, duration: int = 100, interval: float = 1,
rebuild: bool = True) -> None:
""" swipe """
Expand Down Expand Up @@ -267,7 +280,7 @@ def get_navigation(self):

def back_to_infrastructure(self):
self.back_to_index()
self.tap_element('index_infrastructure')
self.tap_themed_element('index_infrastructure')

def back_to_index(self):
"""
Expand Down

0 comments on commit deb5b15

Please sign in to comment.