Skip to content

Commit

Permalink
add log for explore
Browse files Browse the repository at this point in the history
  • Loading branch information
pur1fying committed Dec 30, 2023
1 parent 30da923 commit b8078ac
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
13 changes: 8 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@

class Main:
def __init__(self, logger_signal=None, button_signal=None, update_signal=None):
self.scheduler = None
self.screenshot_interval = None
self.flag_run = None
self.static_config = None
self.main_activity = None
Expand Down Expand Up @@ -76,12 +78,11 @@ def __init__(self, logger_signal=None, button_signal=None, update_signal=None):
self.total_force_fight_name = "chesed" # 当期总力战名字
self.latest_img_array = None
self.button_signal = button_signal

self.update_signal = update_signal
if not self.init_all_data():
return
self.screenshot_interval = self.config['screenshot_interval']
self.stage_data = {}
self.scheduler = Scheduler(update_signal)

# start_debugger()

def click(self, x, y, wait=True, count=1, rate=0, duration=0):
Expand Down Expand Up @@ -172,7 +173,7 @@ def thread_starter(self): # 主程序,完成用户指定任务
next_tick.replace(microsecond=0)
self.logger.info(str(next_func_name) + " next_time : " + str(next_tick))
else:
self.logger.info("error occurred, stop all activities")
self.logger.error("error occurred, stop all activities")
self.quick_method_to_main_page()
self.signal_stop()
else:
Expand Down Expand Up @@ -581,6 +582,8 @@ def init_all_data(self):
self.signal_stop()
self.logger.critical("Initialization Failed")
return False
self.screenshot_interval = self.config['screenshot_interval']
self.scheduler = Scheduler(self.update_signal)
self.logger.info("--------Initialization Finished----------")
return True

Expand All @@ -599,7 +602,7 @@ def init_package_name(self):
# # print(time.time())
t = Main()
# t.thread_starter()
# t.thread_starter()
t.thread_starter()
t.solve('explore_hard_task')
img1 = cv2.imread('qxn.jpg')
# t.solve('tactical_challenge_shop')
Expand Down
3 changes: 2 additions & 1 deletion module/explore_hard_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ def implement(self):
for number, position in current_task_stage_data['start'].items():
cu_index = choose_team(self, number, position, current_task_stage_data)
if cu_index < prev_index:
self.exit("please set the first formation number smaller than the second one")
self.logger.critical("please set the first formation number smaller than the second one")
return False
prev_index = cu_index
start_mission(self)
if self.server == 'CN':
Expand Down
3 changes: 2 additions & 1 deletion module/explore_normal_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def start_fight(self, region):
for n, p in self.stage_data[mission]['start'].items():
cu_index = choose_team(self, mission, n)
if cu_index < prev_index:
self.exit("please set the first formation number smaller than the second one")
self.logger.critical("please set the first formation number smaller than the second one")
return False
prev_index = cu_index
start_mission(self)
if self.server == 'CN':
Expand Down

0 comments on commit b8078ac

Please sign in to comment.