DR -> DR SDK #16
@ -197,8 +197,6 @@ class ClientWindow(Window):
|
||||
|
||||
def setup(self):
|
||||
self.set_icon(pyglet.image.load('./textures/icon.png'))
|
||||
self.logger.info(f"=== finding mods from {DR_runtime.mod_path} ===")
|
||||
self.logger.info(f'find mods: {DR_runtime.find_mods()}')
|
||||
self.load_fonts()
|
||||
# TODO 读取配置文件,加载不同的屏幕,解耦
|
||||
self.screen_list['DR_debug'] = DRDEBUGScreen(self)
|
||||
|
@ -80,6 +80,7 @@ class Game:
|
||||
if not mod_path.exists():
|
||||
self.logger.info(tr().main.mod.find.faild.no_mod_folder())
|
||||
return
|
||||
# 寻找有效 mod
|
||||
paths = mod_path.iterdir()
|
||||
sys.path.append(DR_runtime.mod_path)
|
||||
for mod_path in paths:
|
||||
@ -98,6 +99,7 @@ class Game:
|
||||
except ImportError as e:
|
||||
self.logger.warning(tr().main.mod.find.faild().format(mod_path, e))
|
||||
self.logger.info(tr().main.mod.find.done())
|
||||
# 加载有效 mod
|
||||
module = []
|
||||
for mod in mods:
|
||||
try:
|
||||
@ -118,6 +120,8 @@ class Game:
|
||||
mod_list = []
|
||||
for mod in module:
|
||||
mod_list.append((mod.mod_id, mod.version))
|
||||
# 调用 on_load
|
||||
self.dispatch_event('on_load', game=self)
|
||||
DR_runtime.DR_Mod_List = mod_list
|
||||
|
||||
def dispatch_event(self, event_name: str, *args, **kwargs) -> None:
|
||||
|
@ -28,6 +28,18 @@
|
||||
|
||||
> 啊啊啊啊啊 大重构 api
|
||||
|
||||
### DR_api `0.1.0.0`
|
||||
|
||||
- 大概是一个可用的版本了
|
||||
- `ModInfo`
|
||||
- `on_load(game: Game, old_self: Optional[ModInfo]) -> bool`
|
||||
- `game`: Game 对象 用于存储 DR SDK 的信息
|
||||
- `old_self`: 旧的 ModInfo 对象, 可以用于从上次加载中恢复信息
|
||||
- 返回值: 是否加载成功
|
||||
- `on_client_start(game: Game, client: ClientWindow) -> None`
|
||||
- `game`: Game 对象 用于存储 DR SDK 的信息
|
||||
- `client`: ClientWindow 对象 用于传递客户端状态
|
||||
|
||||
### DR_rs `0.2.7.0`
|
||||
|
||||
- `__init__.py`
|
||||
@ -52,6 +64,8 @@
|
||||
- `DR_option` & `DR_runtime`(`long_version` `15`)
|
||||
- 完全移除 `DR_rust` 部分
|
||||
- Completely removed the `DR_rust` part
|
||||
- 现在 `client` 不会在 `setup()` 中调用 `DR_runtime` 的 `find_mods()` 方法
|
||||
- Now `client` will not call the `find_mods()` method of `DR_runtime` in `setup()`
|
||||
|
||||
### Changes
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user