diff --git a/fishy/engine/fullautofisher/controls.py b/fishy/engine/fullautofisher/controls.py index a05cb1b..d38fb9c 100644 --- a/fishy/engine/fullautofisher/controls.py +++ b/fishy/engine/fullautofisher/controls.py @@ -1,27 +1,18 @@ import logging +from pynput.keyboard import Key + from fishy.helper import hotkey from fishy.engine.fullautofisher.engine import FullAuto, State -from fishy.helper.hotkey import Key -def get_controls(engine: FullAuto): - from fishy.engine.fullautofisher.recorder import Recorder - from fishy.engine.fullautofisher.player import Player +def get_controls(controls: 'Controls'): controls = [ ("MODE_SELECT", { - Key.RIGHT: (Recorder(engine).toggle_recording, "start/stop record"), - Key.UP: (engine.calibrator.calibrate, "calibrate mode"), - Key.LEFT: (Player(engine).toggle_move, "start/stop play"), - Key.DOWN: (lambda: engine.controls.select_mode("TEST1"), "test mode"), + Key.DOWN: (lambda: controls.select_mode("TEST1"), "test mode"), }), - ("TEST1", { - Key.RIGHT: (engine.test.print_coods, "print coordinates"), - Key.UP: (engine.test.look_for_hole, "look for hole up down"), - Key.LEFT: (engine.test.set_target, "set target"), - Key.DOWN: (engine.test.move_to_target, "move to target") - }) + ("TEST1", {}) ] return controls diff --git a/fishy/engine/fullautofisher/engine.py b/fishy/engine/fullautofisher/engine.py index dea0233..81f65ce 100644 --- a/fishy/engine/fullautofisher/engine.py +++ b/fishy/engine/fullautofisher/engine.py @@ -46,8 +46,6 @@ class FullAuto(IEngine): state = State.NONE def __init__(self, gui_ref): - from fishy.engine.fullautofisher.controls import Controls - from fishy.engine.fullautofisher import controls from fishy.engine.fullautofisher.calibrator import Calibrator from fishy.engine.fullautofisher.test import Test @@ -58,7 +56,6 @@ class FullAuto(IEngine): self.fisher = SemiFisherEngine(None) self.calibrator = Calibrator(self) self.test = Test(self) - self.controls = Controls(controls.get_controls(self)) self.show_crop = False def run(self): @@ -86,7 +83,6 @@ class FullAuto(IEngine): self.fisher.toggle_start() fishing_event.unsubscribe() - self.controls.initialize() while self.start and WindowClient.running(): if self.show_crop: self.window.show(self.show_crop, func=image_pre_process) @@ -99,7 +95,6 @@ class FullAuto(IEngine): logging.error("Game window not found") self.gui.bot_started(False) - self.controls.unassign_keys() self.window.show(False) logging.info("Quitting") self.window.destory()