make obj printable
This commit is contained in:
parent
a820a1a411
commit
e38b75a15e
@ -92,6 +92,9 @@ class Client:
|
|||||||
self.window.start_game() # 游戏启动
|
self.window.start_game() # 游戏启动
|
||||||
# TODO 写一下服务端启动相关,还是需要服务端啊
|
# TODO 写一下服务端启动相关,还是需要服务端啊
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return f'<Client {self.process_name} {self.process_pid}>'
|
||||||
|
|
||||||
|
|
||||||
def pyglet_load_fonts_folder(folder) -> None:
|
def pyglet_load_fonts_folder(folder) -> None:
|
||||||
file_folder_list = os.listdir(folder)
|
file_folder_list = os.listdir(folder)
|
||||||
|
@ -43,3 +43,6 @@ class Server:
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.logger.info(tr().server.os.pid_is().format(os.getpid(), os.getppid()))
|
self.logger.info(tr().server.os.pid_is().format(os.getpid(), os.getppid()))
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return f'<Server {self.process_name} {self.process_id}>'
|
||||||
|
@ -77,6 +77,12 @@ class Options:
|
|||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
self.flush_option()
|
self.flush_option()
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"<{self.__class__.__name__} {self.name}>" if self.name else f"<{self.__class__.__name__}>"
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return self.__str__()
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
_options: Dict[str, Union[Callable, object]] = {}
|
_options: Dict[str, Union[Callable, object]] = {}
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@ fonts_folder = "libs/fonts"
|
|||||||
|
|
||||||
[window]
|
[window]
|
||||||
style = "None"
|
style = "None"
|
||||||
width = 2542
|
width = 1021
|
||||||
height = 1489
|
height = 1078
|
||||||
visible = true
|
visible = true
|
||||||
gui_scale = 1
|
gui_scale = 1
|
||||||
caption = "Difficult Rocket v{DR_version}"
|
caption = "Difficult Rocket v{DR_version}"
|
||||||
|
@ -111,6 +111,9 @@ class Version:
|
|||||||
version_str += '+' + str(self.build)
|
version_str += '+' + str(self.build)
|
||||||
return version_str
|
return version_str
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return self.__str__()
|
||||||
|
|
||||||
def __getitem__(self, index: int) -> int:
|
def __getitem__(self, index: int) -> int:
|
||||||
if index < len(self.component):
|
if index < len(self.component):
|
||||||
return self.component[index]
|
return self.component[index]
|
||||||
|
@ -9,10 +9,9 @@ import traceback
|
|||||||
|
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
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, Version
|
||||||
from Difficult_Rocket.client import ClientWindow
|
from Difficult_Rocket.client import ClientWindow
|
||||||
|
|
||||||
DR_rust_version = Version("0.2.10.1") # DR_mod 的 Rust 编写部分的兼容版本
|
DR_rust_version = Version("0.2.10.1") # DR_mod 的 Rust 编写部分的兼容版本
|
||||||
@ -76,6 +75,7 @@ class DR_mod(ModInfo):
|
|||||||
else:
|
else:
|
||||||
self.config.flush_option()
|
self.config.flush_option()
|
||||||
print("DR_mod: on_load")
|
print("DR_mod: on_load")
|
||||||
|
print(self.as_markdown())
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def on_client_start(self, game: Game, client: ClientWindow):
|
def on_client_start(self, game: Game, client: ClientWindow):
|
||||||
|
Loading…
Reference in New Issue
Block a user