Merge pull request #41 from shenjackyuanjie/feature/assets
Feature/assets
4
.github/workflows/get_info.py
vendored
@ -19,10 +19,10 @@ if sys.argv == [__file__]: # 没有输入参数,直接输出默认信息并
|
|||||||
print(sys.version)
|
print(sys.version)
|
||||||
from Difficult_Rocket.utils import tools
|
from Difficult_Rocket.utils import tools
|
||||||
# 重置窗口信息
|
# 重置窗口信息
|
||||||
config_file = tools.load_file('./configs/main.toml')
|
config_file = tools.load_file('./config/main.toml')
|
||||||
config_file['window']['width'] = 1024
|
config_file['window']['width'] = 1024
|
||||||
config_file['window']['height'] = 768
|
config_file['window']['height'] = 768
|
||||||
rtoml.dump(config_file, open('./configs/main.toml', 'w'))
|
rtoml.dump(config_file, open('./config/main.toml', 'w'))
|
||||||
|
|
||||||
elif os.path.abspath(os.curdir) in sys.path and '-env' in sys.argv:
|
elif os.path.abspath(os.curdir) in sys.path and '-env' in sys.argv:
|
||||||
with open('./.github/workflows/env.ps1', encoding='utf-8', mode='w') as env_file:
|
with open('./.github/workflows/env.ps1', encoding='utf-8', mode='w') as env_file:
|
||||||
|
2
.github/workflows/nuitka.yml
vendored
@ -7,7 +7,6 @@ on:
|
|||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
- "Difficult_Rocket/**" # 本体修改
|
- "Difficult_Rocket/**" # 本体修改
|
||||||
- "configs/**" # 配置修改
|
|
||||||
- "libs/pyglet/**" # pyglet 修改
|
- "libs/pyglet/**" # pyglet 修改
|
||||||
- ".github/workflows/**" # workflow 修改
|
- ".github/workflows/**" # workflow 修改
|
||||||
- "nuitka_build.py" # 构建脚本修改
|
- "nuitka_build.py" # 构建脚本修改
|
||||||
@ -15,7 +14,6 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- "Difficult_Rocket/**" # 本体修改
|
- "Difficult_Rocket/**" # 本体修改
|
||||||
- "configs/**" # 配置修改
|
|
||||||
- "libs/pyglet/**" # pyglet 修改
|
- "libs/pyglet/**" # pyglet 修改
|
||||||
- ".github/workflows/**" # workflow 修改
|
- ".github/workflows/**" # workflow 修改
|
||||||
- "nuitka_build.py" # 构建脚本修改
|
- "nuitka_build.py" # 构建脚本修改
|
||||||
|
@ -10,7 +10,7 @@ from pathlib import Path
|
|||||||
|
|
||||||
from Difficult_Rocket.api.types import Options, Version
|
from Difficult_Rocket.api.types import Options, Version
|
||||||
|
|
||||||
sdk_version = Version("0.8.5.2") # SDK 版本
|
sdk_version = Version("0.8.6.0") # SDK 版本
|
||||||
build_version = Version("2.1.3.0") # 编译文件版本(与游戏本体无关)
|
build_version = Version("2.1.3.0") # 编译文件版本(与游戏本体无关)
|
||||||
Api_version = Version("0.1.1.0") # API 版本
|
Api_version = Version("0.1.1.0") # API 版本
|
||||||
__version__ = sdk_version
|
__version__ = sdk_version
|
||||||
@ -76,7 +76,7 @@ DR_status = _DR_status()
|
|||||||
|
|
||||||
|
|
||||||
def load_logging():
|
def load_logging():
|
||||||
with open('./configs/logger.toml') as f:
|
with open('./config/logger.toml') as f:
|
||||||
import rtoml
|
import rtoml
|
||||||
logger_config = rtoml.load(f)
|
logger_config = rtoml.load(f)
|
||||||
log_path = logger_config['handlers']['file']['filename']
|
log_path = logger_config['handlers']['file']['filename']
|
||||||
|
@ -59,7 +59,7 @@ class ClientOption(Options):
|
|||||||
caption: str = "Difficult Rocket v{DR_version}"
|
caption: str = "Difficult Rocket v{DR_version}"
|
||||||
|
|
||||||
def load_file(self) -> None:
|
def load_file(self) -> None:
|
||||||
file: dict = tools.load_file('./configs/main.toml')
|
file: dict = tools.load_file('./config/main.toml')
|
||||||
self.fps = int(file['runtime']['fps'])
|
self.fps = int(file['runtime']['fps'])
|
||||||
self.width = int(file['window']['width'])
|
self.width = int(file['window']['width'])
|
||||||
self.height = int(file['window']['height'])
|
self.height = int(file['window']['height'])
|
||||||
@ -215,9 +215,9 @@ class ClientWindow(Window):
|
|||||||
self.net_mode = net_mode
|
self.net_mode = net_mode
|
||||||
self.run_input = False
|
self.run_input = False
|
||||||
self.command_list: List[str] = []
|
self.command_list: List[str] = []
|
||||||
# configs
|
# config
|
||||||
self.main_config = tools.load_file('./configs/main.toml')
|
self.main_config = tools.load_file('./config/main.toml')
|
||||||
self.game_config = tools.load_file('./configs/game.config')
|
self.game_config = tools.load_file('./config/game.config')
|
||||||
# FPS
|
# FPS
|
||||||
self.FPS = Decimal(int(self.main_config['runtime']['fps']))
|
self.FPS = Decimal(int(self.main_config['runtime']['fps']))
|
||||||
self.SPF = Decimal('1') / self.FPS
|
self.SPF = Decimal('1') / self.FPS
|
||||||
@ -250,7 +250,7 @@ class ClientWindow(Window):
|
|||||||
self.count = 0
|
self.count = 0
|
||||||
|
|
||||||
def setup(self):
|
def setup(self):
|
||||||
self.set_icon(pyglet.image.load('./textures/icon.png'))
|
self.set_icon(pyglet.image.load('assets/textures/icon.png'))
|
||||||
self.load_fonts()
|
self.load_fonts()
|
||||||
self.screen_list['DR_debug'] = DRDEBUGScreen(self)
|
self.screen_list['DR_debug'] = DRDEBUGScreen(self)
|
||||||
self.game.dispatch_mod_event('on_client_start', game=self.game, client=self)
|
self.game.dispatch_mod_event('on_client_start', game=self.game, client=self)
|
||||||
@ -262,7 +262,7 @@ class ClientWindow(Window):
|
|||||||
pyglet_load_fonts_folder(fonts_folder_path)
|
pyglet_load_fonts_folder(fonts_folder_path)
|
||||||
|
|
||||||
def start_game(self) -> None:
|
def start_game(self) -> None:
|
||||||
self.set_icon(pyglet.image.load('./textures/icon.png'))
|
self.set_icon(pyglet.image.load('assets/textures/icon.png'))
|
||||||
try:
|
try:
|
||||||
pyglet.app.event_loop.run(1 / self.main_config['runtime']['fps'])
|
pyglet.app.event_loop.run(1 / self.main_config['runtime']['fps'])
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
@ -275,11 +275,11 @@ class ClientWindow(Window):
|
|||||||
@new_thread('window save_info')
|
@new_thread('window save_info')
|
||||||
def save_info(self):
|
def save_info(self):
|
||||||
self.logger.info(tr().client.config.save.start())
|
self.logger.info(tr().client.config.save.start())
|
||||||
config_file: dict = tools.load_file('./configs/main.toml')
|
config_file: dict = tools.load_file('./config/main.toml')
|
||||||
config_file['window']['width'] = self.width
|
config_file['window']['width'] = self.width
|
||||||
config_file['window']['height'] = self.height
|
config_file['window']['height'] = self.height
|
||||||
config_file['runtime']['language'] = DR_runtime.language
|
config_file['runtime']['language'] = DR_runtime.language
|
||||||
rtoml.dump(config_file, open('./configs/main.toml', 'w'))
|
rtoml.dump(config_file, open('./config/main.toml', 'w'))
|
||||||
self.logger.info(tr().client.config.save.done())
|
self.logger.info(tr().client.config.save.done())
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -373,7 +373,7 @@ class ClientWindow(Window):
|
|||||||
tr._language = lang
|
tr._language = lang
|
||||||
self.logger.info(tr().language_set_to())
|
self.logger.info(tr().language_set_to())
|
||||||
except LanguageNotFound:
|
except LanguageNotFound:
|
||||||
self.logger.info(tr().language_available().format(os.listdir('./configs/lang')))
|
self.logger.info(tr().language_available().format(os.listdir('./config/lang')))
|
||||||
self.save_info()
|
self.save_info()
|
||||||
elif command.find('mods'):
|
elif command.find('mods'):
|
||||||
if command.find('list'):
|
if command.find('list'):
|
||||||
|
@ -77,7 +77,7 @@ def create_crash_report(info: Optional[str] = None) -> None:
|
|||||||
crash_info = crash_info_handler(info)
|
crash_info = crash_info_handler(info)
|
||||||
if 'crash_report' not in os.listdir('./'):
|
if 'crash_report' not in os.listdir('./'):
|
||||||
os.mkdir('./crash_report')
|
os.mkdir('./crash_report')
|
||||||
date_time = time.strftime('%Y-%m-%d %H-%M-%S', time.gmtime(time.time()))
|
date_time = time.strftime('%Y-%m-%d %H-%M-%S', time.localtime())
|
||||||
filename = f'crash-{date_time}.md'
|
filename = f'crash-{date_time}.md'
|
||||||
cache_stream = io.StringIO()
|
cache_stream = io.StringIO()
|
||||||
try:
|
try:
|
||||||
@ -92,7 +92,7 @@ def create_crash_report(info: Optional[str] = None) -> None:
|
|||||||
|
|
||||||
def write_cache(cache_stream, crash_info):
|
def write_cache(cache_stream, crash_info):
|
||||||
# 开头信息
|
# 开头信息
|
||||||
cache_stream.write(Head_message.format(now_time=time.strftime('%Y/%m/%d %H:%M:%S', time.gmtime(time.time()))))
|
cache_stream.write(Head_message.format(now_time=time.strftime('%Y/%m/%d %H:%M:%S', time.localtime())))
|
||||||
# 崩溃信息
|
# 崩溃信息
|
||||||
cache_stream.write(crash_info)
|
cache_stream.write(crash_info)
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class _DR_runtime(Options):
|
|||||||
|
|
||||||
def load_file(self) -> bool:
|
def load_file(self) -> bool:
|
||||||
with contextlib.suppress(FileNotFoundError):
|
with contextlib.suppress(FileNotFoundError):
|
||||||
with open('./configs/main.toml', 'r', encoding='utf-8') as f:
|
with open('./config/main.toml', 'r', encoding='utf-8') as f:
|
||||||
import rtoml
|
import rtoml
|
||||||
config_file = rtoml.load(f)
|
config_file = rtoml.load(f)
|
||||||
self.language = config_file['runtime']['language']
|
self.language = config_file['runtime']['language']
|
||||||
|
@ -36,7 +36,7 @@ class Server:
|
|||||||
# os.set
|
# os.set
|
||||||
self.process_name = 'server process'
|
self.process_name = 'server process'
|
||||||
# config
|
# config
|
||||||
self.config = tools.load_file('configs/main.toml')
|
self.config = tools.load_file('config/main.toml')
|
||||||
# self.dev = Dev
|
# self.dev = Dev
|
||||||
# self.net_mode = net_mode
|
# self.net_mode = net_mode
|
||||||
self.logger.info(tr().server.setup.use_time().format(time.time() - start_time))
|
self.logger.info(tr().server.setup.use_time().format(time.time() - start_time))
|
||||||
|
@ -30,7 +30,7 @@ from Difficult_Rocket.exception.unsupport import NoMoreJson5
|
|||||||
# logger
|
# logger
|
||||||
tools_logger = logging.getLogger('tools')
|
tools_logger = logging.getLogger('tools')
|
||||||
"""
|
"""
|
||||||
file configs
|
file config
|
||||||
"""
|
"""
|
||||||
|
|
||||||
file_error = {FileNotFoundError: 'no {filetype} file was founded!:\n file name: {filename}\n file_type: {filetype}\n stack: {stack}',
|
file_error = {FileNotFoundError: 'no {filetype} file was founded!:\n file name: {filename}\n file_type: {filetype}\n stack: {stack}',
|
||||||
@ -99,7 +99,7 @@ def save_dict_file(file_name: str,
|
|||||||
|
|
||||||
|
|
||||||
# main config
|
# main config
|
||||||
main_config_file = load_file('./configs/main.toml')
|
main_config_file = load_file('./config/main.toml')
|
||||||
|
|
||||||
|
|
||||||
def get_At(name, in_xml, need_type=str):
|
def get_At(name, in_xml, need_type=str):
|
||||||
|
@ -165,7 +165,7 @@ class Tr:
|
|||||||
:param lang_path: 语言文件夹路径
|
:param lang_path: 语言文件夹路径
|
||||||
"""
|
"""
|
||||||
self.language_name = language if language is not None else DR_runtime.language
|
self.language_name = language if language is not None else DR_runtime.language
|
||||||
self.language_path = lang_path if lang_path is not None else Path('configs/lang')
|
self.language_path = lang_path if lang_path is not None else Path('assets/lang')
|
||||||
self.translates: Dict[str, Union[str, Dict]] = tools.load_file(self.language_path / f'{self.language_name}.toml')
|
self.translates: Dict[str, Union[str, Dict]] = tools.load_file(self.language_path / f'{self.language_name}.toml')
|
||||||
self.default_translate: Dict = tools.load_file(f'{self.language_path}/{DR_status.default_language}.toml')
|
self.default_translate: Dict = tools.load_file(f'{self.language_path}/{DR_status.default_language}.toml')
|
||||||
self.default_config = config.set('source', self) if config is not None else TranslateConfig(source=self)
|
self.default_config = config.set('source', self) if config is not None else TranslateConfig(source=self)
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
[关于版本号的说明](./docs/src/version.md)
|
[关于版本号的说明](./docs/src/version.md)
|
||||||
|
|
||||||
[![Generic badge](https://img.shields.io/badge/Release-0.8.5.1-blue.svg)](https://github.com/shenjackyuanjie/Difficult-Rocket/releases)
|
[![Generic badge](https://img.shields.io/badge/Release-0.8.5.1-blue.svg)](https://github.com/shenjackyuanjie/Difficult-Rocket/releases)
|
||||||
[![Generic badge](https://img.shields.io/badge/Pre_Release-0.8.5.1-blue.svg)](https://github.com/shenjackyuanjie/Difficult-Rocket/releases)
|
[![Generic badge](https://img.shields.io/badge/Pre_Release-0.8.6.0-blue.svg)](https://github.com/shenjackyuanjie/Difficult-Rocket/releases)
|
||||||
[![Generic badge](https://img.shields.io/badge/Devloping-0.8.6-blue.svg)](https://github.com/shenjackyuanjie/Difficult-Rocket/releases)
|
[![Generic badge](https://img.shields.io/badge/Devloping-0.8.6-blue.svg)](https://github.com/shenjackyuanjie/Difficult-Rocket/releases)
|
||||||
|
|
||||||
[![language badge](https://stats.deeptrain.net/repo/shenjackyuanjie/Difficult-Rocket?theme=dark)](https://stats.deeptrain.net/repo/shenjackyuanjie/Difficult-Rocket?theme=dark)
|
[![language badge](https://stats.deeptrain.net/repo/shenjackyuanjie/Difficult-Rocket?theme=dark)](https://stats.deeptrain.net/repo/shenjackyuanjie/Difficult-Rocket?theme=dark)
|
||||||
@ -94,7 +94,7 @@ viztracer >= 0.15.6; platform_python_implementation != "PyPy"
|
|||||||
vizplugins >= 0.1.3; platform_python_implementation != "PyPy"
|
vizplugins >= 0.1.3; platform_python_implementation != "PyPy"
|
||||||
|
|
||||||
# for compile
|
# for compile
|
||||||
nuitka >= 1.6.6
|
nuitka >= 1.7.5
|
||||||
ordered-set >= 4.1.0
|
ordered-set >= 4.1.0
|
||||||
imageio >= 2.31.0; (platform_python_implementation == "PyPy" and python_version < "3.10") or platform_python_implementation == "CPython"
|
imageio >= 2.31.0; (platform_python_implementation == "PyPy" and python_version < "3.10") or platform_python_implementation == "CPython"
|
||||||
wheel >= 0.40.0
|
wheel >= 0.40.0
|
||||||
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 121 B After Width: | Height: | Size: 121 B |
Before Width: | Height: | Size: 133 B After Width: | Height: | Size: 133 B |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 450 B After Width: | Height: | Size: 450 B |
Before Width: | Height: | Size: 517 B After Width: | Height: | Size: 517 B |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 140 B After Width: | Height: | Size: 140 B |
Before Width: | Height: | Size: 932 B After Width: | Height: | Size: 932 B |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 775 B After Width: | Height: | Size: 775 B |
Before Width: | Height: | Size: 540 B After Width: | Height: | Size: 540 B |
Before Width: | Height: | Size: 1004 B After Width: | Height: | Size: 1004 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 145 B After Width: | Height: | Size: 145 B |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 155 KiB After Width: | Height: | Size: 155 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 651 KiB After Width: | Height: | Size: 651 KiB |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 61 KiB |
Before Width: | Height: | Size: 105 KiB After Width: | Height: | Size: 105 KiB |
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 64 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 205 KiB After Width: | Height: | Size: 205 KiB |
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 369 KiB After Width: | Height: | Size: 369 KiB |
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 75 KiB |
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 651 KiB After Width: | Height: | Size: 651 KiB |
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 75 KiB |
Before Width: | Height: | Size: 451 KiB After Width: | Height: | Size: 451 KiB |
Before Width: | Height: | Size: 620 KiB After Width: | Height: | Size: 620 KiB |
Before Width: | Height: | Size: 405 KiB After Width: | Height: | Size: 405 KiB |
Before Width: | Height: | Size: 630 KiB After Width: | Height: | Size: 630 KiB |
Before Width: | Height: | Size: 288 KiB After Width: | Height: | Size: 288 KiB |
Before Width: | Height: | Size: 288 KiB After Width: | Height: | Size: 288 KiB |
Before Width: | Height: | Size: 288 KiB After Width: | Height: | Size: 288 KiB |
Before Width: | Height: | Size: 275 KiB After Width: | Height: | Size: 275 KiB |
Before Width: | Height: | Size: 270 KiB After Width: | Height: | Size: 270 KiB |
Before Width: | Height: | Size: 363 KiB After Width: | Height: | Size: 363 KiB |
Before Width: | Height: | Size: 409 KiB After Width: | Height: | Size: 409 KiB |
Before Width: | Height: | Size: 7.6 MiB After Width: | Height: | Size: 7.6 MiB |
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |