From 0e7adcb3a0b0674e5c482230072230e95a26bce5 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Fri, 16 Jun 2023 23:23:19 +0800 Subject: [PATCH] [build skip] [build rs skip] rename+remove --- Difficult_Rocket/__init__.py | 65 ++++++++-------------------- Difficult_Rocket/main.py | 4 +- configs/sys_value/basic_config.json5 | 31 ------------- configs/sys_value/parts.json5 | 49 --------------------- configs/sys_value/planet.json5 | 17 -------- configs/textures.toml | 27 ------------ docs/src/change_log/dr_sdk.md | 58 +++++++++++++++++++++++++ 7 files changed, 79 insertions(+), 172 deletions(-) delete mode 100644 configs/sys_value/basic_config.json5 delete mode 100644 configs/sys_value/parts.json5 delete mode 100644 configs/sys_value/planet.json5 delete mode 100644 configs/textures.toml diff --git a/Difficult_Rocket/__init__.py b/Difficult_Rocket/__init__.py index 4ea2210..201f00a 100644 --- a/Difficult_Rocket/__init__.py +++ b/Difficult_Rocket/__init__.py @@ -19,43 +19,21 @@ build_version = Version("2.1.0.0") # 编译文件版本(与游戏本体无关) Api_version = Version("0.1.1.0") # API 版本 __version__ = game_version -long_version: int = 15 -""" -long_version: 一个用于标记内部协议的整数 -15: 完全移除 DR_rust 相关内容 解耦完成 -14: BaseScreen 的每一个函数都添加了一个参数: window: "ClientWindow" -13: 为 DR_runtime 添加 API_version -12: 去除 DR_runtime 的 global_logger - 要 logging 自己拿去( -11: 为 DR_option 添加 use_DR_rust - 修复了一些拼写错误 -10: 为 DR_runtime 添加 DR_Rust_get_version -9 : 为 DR_option 添加 pyglet_macosx_dev_test -8 : 为 DR_runtime 添加 DR_rust_version - 为 DR_option 添加 DR_rust_available - 以后就有 DR_rust 了 -7 : 为 DR_option 添加 std_font_size -6 : 事实证明, 不如直接用int -5 : 添加 build_version 信息,用于标记编译文件版本, - 游戏版本改为四位数,终于有一个可以让我随便刷的版本号位数了 -4 : 把 translate 的字体常量位置改了一下,顺便调换顺序 -3 : 就是试试改一下,正好 compiler 要用 -2 : 哦,对 longlong 好耶! -1 : 我可算想起来还有这回事了 v0.6.4 -""" - -class _DR_option(Options): +class _DR_status(Options): """ - DR 的一般配置/状态 + DR 的特性开关 / 基本状态 """ name = 'DR Option' - # runtime options + # run status + client_running: bool = False + server_running: bool = False + + # feature switch InputBox_use_TextEntry: bool = True record_threads: bool = True report_translate_not_found: bool = True use_multiprocess: bool = False - DR_rust_available: bool = False use_cProfile: bool = False use_local_logging: bool = False @@ -64,6 +42,16 @@ class _DR_option(Options): debugging: bool = False crash_report_test: bool = False + # game version status + DR_version: Version = game_version # DR SDK 版本 + Build_version: Version = build_version # DR 构建 版本 + API_version: Version = Api_version # DR SDK API 版本 + + # game options + language: str = 'zh-CN' + mod_path: str = './mods' + default_language: str = 'zh-CN' + # window option gui_scale: float = 1.0 # default 1.0 2.0 -> 2x 3 -> 3x @@ -77,29 +65,14 @@ class _DR_runtime(Options): DR 的运行时配置/状态 """ name = 'DR Runtime' - # game version status - DR_version: Version = game_version # DR SDK 版本 - Build_version: Version = build_version # DR 构建 版本 - - API_version: Version = Api_version # DR SDK API 版本 - DR_long_version: int = long_version # DR SDK 内部协议版本 (不要问我为什么不用 Version,我也在考虑) DR_Mod_List: List[Tuple[str, Version]] = [] # DR Mod 列表 (name, version) # run status - running: bool = False start_time_ns: Optional[int] = None client_setup_cause_ns: Optional[int] = None server_setup_cause_ns: Optional[int] = None - # game runtimes - # global_logger: logging.Logger - - # game options - mod_path: str = './mods' - language: str = 'zh-CN' - default_language: str = 'zh-CN' - def load_file(self) -> bool: with contextlib.suppress(FileNotFoundError): with open('./configs/main.toml', 'r', encoding='utf-8') as f: @@ -141,10 +114,10 @@ class _DR_runtime(Options): return mods -DR_option = _DR_option() +DR_status = _DR_status() DR_runtime = _DR_runtime() -if DR_option.playing: +if DR_status.playing: from Difficult_Rocket.utils.thread import new_thread def think_it(something): diff --git a/Difficult_Rocket/main.py b/Difficult_Rocket/main.py index 5f186bc..d888ea1 100644 --- a/Difficult_Rocket/main.py +++ b/Difficult_Rocket/main.py @@ -37,7 +37,7 @@ from Difficult_Rocket.api.types import Options from Difficult_Rocket.utils.translate import tr from Difficult_Rocket.utils.thread import new_thread from Difficult_Rocket.crash import write_info_to_cache -from Difficult_Rocket import client, server, DR_option, DR_runtime +from Difficult_Rocket import client, server, DR_status, DR_runtime class Console(Options): @@ -154,7 +154,7 @@ class Game(Options): def start(self): self.server.run() - if DR_option.use_multiprocess: + if DR_status.use_multiprocess: try: game_process = multiprocessing.Process(target=self.client.start, name='pyglet app') game_process.start() diff --git a/configs/sys_value/basic_config.json5 b/configs/sys_value/basic_config.json5 deleted file mode 100644 index b66dda2..0000000 --- a/configs/sys_value/basic_config.json5 +++ /dev/null @@ -1,31 +0,0 @@ -{ - 'language': 'zh-cn', - 'textures': { - 'back_ground_space': 'back_ground_space.png', - 'planet': { - 'earth_ground': 'earth_ground.png' - }, - 'flame': { - 'liquid': 'liquid_engine_flame.png', - 'solid': 'solid_engine_flame.png', - 'ion': 'ion_engine_flame.png' - } - }, - 'basic_number': { - 'G': [ - 6.67, - -11, - [ - 'N', - 'm', - 'm' - ], - [ - 'kg', - 'kg' - ] - ] - }, - 'default ship': [ - ] -} \ No newline at end of file diff --git a/configs/sys_value/parts.json5 b/configs/sys_value/parts.json5 deleted file mode 100644 index c75dfd2..0000000 --- a/configs/sys_value/parts.json5 +++ /dev/null @@ -1,49 +0,0 @@ -{ - /* - 'part id': [ - [ - 'part name', // part name can be reuse - 'description', // 描述 - ], // about names and other - [ 'float', // mass - 'bool', // hidden in part list - 'bool', // hidden in mission (even thought that is not done yet) - 'float' // buoyancy(浮力) in the water - ], // about config - [ 'xxx.png', // texture file name - //可以为包含文件夹的 比如:./engine/xxx.png - [ 'float', // 贴图偏移量 - 'float' ] // 指的是部件的碰撞箱左上角到贴图左上角的距离 - ], // about texture - [ 'float', - 'float' ], - // 碰撞箱大小 (暂时只支持方形碰撞箱) - // 坐标轴也是从左下开始 - [ - '特殊值(懒得写)' - ] - ], - */ - 'test1': [ - [ - 'test-1', - '一个测试用部件' - ], - [ - 1.0, - false, - 0.1 - ], - [ - 'parts/Beam.png', - [ - 0.0, - 0.0 - ] - ], - [ - 3.0, - 2.0 - ] - ] -} diff --git a/configs/sys_value/planet.json5 b/configs/sys_value/planet.json5 deleted file mode 100644 index fc1a7ec..0000000 --- a/configs/sys_value/planet.json5 +++ /dev/null @@ -1,17 +0,0 @@ -{ - 'Solar System': { - 'description': '', - 'planets': { - 'earth': { - 'description': '', - 'gravity': 9.81, - 'radius': 63710000, - 'map_color': [ - 103, - 157, - 255 - ] - } - } - } -} \ No newline at end of file diff --git a/configs/textures.toml b/configs/textures.toml deleted file mode 100644 index 07370af..0000000 --- a/configs/textures.toml +++ /dev/null @@ -1,27 +0,0 @@ -[Runtime] - -[Parts] -battery = "Battery.png" -beam = "Beam.png" -cover_bottom = "CoverBottom.png" -nose_cone = "NoseCone.png" - -[Editor] -[[runtime]] -"toolbar.dark" = "ToolbarDark.png" -"toolbar.light" = "ToolbarLight.png" -"button_side.dark" = "ButtonDarkSide.png" -"button_side.light" = "ButtonLightSide.png" - -[[toggle_button]] -stage = "ToolbarIconStaging.png" -add_part = "ToolbarIconAddPart.png" -menu = "ToolbarIconMenu.png" - -[[push_button]] -zoom = "ToolbarIconZoom.png" -"zoom.in" = "ToolbarIconZoomIn.png" -"zoom.out" = "ToolbarIconZoomOut.png" -play = "ToolbarIconPlay.png" -rotate = "RotateButton.png" -trash_can = "TrashCan.png" diff --git a/docs/src/change_log/dr_sdk.md b/docs/src/change_log/dr_sdk.md index 1ec87e8..e391237 100644 --- a/docs/src/change_log/dr_sdk.md +++ b/docs/src/change_log/dr_sdk.md @@ -4,6 +4,64 @@ - 最新版本号 - DR sdk: 0.8.2.0 +## DR sdk 0.8.3.0 + +### 添加 + +- `DR_status` + - 实际上就是 `DR_runtime` + - `DR_runtime` -> `DR_status` + - `client_running` + - 客户端是否在运行 + - Is client running + - `server_running` + - 服务器是否在运行 + - Is server running + +### 移动 + +- `Difficult_Rocket.DR_runtime` + - `DR_version` -> `DR_status.DR_version` + - `Build_version` -> `DR_status.Build_version` + - `API_version` -> `DR_status.API_version` + - `language` -> `DR_status.language` + - `mod_path` -> `DR_status.mod_path` + +### 删除 + +- `Diffiuclt_Rocket.long_version` + - 不再使用整数标记版本号 (反正 `Version` 有一个完整的版本号比较机制) + - No longer use integer to mark version number (since `Version` has a complete version comparison mechanism) +- `Difficult_Rocket.DR_rust_available` + - 似乎我忘记删掉这个 `DR_rs` 的耦合了 + +```python +long_version: int = 15 +""" +long_version: 一个用于标记内部协议的整数 +15: 完全移除 DR_rust 相关内容 解耦完成 +14: BaseScreen 的每一个函数都添加了一个参数: window: "ClientWindow" +13: 为 DR_runtime 添加 API_version +12: 去除 DR_runtime 的 global_logger + 要 logging 自己拿去( +11: 为 DR_option 添加 use_DR_rust + 修复了一些拼写错误 +10: 为 DR_runtime 添加 DR_Rust_get_version +9 : 为 DR_option 添加 pyglet_macosx_dev_test +8 : 为 DR_runtime 添加 DR_rust_version + 为 DR_option 添加 DR_rust_available + 以后就有 DR_rust 了 +7 : 为 DR_option 添加 std_font_size +6 : 事实证明, 不如直接用int +5 : 添加 build_version 信息,用于标记编译文件版本, + 游戏版本改为四位数,终于有一个可以让我随便刷的版本号位数了 +4 : 把 translate 的字体常量位置改了一下,顺便调换顺序 +3 : 就是试试改一下,正好 compiler 要用 +2 : 哦,对 longlong 好耶! +1 : 我可算想起来还有这回事了 v0.6.4 +""" +``` + ## DR sdk 0.8.2.0 ### Fix