diff --git a/doc/设计模型_游戏自动翻译与操作_张嘉欣(v2.0).docx b/doc/设计模型_游戏自动翻译与操作_张嘉欣(v2.0).docx new file mode 100644 index 0000000..6d3b5f5 Binary files /dev/null and b/doc/设计模型_游戏自动翻译与操作_张嘉欣(v2.0).docx differ diff --git a/doc/软件设计模型_游戏自动翻译与操作_张嘉欣.docx b/doc/设计模型_游戏自动翻译与操作_张嘉欣.docx similarity index 100% rename from doc/软件设计模型_游戏自动翻译与操作_张嘉欣.docx rename to doc/设计模型_游戏自动翻译与操作_张嘉欣.docx diff --git a/doc/需求模型_游戏自动游戏与翻译_张嘉欣(v2.0).docx b/doc/需求模型_游戏自动游戏与翻译_张嘉欣(v2.0).docx new file mode 100644 index 0000000..06eda05 Binary files /dev/null and b/doc/需求模型_游戏自动游戏与翻译_张嘉欣(v2.0).docx differ diff --git a/src/.idea/.gitignore b/src/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/src/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/src/.idea/inspectionProfiles/profiles_settings.xml b/src/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..dd4c951 --- /dev/null +++ b/src/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/src/.idea/misc.xml b/src/.idea/misc.xml new file mode 100644 index 0000000..59b947d --- /dev/null +++ b/src/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/.idea/modules.xml b/src/.idea/modules.xml new file mode 100644 index 0000000..f669a0e --- /dev/null +++ b/src/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/.idea/src.iml b/src/.idea/src.iml new file mode 100644 index 0000000..b50f66a --- /dev/null +++ b/src/.idea/src.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/.idea/vcs.xml b/src/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/src/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/src.md b/src/src.md deleted file mode 100644 index e69de29..0000000 diff --git a/src/windows/.idea/.gitignore b/src/windows/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/src/windows/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/src/windows/.idea/inspectionProfiles/profiles_settings.xml b/src/windows/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/src/windows/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/src/windows/.idea/misc.xml b/src/windows/.idea/misc.xml new file mode 100644 index 0000000..a971a2c --- /dev/null +++ b/src/windows/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/windows/.idea/modules.xml b/src/windows/.idea/modules.xml new file mode 100644 index 0000000..efa1d66 --- /dev/null +++ b/src/windows/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/windows/.idea/vcs.xml b/src/windows/.idea/vcs.xml new file mode 100644 index 0000000..b2bdec2 --- /dev/null +++ b/src/windows/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/windows/.idea/windows.iml b/src/windows/.idea/windows.iml new file mode 100644 index 0000000..909438d --- /dev/null +++ b/src/windows/.idea/windows.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/windows/__pycache__/operateselect_window.cpython-311.pyc b/src/windows/__pycache__/operateselect_window.cpython-311.pyc new file mode 100644 index 0000000..d94f42b Binary files /dev/null and b/src/windows/__pycache__/operateselect_window.cpython-311.pyc differ diff --git a/src/windows/__pycache__/selectRuleOrder.cpython-311.pyc b/src/windows/__pycache__/selectRuleOrder.cpython-311.pyc new file mode 100644 index 0000000..5f9fc81 Binary files /dev/null and b/src/windows/__pycache__/selectRuleOrder.cpython-311.pyc differ diff --git a/src/windows/__pycache__/settingrule_window.cpython-311.pyc b/src/windows/__pycache__/settingrule_window.cpython-311.pyc new file mode 100644 index 0000000..be28162 Binary files /dev/null and b/src/windows/__pycache__/settingrule_window.cpython-311.pyc differ diff --git a/src/windows/__pycache__/translate_window.cpython-311.pyc b/src/windows/__pycache__/translate_window.cpython-311.pyc new file mode 100644 index 0000000..e621944 Binary files /dev/null and b/src/windows/__pycache__/translate_window.cpython-311.pyc differ diff --git a/src/windows/main_window.py b/src/windows/main_window.py new file mode 100644 index 0000000..42e6935 --- /dev/null +++ b/src/windows/main_window.py @@ -0,0 +1,90 @@ + +import sys +from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton, QListWidget, QListWidgetItem +from PyQt5.QtCore import Qt +from PyQt5 import uic + +from translate_window import translate +from settingrule_window import settingrule +from selectRuleOrder import orderselet + + +class MyApp(QMainWindow): + def __init__(self): + super().__init__() + + uic.loadUi('res/ui/main_window.ui', self) + + self.translate_window = translate() + self.setRule_window = settingrule() + self.orderSelect_window = orderselet() + + self.addRuleBtn = self.findChild(QPushButton, 'addRuleBtn') + self.delRuleBtn = self.findChild(QPushButton, 'delRuleBtn') + self.translateBtn = self.findChild(QPushButton, 'translateBtn') + self.autoplay = self.findChild(QPushButton, 'autoGameBtn') + self.ruleList = self.findChild(QListWidget, 'ruleList') + + self.addRuleBtn.clicked.connect(self.show_settingrule_window) + self.translateBtn.clicked.connect(self.show_translate_window) + self.autoplay.clicked.connect(self.show_orderselect_window) + + item = self.ruleList.item(0) # 假设要操作的项目在列表中的第一个位置 + # 设置项目的 checkState 为未选择状态 + item.setCheckState(Qt.Unchecked) + # 连接itemClicked信号到槽函数 + self.ruleList.itemClicked.connect(self.onItemClicked) + self.listIndexs = self.get_item_indexs(self.ruleList) + + def show_orderselect_window(self): + item_states = self.get_item_states(self.ruleList) + for item_text, item_state in item_states.items(): + if item_state == Qt.Checked: + item = QListWidgetItem(item_text) + item.setFlags(item.flags()|Qt.ItemIsSelectable|Qt.ItemIsUserCheckable|Qt.ItemIsEnabled) + item.setCheckState(Qt.Unchecked) + self.orderSelect_window.order_list.addItem(item) + self.orderSelect_window.show() + + def show_settingrule_window(self): + self.setRule_window.show() + + def show_translate_window(self): + self.translate_window.show() + + def onItemClicked(self, item): + # 处理项目的选择状态变化 + if item.checkState() == Qt.Checked: + item.setCheckState(Qt.Unchecked) + else: + item.setCheckState(Qt.Checked) + + @staticmethod + def get_item_states(list_widget): + item_states = {} # 用于存储项目的选择状态 + + for index in range(list_widget.count()): + item = list_widget.item(index) + if item: + item_text = item.text() + item_state = item.checkState() + item_states[item_text] = item_state + return item_states + + @staticmethod + def get_item_indexs(list_widget): + item_indexs = {} # 用于建项目的选择状态 + + for index in range(list_widget.count()): + item = list_widget.item(index) + if item: + item_text = item.text() + item_indexs[item_text] = index + return item_indexs + + +if __name__ == "__main__": + app = QApplication(sys.argv) + window = MyApp() + window.show() + sys.exit(app.exec_()) diff --git a/src/windows/operateselect_window.py b/src/windows/operateselect_window.py new file mode 100644 index 0000000..4e40a6b --- /dev/null +++ b/src/windows/operateselect_window.py @@ -0,0 +1,9 @@ +from PyQt5.QtWidgets import QMainWindow, QWidget +from PyQt5 import uic + + +class operateselect(QMainWindow): + def __init__(self): + super().__init__() + + uic.loadUi('res/ui/operationSelect_window.ui', self) diff --git a/src/windows/res/pictures/back_btn.png b/src/windows/res/pictures/back_btn.png new file mode 100644 index 0000000..77a1581 Binary files /dev/null and b/src/windows/res/pictures/back_btn.png differ diff --git a/src/windows/res/pictures/back_confirm.png b/src/windows/res/pictures/back_confirm.png new file mode 100644 index 0000000..ecf5a9e Binary files /dev/null and b/src/windows/res/pictures/back_confirm.png differ diff --git a/src/windows/res/pictures/black_circle.png b/src/windows/res/pictures/black_circle.png new file mode 100644 index 0000000..5e60249 Binary files /dev/null and b/src/windows/res/pictures/black_circle.png differ diff --git a/src/windows/res/pictures/chapter0.png b/src/windows/res/pictures/chapter0.png new file mode 100644 index 0000000..cc84740 Binary files /dev/null and b/src/windows/res/pictures/chapter0.png differ diff --git a/src/windows/res/pictures/chapter1.png b/src/windows/res/pictures/chapter1.png new file mode 100644 index 0000000..9b60048 Binary files /dev/null and b/src/windows/res/pictures/chapter1.png differ diff --git a/src/windows/res/pictures/chapter2.png b/src/windows/res/pictures/chapter2.png new file mode 100644 index 0000000..3f4edda Binary files /dev/null and b/src/windows/res/pictures/chapter2.png differ diff --git a/src/windows/res/pictures/chapter3.png b/src/windows/res/pictures/chapter3.png new file mode 100644 index 0000000..620999a Binary files /dev/null and b/src/windows/res/pictures/chapter3.png differ diff --git a/src/windows/res/pictures/cur_chapter1.png b/src/windows/res/pictures/cur_chapter1.png new file mode 100644 index 0000000..9b51078 Binary files /dev/null and b/src/windows/res/pictures/cur_chapter1.png differ diff --git a/src/windows/res/pictures/fight_photo.png b/src/windows/res/pictures/fight_photo.png new file mode 100644 index 0000000..5fb3eda Binary files /dev/null and b/src/windows/res/pictures/fight_photo.png differ diff --git a/src/windows/res/pictures/fighting!.png b/src/windows/res/pictures/fighting!.png new file mode 100644 index 0000000..ca75ebe Binary files /dev/null and b/src/windows/res/pictures/fighting!.png differ diff --git a/src/windows/res/pictures/level_1-1.png b/src/windows/res/pictures/level_1-1.png new file mode 100644 index 0000000..f9a38d4 Binary files /dev/null and b/src/windows/res/pictures/level_1-1.png differ diff --git a/src/windows/res/pictures/level_1-12.png b/src/windows/res/pictures/level_1-12.png new file mode 100644 index 0000000..d738707 Binary files /dev/null and b/src/windows/res/pictures/level_1-12.png differ diff --git a/src/windows/res/pictures/level_1-7.png b/src/windows/res/pictures/level_1-7.png new file mode 100644 index 0000000..349c5df Binary files /dev/null and b/src/windows/res/pictures/level_1-7.png differ diff --git a/src/windows/res/pictures/mission_complete.png b/src/windows/res/pictures/mission_complete.png new file mode 100644 index 0000000..a92f68b Binary files /dev/null and b/src/windows/res/pictures/mission_complete.png differ diff --git a/src/windows/res/pictures/mission_fail.png b/src/windows/res/pictures/mission_fail.png new file mode 100644 index 0000000..9adf938 Binary files /dev/null and b/src/windows/res/pictures/mission_fail.png differ diff --git a/src/windows/res/pictures/purpose_chapter.png b/src/windows/res/pictures/purpose_chapter.png new file mode 100644 index 0000000..5219b81 Binary files /dev/null and b/src/windows/res/pictures/purpose_chapter.png differ diff --git a/src/windows/res/pictures/start_fighting.png b/src/windows/res/pictures/start_fighting.png new file mode 100644 index 0000000..fb5b9a2 Binary files /dev/null and b/src/windows/res/pictures/start_fighting.png differ diff --git a/src/windows/res/pictures/terminal_photo.png b/src/windows/res/pictures/terminal_photo.png new file mode 100644 index 0000000..a3a7c9a Binary files /dev/null and b/src/windows/res/pictures/terminal_photo.png differ diff --git a/src/windows/res/pictures/theme_word.png b/src/windows/res/pictures/theme_word.png new file mode 100644 index 0000000..5c3b2e3 Binary files /dev/null and b/src/windows/res/pictures/theme_word.png differ diff --git a/src/windows/res/rules/__pycache__/明日方舟自动清体力.cpython-311.pyc b/src/windows/res/rules/__pycache__/明日方舟自动清体力.cpython-311.pyc new file mode 100644 index 0000000..e2b6921 Binary files /dev/null and b/src/windows/res/rules/__pycache__/明日方舟自动清体力.cpython-311.pyc differ diff --git a/src/windows/res/rules/明日方舟自动清体力.py b/src/windows/res/rules/明日方舟自动清体力.py new file mode 100644 index 0000000..553a575 --- /dev/null +++ b/src/windows/res/rules/明日方舟自动清体力.py @@ -0,0 +1,278 @@ +import os +import time + +import cv2 +import pyautogui as p +from PyQt5.QtCore import QThread, pyqtSignal + +from windows.res.tools.deal_picture import DealPicture + +p.PAUSE = 0.1 +p.FAILSAFE = True + + +def click_once(photo): + positions = p.locateCenterOnScreen(photo, confidence=0.8) + x, y = positions.x, positions.y + p.click(x, y) + time.sleep(0.1) + + +def click_util(click_photo, stop_function): + count = 0 + while stop_function() is False: + positions = DealPicture.find_photo_center(click_photo) + if positions: + x, y = positions.x, positions.y + p.click(x, y) + else: + count += 1 + if count == 20: + break + time.sleep(0.1) + + +def drag_once(drop_position, xOffset=None, yOffset=None, pOffsetX=None, pOffsetY=None): + offsetx = 0 + offsety = 0 + poffsetx = 0 + poffsety = 0 + if xOffset: + offsetx = xOffset + if yOffset: + offsety = yOffset + if pOffsetX: + poffsetx = pOffsetX + if pOffsetY: + poffsety = pOffsetY + positions = p.locateCenterOnScreen(drop_position, confidence=0.8) + if positions: + x, y = positions.x, positions.y + # 长按鼠标左键 + p.mouseDown(x=x + poffsetx, y=y + poffsety, button='left') + + # 向上移动鼠标,这里移动了100像素,可以根据需要调整 + p.moveRel(offsetx, offsety, duration=1) + # 延迟一段时间 + time.sleep(0.2) + # 松开鼠标左键 + p.mouseUp(x=x + poffsetx + offsetx, y=y + poffsety + offsety, button='left') + time.sleep(0.3) + + +def drag_util(drop_position, stop_function, xOffset=None, yOffset=None, pOffsetX=None, pOffsetY=None): + count = 0 + offsetx = 0 + offsety = 0 + poffsetx = 0 + poffsety = 0 + if xOffset: + offsetx = xOffset + if yOffset: + offsety = yOffset + if pOffsetX: + poffsetx = pOffsetX + if pOffsetY: + poffsety = pOffsetY + while stop_function() is False: + positions = DealPicture.find_photo_center(drop_position, 5) + if positions: + x, y = positions.x, positions.y + # 长按鼠标左键 + p.mouseDown(x=x + poffsetx, y=y + poffsety, button='left') + + # 向上移动鼠标,这里移动了100像素,可以根据需要调整 + p.moveRel(offsetx, offsety, duration=1) + # 延迟一段时间 + time.sleep(0.2) + # 松开鼠标左键 + p.mouseUp(x=x + poffsetx + offsetx, y=y + poffsety + offsety, button='left') + time.sleep(0.3) + + else: + count += 1 + if count == 10: + break + time.sleep(0.3) + + +def backToTerminal(): + print("back to terminal") + positions = DealPicture.find_photo_center('../pictures/terminal_photo.png', 2) + while positions is None: + click_photo = cv2.imread('../pictures/back_btn.png') + back_confirm = cv2.imread('../pictures/back_confirm.png') + if DealPicture.find_photo_center(click_photo, 1): + click_once(click_photo) + else: + return False + if DealPicture.find_photo_center(back_confirm, 1): + click_once(back_confirm) + else: + return False + positions = DealPicture.find_photo_center('../pictures/terminal_photo.png') + print("find terminal") + return True + + +def find_target_level(): + print("finding level") + + if DealPicture.find_photo_center('../pictures/cur_chapter1.png', 2): + print("on purpose chapter") + else: + return False + while DealPicture.find_photo_center( + '../pictures/level_1-1.png', 1, 0.9) is None and DealPicture.find_photo_center( + '../pictures/level_1-7.png', 1, 0.9) is None: + drag_position = cv2.imread('../pictures/back_btn.png') + name = 'level_1-7.png' + if DealPicture.find_photo_center('../pictures/back_btn.png', 2): + drag_once(drag_position, 300, 0, 0, 200) + else: + print("don't find picture ", name) + return False + + while DealPicture.find_photo_center('../pictures/level_1-7.png', 1, 0.9) is None: + drag_position = cv2.imread('../pictures/back_btn.png') + if DealPicture.find_photo_center('../pictures/back_btn.png', 2): + drag_once(drag_position, -400, 0, 300, 200) + else: + print("back to terminal") + return False + + click_photo = cv2.imread('../pictures/level_1-7.png') + stop_photo = [cv2.imread('../pictures/fight_photo.png')] + name = 'level_1-7.png' + if DealPicture.find_photo_center(click_photo, 1, 0.9): + click_util(click_photo, lambda: DealPicture.find_any_photos(stop_photo)) + else: + print("don't find picture", name) + return False + return True + + +def find_target_chapter(): + print("finding chapter") + click_photo = cv2.imread('../pictures/terminal_photo.png') + stop_photo = [cv2.imread('../pictures/theme_word.png')] + name = 'terminal_photo.png' + if DealPicture.find_photo_center(click_photo, 1): + click_util(click_photo, lambda: DealPicture.find_any_photos(stop_photo)) + else: + print("don't find picture", name) + return False + + click_photo = cv2.imread('../pictures/theme_word.png') + stop_photo = [cv2.imread('../pictures/black_circle.png')] + name = 'theme_word.png' + if DealPicture.find_photo_center(click_photo, 1): + click_util(click_photo, lambda: DealPicture.find_any_photos(stop_photo)) + else: + print("don't find picture", name) + return False + + drag_position = cv2.imread('../pictures/black_circle.png') + stop_photo = [cv2.imread('../pictures/purpose_chapter.png')] + name = 'black_circle.png' + if DealPicture.find_photo_center(drag_position, 1): + drag_util(drag_position, lambda: DealPicture.find_any_photos(stop_photo), 0, 400) + else: + print("don't find picture", name) + return False + + drag_position = cv2.imread('../pictures/chapter3.png') + stop_photo = [cv2.imread('../pictures/chapter2.png')] + name = 'chapter3.png' + if DealPicture.find_photo_center(drag_position, 1): + drag_util(drag_position, lambda: DealPicture.find_any_photos(stop_photo), 300, 0) + else: + print("don't find picture", name) + return False + + drag_position = cv2.imread('../pictures/chapter2.png') + stop_photo = [cv2.imread('../pictures/chapter1.png')] + name = 'chapter2.png' + if DealPicture.find_photo_center(drag_position, 1): + drag_util(drag_position, lambda: DealPicture.find_any_photos(stop_photo), 300, 0) + else: + print("don't find picture", name) + return False + + click_photo = cv2.imread('../pictures/chapter1.png') + stop_photos = [cv2.imread('../pictures/fight_photo.png'), cv2.imread('../pictures/cur_chapter1.png')] + name = 'chapter1.png' + if DealPicture.find_photo_center(click_photo, 1): + click_util(click_photo, lambda: DealPicture.find_any_photos(stop_photos)) + else: + print("don't find picture", name) + return False + + return True + + +def fight_time(): + print("fighting time!") + click_photo = cv2.imread('../pictures/fight_photo.png') + stop_photo = [cv2.imread('../pictures/start_fighting.png')] + name = 'fight_photo.png' + if DealPicture.find_photo_center(click_photo, 1): + click_util(click_photo, lambda: DealPicture.find_any_photos(stop_photo)) + else: + print("don't find picture", name) + return False + + click_photo = cv2.imread('../pictures/start_fighting.png') + stop_photo = [cv2.imread('../pictures/fighting!.png')] + name = 'start_fighting!.png' + if DealPicture.find_photo_center(click_photo, 2): + click_util(click_photo, lambda: DealPicture.find_any_photos(stop_photo)) + else: + print("don't find picture", name) + return False + + click_photo = cv2.imread('../pictures/fighting!.png') + while DealPicture.find_photo_center(click_photo, 10): + print("战斗中") + time.sleep(10) + + click_photo = cv2.imread('../pictures/mission_fail.png') + stop_photo = [cv2.imread('../pictures/mission_complete.png')] + if DealPicture.find_photo_center(click_photo, 5): + click_util(click_photo, lambda: DealPicture.find_any_photos(stop_photo)) + + click_photo = cv2.imread('../pictures/mission_complete.png') + stop_photo = [cv2.imread('../pictures/fight_photo.png')] + name = 'mission_complete.png' + if DealPicture.find_photo_center(click_photo, 5): + click_util(click_photo, lambda: DealPicture.find_any_photos(stop_photo)) + else: + print("don't find picture", name) + return False + + return True + + +class WorkerThread(QThread): + finished = pyqtSignal() + + def run(self): + os.chdir('res/rules') + current_directory = os.getcwd() + print("Current working directory:", current_directory) + # i = 0 + # if find_target_level(): + # while i < 10: + # fight_time() + # else: + # backToTerminal() + # while fight_time() is False and i < 10: + # while find_target_level() is False: + # while find_target_chapter() is False: + # while backToTerminal() is False: + # print("开始") + # i += 1 + os.chdir('../../../windows') + current_directory = os.getcwd() + print("Current working directory:", current_directory) + self.finished.emit() diff --git a/src/windows/res/tools/__pycache__/deal_picture.cpython-311.pyc b/src/windows/res/tools/__pycache__/deal_picture.cpython-311.pyc new file mode 100644 index 0000000..d4356ca Binary files /dev/null and b/src/windows/res/tools/__pycache__/deal_picture.cpython-311.pyc differ diff --git a/src/windows/res/tools/deal_picture.py b/src/windows/res/tools/deal_picture.py new file mode 100644 index 0000000..79d89ec --- /dev/null +++ b/src/windows/res/tools/deal_picture.py @@ -0,0 +1,57 @@ +import time + +import cv2 +import pyautogui as p + + +class DealPicture: + + @staticmethod + def screenShot(): + p.screenshot().save('../pictures/screenshot.png') + + @staticmethod + def find_photo_center(photo, run_time=None, confidence=None): + """ + + :param photo: 图片地址或是一个imread() + :param run_time: 单位秒 + :param confidence: 可选参数,图片相似度 + :return: 一个positions,参数为x,y + """ + count = 5 + i = 0 + if confidence is not None: + confidence = confidence + else: + confidence = 0.8 + if run_time: + count = run_time * 10 + while i < count: + positions = p.locateCenterOnScreen(photo, confidence=confidence) + if positions: + return positions + i += 1 + time.sleep(0.1) + return None + + @staticmethod + def find_any_photos(photos, run_time=None): + """ + + :param photos: 多个图片地址 + :param run_time: 单位秒 + :return: true or false + """ + count = 5 + i = 0 + if run_time: + count = run_time * 10 + while i < count: + for photo in photos: + positions = p.locateCenterOnScreen(photo, confidence=0.8) + if positions: + return True + i += 1 + time.sleep(0.1) + return False diff --git a/src/windows/res/tools/test.py b/src/windows/res/tools/test.py new file mode 100644 index 0000000..2355eb7 --- /dev/null +++ b/src/windows/res/tools/test.py @@ -0,0 +1,7 @@ +pOffsetX = 2 +pOffsetY = 1 +if pOffsetX: + poffsetx = pOffsetX + print(1) +if pOffsetY: + poffsety = pOffsetY \ No newline at end of file diff --git a/src/windows/res/ui/main_window.ui b/src/windows/res/ui/main_window.ui new file mode 100644 index 0000000..a3565be --- /dev/null +++ b/src/windows/res/ui/main_window.ui @@ -0,0 +1,168 @@ + + + mainPage + + + + 0 + 0 + 352 + 803 + + + + Form + + + + + 0 + 0 + 361 + 801 + + + + + + 0 + -10 + 351 + 671 + + + + + + 0 + 10 + 351 + 551 + + + + + 明日方舟自动清体力 + + + Unchecked + + + ItemIsSelectable|ItemIsUserCheckable|ItemIsEnabled + + + + + + + 100 + 620 + 131 + 51 + + + + 自动游戏 + + + + + + 30 + 550 + 291 + 71 + + + + + + + 添加规则 + + + + + + + 删除规则 + + + + + + + + + + 10 + 660 + 331 + 131 + + + + + + 10 + 20 + 67 + 17 + + + + 语言选择: + + + + + + 50 + 50 + 86 + 25 + + + + + 日语 + + + + + 英语 + + + + + + + 10 + 90 + 89 + 25 + + + + 翻译区域选择 + + + + + + 170 + 40 + 121 + 51 + + + + 翻译 + + + + + + + + diff --git a/src/windows/res/ui/operationSelect_window.ui b/src/windows/res/ui/operationSelect_window.ui new file mode 100644 index 0000000..931bd74 --- /dev/null +++ b/src/windows/res/ui/operationSelect_window.ui @@ -0,0 +1,218 @@ + + + Form + + + + 0 + 0 + 693 + 431 + + + + Form + + + + + 0 + 0 + 691 + 341 + + + + + + 0 + 0 + 101 + 101 + + + + + + + + + + 点击操作 + + + + + + + + + 130 + 0 + 101 + 101 + + + + + + + + + + 长按操作 + + + + + + + + + 260 + 0 + 101 + 101 + + + + + + + + + + 左划操作 + + + + + + + + + 390 + 0 + 101 + 101 + + + + + + + + + + 右划操作 + + + + + + + + + 520 + 0 + 101 + 101 + + + + + + + + + + 键盘点击操作 + + + + + + + + + 0 + 130 + 101 + 101 + + + + + + + + + + 休眠操作 + + + + + + + + + 130 + 130 + 101 + 101 + + + + + + + + + + 上划操作 + + + + + + + + + 270 + 130 + 101 + 101 + + + + + + + + + + 下划操作 + + + + + + + + + + 300 + 350 + 91 + 71 + + + + 确认 + + + + + + diff --git a/src/windows/res/ui/selectRuleOrder.ui b/src/windows/res/ui/selectRuleOrder.ui new file mode 100644 index 0000000..69eeecb --- /dev/null +++ b/src/windows/res/ui/selectRuleOrder.ui @@ -0,0 +1,83 @@ + + + Form + + + + 0 + 0 + 579 + 394 + + + + Form + + + + + 10 + 0 + 571 + 421 + + + + + + 60 + 40 + 441 + 261 + + + + + + + + + + + + 100 + 330 + 131 + 41 + + + + 返回 + + + + + + 330 + 330 + 131 + 41 + + + + 确认 + + + + + + 10 + 10 + 151 + 17 + + + + 选择规则执行顺序: + + + + + + + diff --git a/src/windows/res/ui/setRule_window.ui b/src/windows/res/ui/setRule_window.ui new file mode 100644 index 0000000..506ee5e --- /dev/null +++ b/src/windows/res/ui/setRule_window.ui @@ -0,0 +1,339 @@ + + + Form + + + + 0 + 0 + 272 + 471 + + + + Form + + + + + 0 + 0 + 271 + 471 + + + + + + 0 + 0 + 271 + 371 + + + + + + 0 + 40 + 201 + 31 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">图片地址</p></body></html> + + + + + + 220 + 120 + 41 + 31 + + + + 上传 + + + + + + 0 + 10 + 271 + 17 + + + + 判断条件(可上传多张图片): + + + + + + 0 + 90 + 251 + 17 + + + + 操作选择: + + + + + + 50 + 120 + 81 + 20 + + + + 操作坐标: + + + + + + 220 + 40 + 41 + 31 + + + + 上传 + + + + + + 190 + 200 + 51 + 31 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">0</p></body></html> + + + + + + 140 + 170 + 51 + 17 + + + + x偏移: + + + + + + 140 + 200 + 51 + 17 + + + + y偏移: + + + + + + 190 + 160 + 51 + 31 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">0</p></body></html> + + + + + + 80 + 180 + 81 + 20 + + + + 偏移量: + + + + + + 60 + 250 + 251 + 17 + + + + 操作类型: + + + + + + 130 + 250 + 86 + 25 + + + + + + + + + + 操作库选择 + + + + + + + 0 + 300 + 271 + 17 + + + + 结束条件(可上传多张图片): + + + + + + 0 + 330 + 201 + 31 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">图片地址</p></body></html> + + + + + + 220 + 330 + 41 + 31 + + + + 上传 + + + + + + 120 + 120 + 91 + 31 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">图片地址</p></body></html> + + + + + + + 230 + 370 + 41 + 25 + + + + next + + + + + + 160 + 370 + 71 + 25 + + + + previous + + + + + + 160 + 410 + 89 + 41 + + + + 保存 + + + + + + 30 + 410 + 89 + 41 + + + + 取消 + + + + + + + diff --git a/src/windows/res/ui/translate_window.ui b/src/windows/res/ui/translate_window.ui new file mode 100644 index 0000000..d1c816a --- /dev/null +++ b/src/windows/res/ui/translate_window.ui @@ -0,0 +1,63 @@ + + + Form + + + + 0 + 0 + 1069 + 99 + + + + Form + + + + + 0 + 180 + 1071 + 161 + + + + + + + -10 + 0 + 1081 + 61 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:18pt;">翻译原文</span></p></body></html> + + + + + + -10 + 50 + 1101 + 241 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:18pt;">翻译文字显示</span></p></body></html> + + + + + + diff --git a/src/windows/selectRuleOrder.py b/src/windows/selectRuleOrder.py new file mode 100644 index 0000000..109fc51 --- /dev/null +++ b/src/windows/selectRuleOrder.py @@ -0,0 +1,41 @@ +import os +from PyQt5.QtWidgets import QMainWindow, QListWidget, QPushButton +from PyQt5 import uic +from windows.res.rules.明日方舟自动清体力 import WorkerThread + + +class orderselet(QMainWindow): + def __init__(self): + super().__init__() + # 创建一个新窗口并加载translate.ui文件 + self.worker_thread = None + uic.loadUi('res/ui/selectRuleOrder.ui', self) + self.order_list = self.findChild(QListWidget, 'orderList') + self.confirmBtn = self.findChild(QPushButton, 'confirmBtn') + self.cancelBtn = self.findChild(QPushButton, 'cancelBtn') + + self.confirmBtn.clicked.connect(self.confirm_clicked) + self.cancelBtn.clicked.connect(self.cancel_clicked) + + def closeEvent(self, event): + # 此方法会在窗口关闭时被调用 + # 在这里,您可以添加关闭窗口前的自定义操作 + + self.order_list.clear() + + def confirm_clicked(self): + + try: + self.worker_thread = WorkerThread() + self.worker_thread.finished.connect(self.worker_thread_finished) + self.worker_thread.start() + self.close() + except Exception as e: + print(f"An error occurred: {str(e)}") + + + def worker_thread_finished(self): + # 处理线程完成后的逻辑 + pass + def cancel_clicked(self): + self.close() diff --git a/src/windows/settingrule_window.py b/src/windows/settingrule_window.py new file mode 100644 index 0000000..1aa9c49 --- /dev/null +++ b/src/windows/settingrule_window.py @@ -0,0 +1,26 @@ +from PyQt5.QtWidgets import QMainWindow, QComboBox +from PyQt5 import uic + +from operateselect_window import operateselect + + +class settingrule(QMainWindow): + def __init__(self): + super().__init__() + + uic.loadUi('res/ui/setRule_window.ui', self) + + self.operateChoseBox = self.findChild(QComboBox, 'operateChose') + + self.operateChoseBox.activated.connect(self.handleComboBoxActivated) + + self.operateselect_window = operateselect() + + def handleComboBoxActivated(self, index): + selected_option = self.operateChoseBox.itemText(index) + if selected_option == "操作库选择": + self.create新界面() + + def create新界面(self): + # 显示新界面 + self.operateselect_window.show() diff --git a/src/windows/translate_window.py b/src/windows/translate_window.py new file mode 100644 index 0000000..c433996 --- /dev/null +++ b/src/windows/translate_window.py @@ -0,0 +1,9 @@ +from PyQt5.QtWidgets import QMainWindow +from PyQt5 import uic + + +class translate(QMainWindow): + def __init__(self): + super().__init__() + # 创建一个新窗口并加载translate.ui文件 + uic.loadUi('res/ui/translate_window.ui', self)