DR -> DR SDK #16

Merged
shenjackyuanjie merged 41 commits from feature/dr-sdk into main 2023-05-03 00:40:53 +08:00
7 changed files with 21 additions and 11 deletions
Showing only changes of commit 8e5621fe97 - Show all commits

View File

@ -4,7 +4,6 @@
# All rights reserved # All rights reserved
# ------------------------------- # -------------------------------
import os
import sys import sys
import warnings import warnings
import importlib import importlib

View File

@ -11,6 +11,7 @@ github: @shenjackyuanjie
gitee: @shenjackyuanjie gitee: @shenjackyuanjie
""" """
# 单独导入的(或者就这一个有用的) from typing import TYPE_CHECKING
# lazy之后之前全部导入的(太多了写不动__all__了 if TYPE_CHECKING:
from Difficult_Rocket.api import delivery, screen, mod, exception

View File

@ -10,3 +10,8 @@ mail: 3695888@qq.com
github: @shenjackyuanjie github: @shenjackyuanjie
gitee: @shenjackyuanjie gitee: @shenjackyuanjie
""" """
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from Difficult_Rocket.api.exception import command, logger, main, threading, unsupport

View File

@ -161,6 +161,7 @@ class ClientWindow(Window):
self.game = game self.game = game
self.net_mode = net_mode self.net_mode = net_mode
self.run_input = False self.run_input = False
self.command_list: List[str] = []
# configs # configs
self.main_config = tools.load_file('./configs/main.toml') self.main_config = tools.load_file('./configs/main.toml')
self.game_config = tools.load_file('./configs/game.config') self.game_config = tools.load_file('./configs/game.config')
@ -228,10 +229,11 @@ class ClientWindow(Window):
continue continue
if get == 'stop': if get == 'stop':
self.run_input = False self.run_input = False
try: self.command_list.append(get)
self.on_command(line.CommandText(get)) # try:
except CommandError: # self.on_command(line.CommandText(get))
self.logger.error(traceback.format_exc()) # except CommandError:
# self.logger.error(traceback.format_exc())
self.logger.debug('read_input end') self.logger.debug('read_input end')
@new_thread('window save_info') @new_thread('window save_info')
@ -263,6 +265,9 @@ class ClientWindow(Window):
@_call_screen_after @_call_screen_after
def on_draw(self, *dt): def on_draw(self, *dt):
if self.command_list:
for command in self.command_list:
self.on_command(line.CommandText(command))
# self.logger.debug('on_draw call dt: {}'.format(dt)) # self.logger.debug('on_draw call dt: {}'.format(dt))
pyglet.gl.glClearColor(0.1, 0, 0, 0.0) pyglet.gl.glClearColor(0.1, 0, 0, 0.0)
self.clear() self.clear()

View File

@ -23,6 +23,6 @@ if ($do -or "311" -in $args) {
python3.11 setup.py build python3.11 setup.py build
} }
python3 post_build.py python3.8 post_build.py
Set-Location ..\..\..\ Set-Location ..\..\..\

Binary file not shown.

View File

@ -10,7 +10,7 @@ import traceback
from typing import Optional from typing import Optional
from MCDR.version import Version from libs.MCDR.version import Version
from Difficult_Rocket.main import Game from Difficult_Rocket.main import Game
from Difficult_Rocket.api.mod import ModInfo from Difficult_Rocket.api.mod import ModInfo
from Difficult_Rocket.api.types import Options from Difficult_Rocket.api.types import Options