From 3784a3218454d8daa96f56e730a006ede022b21f Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Sun, 18 Jun 2023 14:33:20 +0800 Subject: [PATCH] fix issue --- Difficult_Rocket/client/__init__.py | 1 + Difficult_Rocket/command/api.py | 8 ++++---- mods/dr_game/lang/zh-CN.toml | 0 mods/dr_game/sr1_ship.py | 1 - 4 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 mods/dr_game/lang/zh-CN.toml diff --git a/Difficult_Rocket/client/__init__.py b/Difficult_Rocket/client/__init__.py index 91a3e7c..40e4e81 100644 --- a/Difficult_Rocket/client/__init__.py +++ b/Difficult_Rocket/client/__init__.py @@ -309,6 +309,7 @@ class ClientWindow(Window): @_call_screen_after def on_command(self, command: line.CommandText): self.logger.info(tr().window.command.text().format(command)) + command.find('/') if command.find('stop'): # self.dispatch_event('on_exit') print("command stop!") diff --git a/Difficult_Rocket/command/api.py b/Difficult_Rocket/command/api.py index 78a236e..220724c 100644 --- a/Difficult_Rocket/command/api.py +++ b/Difficult_Rocket/command/api.py @@ -44,12 +44,12 @@ class CommandText: i += 1 def find(self, text: str) -> bool: - print(f'text: {text} startswith: {self.text.startswith(text)} find: {self.text.find(text)}') - startswitch = self.text.startswith(text) - if startswitch: + startswith = self.text.startswith(text) + if startswith: find = self.text.find(text) if find != -1: - self.text = self.text[find + len(text):] if not self.text[find+len(text)] == ' ' else self.text[find + len(text) + 1:] + if not len(text) == len(self.text): + self.text = self.text[find + len(text):] if not self.text[find+len(text)] == ' ' else self.text[find + len(text) + 1:] return True return False diff --git a/mods/dr_game/lang/zh-CN.toml b/mods/dr_game/lang/zh-CN.toml new file mode 100644 index 0000000..e69de29 diff --git a/mods/dr_game/sr1_ship.py b/mods/dr_game/sr1_ship.py index 119d2a0..6402379 100644 --- a/mods/dr_game/sr1_ship.py +++ b/mods/dr_game/sr1_ship.py @@ -403,7 +403,6 @@ class SR1ShipRender(BaseScreen): return img_box = self.rust_ship.img_pos img_size = (img_box[2] - img_box[0] + 1000, img_box[3] - img_box[1] + 1000) - # img_center = (abs(img_box[0]), abs(img_box[1])) # 中心点是左上角坐标 img_center = (abs(img_box[0]), abs(img_box[3])) print(f"img_box: {img_box} img_size: {img_size} img_center: {img_center}")