2021-09-08 23:38:34 +08:00
|
|
|
|
# -------------------------------
|
|
|
|
|
# Difficult Rocket
|
2022-06-27 16:51:14 +08:00
|
|
|
|
# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com
|
2021-09-08 23:38:34 +08:00
|
|
|
|
# All rights reserved
|
|
|
|
|
# -------------------------------
|
|
|
|
|
|
2021-04-02 23:31:54 +08:00
|
|
|
|
"""
|
2021-01-24 18:26:56 +08:00
|
|
|
|
writen by shenjackyuanjie
|
2021-09-02 22:47:10 +08:00
|
|
|
|
mail: 3695888@qq.com
|
2021-08-13 12:25:29 +08:00
|
|
|
|
github: @shenjackyuanjie
|
2021-09-02 22:47:10 +08:00
|
|
|
|
gitee: @shenjackyuanjie
|
2021-04-02 23:31:54 +08:00
|
|
|
|
"""
|
2022-11-26 21:48:55 +08:00
|
|
|
|
import ctypes
|
2022-12-08 09:53:22 +08:00
|
|
|
|
import logging
|
2022-11-08 20:18:01 +08:00
|
|
|
|
|
2023-01-01 21:54:59 +08:00
|
|
|
|
from Difficult_Rocket.api.types import Options
|
2022-08-03 20:22:36 +08:00
|
|
|
|
|
2022-04-08 23:07:41 +08:00
|
|
|
|
from libs.MCDR.version import Version
|
2022-02-16 13:36:26 +08:00
|
|
|
|
|
2023-01-03 15:34:22 +08:00
|
|
|
|
game_version = Version("0.6.4.1") # 游戏版本
|
2023-01-06 21:29:13 +08:00
|
|
|
|
build_version = Version("0.1.0.0") # 编译文件版本(与游戏本体无关)
|
2022-02-08 17:15:09 +08:00
|
|
|
|
__version__ = game_version
|
2021-01-24 18:26:56 +08:00
|
|
|
|
|
2023-01-06 21:43:18 +08:00
|
|
|
|
long_version: int = 6
|
2022-11-26 21:48:55 +08:00
|
|
|
|
"""
|
|
|
|
|
long_version: 一个用于标记内部协议的整数
|
2023-01-06 21:43:18 +08:00
|
|
|
|
6: 事实证明, 不如直接用int
|
2023-01-03 15:34:22 +08:00
|
|
|
|
5: 添加 build_version 信息,用于标记编译文件版本,
|
|
|
|
|
游戏版本改为四位数,终于有一个可以让我随便刷的版本号位数了
|
2023-01-02 17:22:39 +08:00
|
|
|
|
4: 把 translate 的字体常量位置改了一下,顺便调换顺序
|
2022-12-29 17:26:39 +08:00
|
|
|
|
3: 就是试试改一下,正好 compiler 要用
|
2023-01-02 17:22:39 +08:00
|
|
|
|
2: 哦,对 longlong 好耶!
|
|
|
|
|
1: 我可算想起来还有这回事了 v0.6.4
|
2022-11-26 21:48:55 +08:00
|
|
|
|
"""
|
2021-11-06 19:07:32 +08:00
|
|
|
|
|
2022-08-03 20:22:36 +08:00
|
|
|
|
|
2022-12-29 17:45:47 +08:00
|
|
|
|
class _DR_option(Options):
|
2022-08-12 21:07:36 +08:00
|
|
|
|
"""
|
|
|
|
|
DR 的整体配置存储类
|
|
|
|
|
"""
|
2022-11-20 17:46:02 +08:00
|
|
|
|
name = 'DR Option'
|
2022-08-12 21:07:36 +08:00
|
|
|
|
# runtime options
|
2023-01-02 17:19:57 +08:00
|
|
|
|
InputBox_use_TextEntry: bool = True
|
2022-12-22 10:54:46 +08:00
|
|
|
|
record_threads: bool = True
|
|
|
|
|
use_cProfile: bool = False
|
|
|
|
|
use_local_logging: bool = False
|
2022-11-26 21:48:55 +08:00
|
|
|
|
report_translate_no_found: bool = True
|
2022-12-25 23:15:49 +08:00
|
|
|
|
use_muitprocess: bool = False
|
2022-08-12 21:07:36 +08:00
|
|
|
|
|
|
|
|
|
# tests
|
2022-12-22 10:54:46 +08:00
|
|
|
|
playing: bool = False
|
|
|
|
|
debugging: bool = False
|
2023-01-03 22:28:26 +08:00
|
|
|
|
crash_report_test: bool = True
|
2022-08-12 21:07:36 +08:00
|
|
|
|
|
2022-12-22 10:54:46 +08:00
|
|
|
|
# window option
|
|
|
|
|
gui_scale: int = 1 # default 1 2 -> 2x 3 -> 3x
|
|
|
|
|
|
2022-08-12 21:07:36 +08:00
|
|
|
|
|
|
|
|
|
class _DR_runtime(Options):
|
|
|
|
|
"""
|
|
|
|
|
DR 的运行时配置
|
|
|
|
|
"""
|
2022-11-20 17:46:02 +08:00
|
|
|
|
name = 'DR Runtime'
|
2022-08-21 14:59:35 +08:00
|
|
|
|
# game statue
|
|
|
|
|
DR_version: Version = game_version
|
2023-01-03 15:34:22 +08:00
|
|
|
|
Build_version: Version = build_version
|
2023-01-06 21:43:18 +08:00
|
|
|
|
DR_long_version: int = long_version
|
2022-08-21 14:59:35 +08:00
|
|
|
|
|
2022-08-12 21:07:36 +08:00
|
|
|
|
# run status
|
2022-12-25 23:15:49 +08:00
|
|
|
|
running: bool = False
|
|
|
|
|
start_time_ns: int = None
|
2022-11-26 21:48:55 +08:00
|
|
|
|
client_setup_cause_ns: int = None
|
|
|
|
|
server_setup_cause_ns: int = None
|
2022-08-12 21:07:36 +08:00
|
|
|
|
|
2022-12-08 09:53:22 +08:00
|
|
|
|
# game runtimes
|
|
|
|
|
global_logger: logging.Logger
|
|
|
|
|
|
2022-08-12 21:07:36 +08:00
|
|
|
|
# game options
|
|
|
|
|
_language = 'zh-CN'
|
2022-11-26 21:48:55 +08:00
|
|
|
|
default_language: str = 'zh-CN'
|
2022-08-12 21:07:36 +08:00
|
|
|
|
|
2022-10-15 17:38:35 +08:00
|
|
|
|
def __init__(self, **kwargs):
|
|
|
|
|
super().__init__(**kwargs)
|
2022-10-02 22:24:38 +08:00
|
|
|
|
self.__options = {'language': self.language}
|
2022-08-21 14:59:35 +08:00
|
|
|
|
|
2022-08-12 21:07:36 +08:00
|
|
|
|
@property
|
|
|
|
|
def language(self):
|
|
|
|
|
return self._language
|
|
|
|
|
|
|
|
|
|
@language.setter
|
|
|
|
|
def language(self, value: str):
|
|
|
|
|
if value == self._language:
|
|
|
|
|
return
|
|
|
|
|
assert isinstance(value, str), "DR language MUST be string"
|
|
|
|
|
self._language = value
|
|
|
|
|
from Difficult_Rocket.utils import translate
|
|
|
|
|
translate.tr._update_lang()
|
|
|
|
|
|
|
|
|
|
|
2022-11-11 09:33:34 +08:00
|
|
|
|
_DR_runtime.add_option('language', _DR_runtime.language)
|
2022-08-12 21:07:36 +08:00
|
|
|
|
|
|
|
|
|
|
2022-12-29 17:45:47 +08:00
|
|
|
|
DR_option = _DR_option()
|
2022-08-12 21:07:36 +08:00
|
|
|
|
DR_runtime = _DR_runtime()
|
|
|
|
|
|
|
|
|
|
if DR_option.playing:
|
2022-11-08 20:18:01 +08:00
|
|
|
|
from Difficult_Rocket.utils import new_thread
|
2021-08-13 12:25:29 +08:00
|
|
|
|
|
2022-06-21 20:15:36 +08:00
|
|
|
|
|
2022-06-21 10:17:13 +08:00
|
|
|
|
def think_it(something):
|
|
|
|
|
return something
|
|
|
|
|
|
|
|
|
|
|
2021-10-31 23:26:32 +08:00
|
|
|
|
@new_thread('think')
|
|
|
|
|
def think(some_thing_to_think):
|
2022-06-21 10:17:13 +08:00
|
|
|
|
gotcha = think_it(some_thing_to_think)
|
2021-10-31 23:26:32 +08:00
|
|
|
|
return gotcha
|