From 577d438b6419a82d0a80cba8a20246976a63fc4b Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Wed, 24 May 2023 00:43:11 +0800 Subject: [PATCH] dr game and DR sdk --- Difficult_Rocket/api/types/SR1/ship.py | 12 ------------ Difficult_Rocket/client/__init__.py | 3 +-- configs/main.toml | 4 ++-- docs/src/change_log/dr_game.md | 7 ++++++- docs/src/change_log/dr_sdk.md | 13 +++++++++++++ mods/dr_game/sr1_ship.py | 18 +++++++++--------- .../SR1/__init__.py => mods/dr_game/types.py | 0 7 files changed, 31 insertions(+), 26 deletions(-) delete mode 100644 Difficult_Rocket/api/types/SR1/ship.py rename Difficult_Rocket/api/types/SR1/__init__.py => mods/dr_game/types.py (100%) diff --git a/Difficult_Rocket/api/types/SR1/ship.py b/Difficult_Rocket/api/types/SR1/ship.py deleted file mode 100644 index 8fcca51..0000000 --- a/Difficult_Rocket/api/types/SR1/ship.py +++ /dev/null @@ -1,12 +0,0 @@ -# ------------------------------- -# Difficult Rocket -# Copyright © 2020-2023 by shenjackyuanjie 3695888@qq.com -# All rights reserved -# ------------------------------- - -""" -writen by shenjackyuanjie -mail: 3695888@qq.com -github: @shenjackyuanjie -gitee: @shenjackyuanjie -""" diff --git a/Difficult_Rocket/client/__init__.py b/Difficult_Rocket/client/__init__.py index 16a28d2..e917e2f 100644 --- a/Difficult_Rocket/client/__init__.py +++ b/Difficult_Rocket/client/__init__.py @@ -30,7 +30,7 @@ if TYPE_CHECKING: from Difficult_Rocket.main import Game from Difficult_Rocket.utils import tools from Difficult_Rocket.api.types import Options -from Difficult_Rocket.command import line, tree +from Difficult_Rocket.command import line from Difficult_Rocket.utils.translate import tr from Difficult_Rocket import DR_runtime from Difficult_Rocket.api.screen import BaseScreen @@ -176,7 +176,6 @@ class ClientWindow(Window): self.setup() # 命令显示 self.command_group = pyglet.graphics.Group(0) - self.command_tree = tree.CommandTree(tree.DR_command) self.input_box = InputBox(x=50, y=30, width=300, batch=self.label_batch, text='') # 实例化 self.input_box.push_handlers(self) diff --git a/configs/main.toml b/configs/main.toml index 1de24cb..2a6ae9b 100644 --- a/configs/main.toml +++ b/configs/main.toml @@ -7,8 +7,8 @@ fonts_folder = "libs/fonts" [window] style = "None" -width = 1261 -height = 711 +width = 1954 +height = 1266 visible = true gui_scale = 1 caption = "Difficult Rocket v{DR_version}|DR_rs v{DR_Rust_get_version}" diff --git a/docs/src/change_log/dr_game.md b/docs/src/change_log/dr_game.md index a3e5592..c1bf2bd 100644 --- a/docs/src/change_log/dr_game.md +++ b/docs/src/change_log/dr_game.md @@ -2,11 +2,16 @@ # DR game/DR rs 更新日志 - 最新版本号 - - DR game: 0.1.0.0 + - DR game: 0.1.1.0 - DR rs: 0.2.9.0 ## DR game 0.1.1.0 +### 添加 + +- `types.py` + - 从 `DR.api.types.SR1` 中移动过来 + ### 新功能 - `console.py` diff --git a/docs/src/change_log/dr_sdk.md b/docs/src/change_log/dr_sdk.md index e69de29..5cd486f 100644 --- a/docs/src/change_log/dr_sdk.md +++ b/docs/src/change_log/dr_sdk.md @@ -0,0 +1,13 @@ + +# DR SDK 更新日志 + +- 最新版本号 + - DR sdk: 0.8.1.0 + +## DR sdk 0.8.1.0 + +### 删除 + +- `api.types.SR1` + - 移动到 `dr_game` 中 + diff --git a/mods/dr_game/sr1_ship.py b/mods/dr_game/sr1_ship.py index 6a46b49..65e9dec 100644 --- a/mods/dr_game/sr1_ship.py +++ b/mods/dr_game/sr1_ship.py @@ -30,7 +30,7 @@ from Difficult_Rocket.utils.translate import tr from Difficult_Rocket.api.types import Fonts, Options from Difficult_Rocket.command.line import CommandText from Difficult_Rocket.client.screen import BaseScreen -from Difficult_Rocket.api.types.SR1 import SR1Textures, SR1PartTexture, SR1PartData, SR1Rotation, xml_bool +from .types import SR1Textures, SR1PartTexture, SR1PartData, SR1Rotation, xml_bool if TYPE_CHECKING: from Difficult_Rocket.client import ClientWindow @@ -318,8 +318,8 @@ class SR1ShipRender(BaseScreen): # self.update_parts() def on_command(self, command: CommandText, window: "ClientWindow"): - if command.re_match('render'): - if command.re_match('reset'): + if command.find('render'): + if command.find('reset'): self.camera_rs.zoom = 1 self.camera_rs.dx = 0 self.camera_rs.dy = 0 @@ -327,15 +327,15 @@ class SR1ShipRender(BaseScreen): else: self.need_draw = True print('应该渲染飞船的') - elif command.re_match('debug'): + elif command.find('debug'): print('sr ?') - if command.re_match('delta'): + if command.find('delta'): SR1ShipRender_Option.debug_d_pos = not SR1ShipRender_Option.debug_mouse_d_pos self.debug_line.visible = SR1ShipRender_Option.debug_d_pos self.debug_d_pos_label.visible = SR1ShipRender_Option.debug_d_pos # print('sr1 delta') - elif command.re_match('mouse'): - if command.re_match('delta'): + elif command.find('mouse'): + if command.find('delta'): SR1ShipRender_Option.debug_mouse_pos = not SR1ShipRender_Option.debug_mouse_pos self.debug_mouse_line.visible = SR1ShipRender_Option.debug_mouse_pos self.debug_mouse_label.visible = SR1ShipRender_Option.debug_mouse_pos @@ -344,7 +344,7 @@ class SR1ShipRender(BaseScreen): SR1ShipRender_Option.debug_mouse_d_pos = not SR1ShipRender_Option.debug_mouse_d_pos self.debug_mouse_delta_line.visible = SR1ShipRender_Option.debug_mouse_d_pos # print('sr1 mouse') - elif command.re_match('get_buf'): + elif command.find('get_buf'): def screenshot(window): from libs.pyglet.gl import GLubyte, GL_RGBA, GL_UNSIGNED_BYTE, \ @@ -361,7 +361,7 @@ class SR1ShipRender(BaseScreen): image_data = screenshot(self.window_pointer) image_data.save('test.png') - elif command.re_match('gen_img'): + elif command.find('gen_img'): if not self.rendered: return # ship_size = self.ship.size diff --git a/Difficult_Rocket/api/types/SR1/__init__.py b/mods/dr_game/types.py similarity index 100% rename from Difficult_Rocket/api/types/SR1/__init__.py rename to mods/dr_game/types.py