a lot
This commit is contained in:
parent
0e7adcb3a0
commit
bf3e598369
4
DR.py
4
DR.py
@ -52,7 +52,7 @@ def main() -> int:
|
||||
|
||||
from Difficult_Rocket.exception import TestError
|
||||
from Difficult_Rocket import crash
|
||||
from Difficult_Rocket import DR_option
|
||||
from Difficult_Rocket import DR_status
|
||||
try:
|
||||
from libs import pyglet # 导入pyglet
|
||||
pyglet.resource.path = ['/textures/']
|
||||
@ -72,7 +72,7 @@ def main() -> int:
|
||||
cProfile.run('game.start()', sort='calls') # 使用 cprofile 启动
|
||||
else:
|
||||
game.start() # 直接启动
|
||||
if DR_option.crash_report_test:
|
||||
if DR_status.crash_report_test:
|
||||
raise TestError('debugging') # debug 嘛,试试crash
|
||||
except Exception as exp: # 出毛病了
|
||||
# 解析错误信息
|
||||
|
@ -48,8 +48,6 @@ class _DR_status(Options):
|
||||
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
|
||||
@ -66,6 +64,8 @@ class _DR_runtime(Options):
|
||||
"""
|
||||
name = 'DR Runtime'
|
||||
|
||||
language: str = 'zh-CN'
|
||||
mod_path: str = './mods'
|
||||
DR_Mod_List: List[Tuple[str, Version]] = [] # DR Mod 列表 (name, version)
|
||||
|
||||
# run status
|
||||
|
@ -31,7 +31,7 @@ from pyglet.text.layout import IncrementalTextLayout
|
||||
|
||||
from Difficult_Rocket.api.types import FontData, Fonts
|
||||
# from Difficult_Rocket.client.guis.format import html
|
||||
from Difficult_Rocket import DR_option
|
||||
from Difficult_Rocket import DR_status
|
||||
|
||||
__all__ = ['InputBox']
|
||||
|
||||
@ -59,7 +59,7 @@ class TextButton(widgets.WidgetBase):
|
||||
...
|
||||
|
||||
|
||||
if not DR_option.InputBox_use_TextEntry:
|
||||
if not DR_status.InputBox_use_TextEntry:
|
||||
class InputBox(widgets.TextEntry):
|
||||
""" 自定义的输入框 """
|
||||
|
||||
@ -134,7 +134,7 @@ if not DR_option.InputBox_use_TextEntry:
|
||||
# dpi=font_dpi)
|
||||
# self.font_height = self.font.ascent - self.font.descent
|
||||
# self.out_bound = out_line
|
||||
# if DR_option.InputBox_use_TextEntry:
|
||||
# if DR_status.InputBox_use_TextEntry:
|
||||
# # 基于IncrementalTextLayout的处理系统
|
||||
# self._doc = FormattedDocument(message)
|
||||
# # self._doc.set_style()
|
||||
|
@ -99,14 +99,14 @@ def write_cache(cache_stream, crash_info):
|
||||
|
||||
def write_info_to_cache(cache_stream):
|
||||
# 运行状态信息
|
||||
from Difficult_Rocket import DR_option, DR_runtime
|
||||
from Difficult_Rocket import DR_status, DR_runtime
|
||||
cache_stream.write(Run_message)
|
||||
cache_stream.write(markdown_line_handler(f'DR Version: {Difficult_Rocket.game_version}', level=1))
|
||||
cache_stream.write(markdown_line_handler(f'DR language: {DR_runtime.language}', level=1))
|
||||
cache_stream.write(markdown_line_handler(f'Running Dir: {Path(os.curdir).resolve()}', level=1))
|
||||
cache_stream.write(f"\n{DR_runtime.as_markdown()}")
|
||||
cache_stream.write(DR_configs)
|
||||
cache_stream.write(f"\n{DR_option.as_markdown()}")
|
||||
cache_stream.write(f"\n{DR_status.as_markdown()}")
|
||||
cache_stream.write(Process_message)
|
||||
for process in all_process:
|
||||
process: multiprocessing.Process
|
||||
|
@ -22,7 +22,7 @@ if TYPE_CHECKING:
|
||||
else:
|
||||
Game = TypeVar("Game")
|
||||
ClientWindow = TypeVar("ClientWindow")
|
||||
from Difficult_Rocket import DR_runtime
|
||||
from Difficult_Rocket import DR_status
|
||||
from Difficult_Rocket.api.types import Options, Version
|
||||
|
||||
RequireVersion = Tuple[Version, Version]
|
||||
@ -47,8 +47,8 @@ class ModInfo(Options):
|
||||
info: str = "" # 其他信息 (可以很多很多)
|
||||
|
||||
"""版本相关信息"""
|
||||
DR_version: RequireVersion = (DR_runtime.DR_version, DR_runtime.DR_version) # DR SDK 兼容版本
|
||||
DR_Api_version: RequireVersion = (DR_runtime.API_version, DR_runtime.API_version) # DR Api版本
|
||||
DR_version: RequireVersion = (DR_status.DR_version, DR_status.DR_version) # DR SDK 兼容版本
|
||||
DR_Api_version: RequireVersion = (DR_status.API_version, DR_status.API_version) # DR Api版本
|
||||
Mod_Require_version: List[Tuple[str, ForceRequire, RequireVersion]] = [] # mod 依赖版本
|
||||
|
||||
"""mod 状态"""
|
||||
|
@ -11,7 +11,7 @@ from typing import List, Dict, Optional
|
||||
from Difficult_Rocket.api.screen import BaseScreen
|
||||
from Difficult_Rocket.api.types import Options, Version
|
||||
from Difficult_Rocket.mod.api import ModInfo
|
||||
# from Difficult_Rocket import DR_option, DR_runtime
|
||||
# from Difficult_Rocket import DR_status, DR_runtime
|
||||
|
||||
|
||||
class ModManager(Options):
|
||||
|
@ -17,7 +17,7 @@ import inspect
|
||||
from dataclasses import dataclass
|
||||
from typing import Union, Tuple, Any, List, Dict, Hashable, Optional
|
||||
|
||||
from Difficult_Rocket import DR_runtime, DR_option
|
||||
from Difficult_Rocket import DR_runtime, DR_status
|
||||
from Difficult_Rocket.utils import tools
|
||||
from Difficult_Rocket.exception.language import (LanguageNotFound,
|
||||
TranslateKeyNotFound)
|
||||
@ -82,7 +82,7 @@ class Translates:
|
||||
def _raise_no_value(self, e: Exception, item: key_type):
|
||||
if self._config.raise_error:
|
||||
raise TranslateKeyNotFound(self._value, [x[1] for x in self._get_list]) from None
|
||||
elif DR_option.report_translate_not_found:
|
||||
elif DR_status.report_translate_not_found:
|
||||
frame = inspect.currentframe()
|
||||
if frame is not None:
|
||||
frame = frame.f_back.f_back
|
||||
@ -160,7 +160,7 @@ class Tr:
|
||||
"""
|
||||
self.language_name = language if language is not None else DR_runtime.language
|
||||
self.translates: Dict[str, Union[str, Dict]] = tools.load_file(f'configs/lang/{self.language_name}.toml')
|
||||
self.default_translate: Dict = tools.load_file(f'configs/lang/{DR_runtime.default_language}.toml')
|
||||
self.default_translate: Dict = tools.load_file(f'configs/lang/{DR_status.default_language}.toml')
|
||||
self.default_config = config.set('source', self) if config is not None else TranslateConfig(source=self)
|
||||
self.translates_cache = Translates(value=self.translates, config=self.default_config.copy())
|
||||
|
||||
|
@ -2,9 +2,15 @@
|
||||
# DR game/DR rs 更新日志
|
||||
|
||||
- 最新版本号
|
||||
- DR game: 0.1.1.0
|
||||
- DR game: 0.2.0.0
|
||||
- DR rs: 0.2.10.1
|
||||
|
||||
## DR game 0.2.0.0
|
||||
|
||||
### 适配
|
||||
|
||||
- 适配了 `DR_sdk` `0.8.3.0` 的修改
|
||||
|
||||
## DR game 0.1.1.0
|
||||
|
||||
### 添加
|
||||
|
@ -22,10 +22,9 @@
|
||||
|
||||
- `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`
|
||||
- `Build_version` -> `DR_status.Build_version`
|
||||
- `default_language` -> `DR_status.default_language`
|
||||
|
||||
### 删除
|
||||
|
||||
|
@ -1,3 +0,0 @@
|
||||
python3.8 setup.py build
|
||||
python3.9 setup.py build
|
||||
python3.9 post_build.py
|
@ -49,7 +49,7 @@ class DR_mod(ModInfo):
|
||||
|
||||
mod_id = "difficult_rocket_mod"
|
||||
name = "Difficult Rocket mod"
|
||||
version = Version("0.1.0.0")
|
||||
version = Version("0.2.0.0")
|
||||
|
||||
writer = "shenjackyuanjie"
|
||||
link = "shenjack.top"
|
||||
|
@ -27,7 +27,7 @@ from pyglet.graphics import Batch, Group
|
||||
from . import DR_mod_runtime
|
||||
|
||||
# Difficult Rocket
|
||||
from Difficult_Rocket import DR_option
|
||||
from Difficult_Rocket import DR_status
|
||||
from Difficult_Rocket.utils.translate import tr
|
||||
from Difficult_Rocket.api.types import Fonts, Options
|
||||
from Difficult_Rocket.command.line import CommandText
|
||||
@ -124,7 +124,7 @@ class SR1ShipRender(BaseScreen):
|
||||
self.part_box_batch = Batch()
|
||||
self.part_batch = Batch()
|
||||
self.part_group = Group()
|
||||
self.debug_label = Label(x=20, y=main_window.height - 20, font_size=DR_option.std_font_size,
|
||||
self.debug_label = Label(x=20, y=main_window.height - 20, font_size=DR_status.std_font_size,
|
||||
text='SR1 render!', font_name=Fonts.微软等宽无线,
|
||||
width=main_window.width - 20, height=20,
|
||||
anchor_x='left', anchor_y='top')
|
||||
@ -171,7 +171,7 @@ class SR1ShipRender(BaseScreen):
|
||||
self.drawing = True
|
||||
for part_id, part in part_datas.items():
|
||||
# 下面就是调用 pyglet 去渲染的部分
|
||||
# render_scale = DR_option.gui_scale # 这个是 DR 的缩放比例 可以调节的(
|
||||
# render_scale = DR_status.gui_scale # 这个是 DR 的缩放比例 可以调节的(
|
||||
# 主要是 Windows 下有一个缩放系数嘛,我待会试试这玩意能不能获取(估计得 ctypes
|
||||
# 在不缩放的情况下,XML的1个单位长度对应60个像素
|
||||
render_x = part.x * 60
|
||||
|
Loading…
Reference in New Issue
Block a user