update mod stuf, add some more
This commit is contained in:
parent
e83c3ac7fb
commit
5b24a0a240
@ -25,12 +25,13 @@ from libs.MCDR.version import Version
|
|||||||
game_version = Version("0.7.2.1") # 游戏版本
|
game_version = Version("0.7.2.1") # 游戏版本
|
||||||
build_version = Version("1.2.1.0") # 编译文件版本(与游戏本体无关)
|
build_version = Version("1.2.1.0") # 编译文件版本(与游戏本体无关)
|
||||||
DR_rust_version = Version("0.2.6.1") # DR 的 Rust 编写部分的版本
|
DR_rust_version = Version("0.2.6.1") # DR 的 Rust 编写部分的版本
|
||||||
Api_version = Version("0.0.1.0") # API 版本
|
Api_version = Version("0.0.2.0") # API 版本
|
||||||
__version__ = game_version
|
__version__ = game_version
|
||||||
|
|
||||||
long_version: int = 13
|
long_version: int = 14
|
||||||
"""
|
"""
|
||||||
long_version: 一个用于标记内部协议的整数
|
long_version: 一个用于标记内部协议的整数
|
||||||
|
14: BaseScreen 的每一个函数都添加了一个参数: window: "ClientWindow"
|
||||||
13: 为 DR_runtime 添加 API_version
|
13: 为 DR_runtime 添加 API_version
|
||||||
12: 去除 DR_runtime 的 global_logger
|
12: 去除 DR_runtime 的 global_logger
|
||||||
要 logging 自己拿去(
|
要 logging 自己拿去(
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
|
|
||||||
import typing
|
import typing
|
||||||
from typing import List
|
|
||||||
|
|
||||||
# from pyglet.window import Window
|
# from pyglet.window import Window
|
||||||
from pyglet.event import EventDispatcher
|
from pyglet.event import EventDispatcher
|
||||||
@ -29,7 +28,20 @@ class BaseScreen(EventDispatcher):
|
|||||||
self.window_pointer = main_window
|
self.window_pointer = main_window
|
||||||
|
|
||||||
if typing.TYPE_CHECKING:
|
if typing.TYPE_CHECKING:
|
||||||
def on_activate(self):
|
def on_command(self, command: CommandText, window: "ClientWindow"):
|
||||||
|
"""
|
||||||
|
命令输入事件
|
||||||
|
"""
|
||||||
|
|
||||||
|
def draw_update(self, tick: float, window: "ClientWindow"):
|
||||||
|
"""
|
||||||
|
画面更新
|
||||||
|
"""
|
||||||
|
|
||||||
|
"""
|
||||||
|
Pyglet 定义的事件
|
||||||
|
"""
|
||||||
|
def on_activate(self, window: "ClientWindow"):
|
||||||
"""The window was activated.
|
"""The window was activated.
|
||||||
|
|
||||||
This event can be triggered by clicking on the title bar, bringing
|
This event can be triggered by clicking on the title bar, bringing
|
||||||
@ -40,7 +52,7 @@ class BaseScreen(EventDispatcher):
|
|||||||
:event:
|
:event:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def on_close(self):
|
def on_close(self, window: "ClientWindow"):
|
||||||
"""The user attempted to close the window.
|
"""The user attempted to close the window.
|
||||||
|
|
||||||
This event can be triggered by clicking on the "X" control box in
|
This event can be triggered by clicking on the "X" control box in
|
||||||
@ -53,7 +65,7 @@ class BaseScreen(EventDispatcher):
|
|||||||
:event:
|
:event:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def on_context_lost(self):
|
def on_context_lost(self, window: "ClientWindow"):
|
||||||
"""The window's GL context was lost.
|
"""The window's GL context was lost.
|
||||||
|
|
||||||
When the context is lost no more GL methods can be called until it
|
When the context is lost no more GL methods can be called until it
|
||||||
@ -65,7 +77,7 @@ class BaseScreen(EventDispatcher):
|
|||||||
:event:
|
:event:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def on_context_state_lost(self):
|
def on_context_state_lost(self, window: "ClientWindow"):
|
||||||
"""The state of the window's GL context was lost.
|
"""The state of the window's GL context was lost.
|
||||||
|
|
||||||
pyglet may sometimes need to recreate the window's GL context if
|
pyglet may sometimes need to recreate the window's GL context if
|
||||||
@ -78,7 +90,7 @@ class BaseScreen(EventDispatcher):
|
|||||||
:event:
|
:event:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def on_deactivate(self):
|
def on_deactivate(self, window: "ClientWindow"):
|
||||||
"""The window was deactivated.
|
"""The window was deactivated.
|
||||||
|
|
||||||
This event can be triggered by clicking on another application
|
This event can be triggered by clicking on another application
|
||||||
@ -88,7 +100,7 @@ class BaseScreen(EventDispatcher):
|
|||||||
:event:
|
:event:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def on_draw(self):
|
def on_draw(self, window: "ClientWindow"):
|
||||||
"""The window contents must be redrawn.
|
"""The window contents must be redrawn.
|
||||||
|
|
||||||
The `EventLoop` will dispatch this event when the window
|
The `EventLoop` will dispatch this event when the window
|
||||||
@ -108,7 +120,7 @@ class BaseScreen(EventDispatcher):
|
|||||||
:event:
|
:event:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def on_expose(self):
|
def on_expose(self, window: "ClientWindow"):
|
||||||
"""A portion of the window needs to be redrawn.
|
"""A portion of the window needs to be redrawn.
|
||||||
|
|
||||||
This event is triggered when the window first appears, and any time
|
This event is triggered when the window first appears, and any time
|
||||||
@ -123,7 +135,7 @@ class BaseScreen(EventDispatcher):
|
|||||||
:event:
|
:event:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def on_file_drop(self, x, y, paths):
|
def on_file_drop(self, x, y, paths, window: "ClientWindow"):
|
||||||
"""File(s) were dropped into the window, will return the position of the cursor and
|
"""File(s) were dropped into the window, will return the position of the cursor and
|
||||||
a list of paths to the files that were dropped.
|
a list of paths to the files that were dropped.
|
||||||
|
|
||||||
@ -132,7 +144,7 @@ class BaseScreen(EventDispatcher):
|
|||||||
:event:
|
:event:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def on_hide(self):
|
def on_hide(self, window: "ClientWindow"):
|
||||||
"""The window was hidden.
|
"""The window was hidden.
|
||||||
|
|
||||||
This event is triggered when a window is minimised
|
This event is triggered when a window is minimised
|
||||||
@ -141,7 +153,7 @@ class BaseScreen(EventDispatcher):
|
|||||||
:event:
|
:event:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def on_key_press(self, symbol, modifiers):
|
def on_key_press(self, symbol, modifiers, window: "ClientWindow"):
|
||||||
"""A key on the keyboard was pressed (and held down).
|
"""A key on the keyboard was pressed (and held down).
|
||||||
|
|
||||||
Since pyglet 1.1 the default handler dispatches the :py:meth:`~pyglet.window.Window.on_close`
|
Since pyglet 1.1 the default handler dispatches the :py:meth:`~pyglet.window.Window.on_close`
|
||||||
@ -156,7 +168,7 @@ class BaseScreen(EventDispatcher):
|
|||||||
:event:
|
:event:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def on_key_release(self, symbol, modifiers):
|
def on_key_release(self, symbol, modifiers, window: "ClientWindow"):
|
||||||
"""A key on the keyboard was released.
|
"""A key on the keyboard was released.
|
||||||
|
|
||||||
:Parameters:
|
:Parameters:
|
||||||
@ -168,7 +180,7 @@ class BaseScreen(EventDispatcher):
|
|||||||
:event:
|
:event:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def on_mouse_motion(self, x, y, dx, dy):
|
def on_mouse_motion(self, x, y, dx, dy, window: "ClientWindow"):
|
||||||
"""The mouse was moved with no buttons held down.
|
"""The mouse was moved with no buttons held down.
|
||||||
|
|
||||||
:Parameters:
|
:Parameters:
|
||||||
@ -184,7 +196,7 @@ class BaseScreen(EventDispatcher):
|
|||||||
:event:
|
:event:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
|
def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers, window: "ClientWindow"):
|
||||||
"""The mouse was moved with one or more mouse buttons pressed.
|
"""The mouse was moved with one or more mouse buttons pressed.
|
||||||
|
|
||||||
This event will continue to be fired even if the mouse leaves
|
This event will continue to be fired even if the mouse leaves
|
||||||
@ -208,7 +220,7 @@ class BaseScreen(EventDispatcher):
|
|||||||
:event:
|
:event:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def on_mouse_press(self, x, y, button, modifiers):
|
def on_mouse_press(self, x, y, button, modifiers, window: "ClientWindow"):
|
||||||
"""A mouse button was pressed (and held down).
|
"""A mouse button was pressed (and held down).
|
||||||
|
|
||||||
:Parameters:
|
:Parameters:
|
||||||
@ -225,7 +237,7 @@ class BaseScreen(EventDispatcher):
|
|||||||
:event:
|
:event:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def on_mouse_release(self, x, y, button, modifiers):
|
def on_mouse_release(self, x, y, button, modifiers, window: "ClientWindow"):
|
||||||
"""A mouse button was released.
|
"""A mouse button was released.
|
||||||
|
|
||||||
:Parameters:
|
:Parameters:
|
||||||
@ -242,7 +254,7 @@ class BaseScreen(EventDispatcher):
|
|||||||
:event:
|
:event:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def on_mouse_scroll(self, x, y, scroll_x, scroll_y):
|
def on_mouse_scroll(self, x, y, scroll_x, scroll_y, window: "ClientWindow"):
|
||||||
"""The mouse wheel was scrolled.
|
"""The mouse wheel was scrolled.
|
||||||
|
|
||||||
Note that most mice have only a vertical scroll wheel, so
|
Note that most mice have only a vertical scroll wheel, so
|
||||||
@ -263,7 +275,7 @@ class BaseScreen(EventDispatcher):
|
|||||||
:event:
|
:event:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def on_mouse_enter(self, x, y):
|
def on_mouse_enter(self, x, y, window: "ClientWindow"):
|
||||||
"""The mouse was moved into the window.
|
"""The mouse was moved into the window.
|
||||||
|
|
||||||
This event will not be triggered if the mouse is currently being
|
This event will not be triggered if the mouse is currently being
|
||||||
@ -278,7 +290,7 @@ class BaseScreen(EventDispatcher):
|
|||||||
:event:
|
:event:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def on_mouse_leave(self, x, y):
|
def on_mouse_leave(self, x, y, window: "ClientWindow"):
|
||||||
"""The mouse was moved outside of the window.
|
"""The mouse was moved outside of the window.
|
||||||
|
|
||||||
This event will not be triggered if the mouse is currently being
|
This event will not be triggered if the mouse is currently being
|
||||||
@ -294,7 +306,7 @@ class BaseScreen(EventDispatcher):
|
|||||||
:event:
|
:event:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def on_move(self, x, y):
|
def on_move(self, x, y, window: "ClientWindow"):
|
||||||
"""The window was moved.
|
"""The window was moved.
|
||||||
|
|
||||||
:Parameters:
|
:Parameters:
|
||||||
@ -309,7 +321,7 @@ class BaseScreen(EventDispatcher):
|
|||||||
:event:
|
:event:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def on_refresh(self, dt):
|
def on_refresh(self, dt, window: "ClientWindow"):
|
||||||
"""The window contents must be redrawn.
|
"""The window contents must be redrawn.
|
||||||
|
|
||||||
The `EventLoop` will dispatch this event when the window
|
The `EventLoop` will dispatch this event when the window
|
||||||
@ -328,7 +340,7 @@ class BaseScreen(EventDispatcher):
|
|||||||
:event:
|
:event:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def on_resize(self, width, height):
|
def on_resize(self, width, height, window: "ClientWindow"):
|
||||||
"""The window was resized.
|
"""The window was resized.
|
||||||
|
|
||||||
The window will have the GL context when this event is dispatched;
|
The window will have the GL context when this event is dispatched;
|
||||||
@ -343,7 +355,7 @@ class BaseScreen(EventDispatcher):
|
|||||||
:event:
|
:event:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def on_show(self):
|
def on_show(self, window: "ClientWindow"):
|
||||||
"""The window was shown.
|
"""The window was shown.
|
||||||
|
|
||||||
This event is triggered when a window is restored after being
|
This event is triggered when a window is restored after being
|
||||||
@ -352,7 +364,7 @@ class BaseScreen(EventDispatcher):
|
|||||||
:event:
|
:event:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def on_text(self, text):
|
def on_text(self, text, window: "ClientWindow"):
|
||||||
"""The user input some text.
|
"""The user input some text.
|
||||||
|
|
||||||
Typically this is called after :py:meth:`~pyglet.window.Window.on_key_press` and before
|
Typically this is called after :py:meth:`~pyglet.window.Window.on_key_press` and before
|
||||||
@ -371,7 +383,7 @@ class BaseScreen(EventDispatcher):
|
|||||||
:event:
|
:event:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def on_text_motion(self, motion):
|
def on_text_motion(self, motion, window: "ClientWindow"):
|
||||||
"""The user moved the text input cursor.
|
"""The user moved the text input cursor.
|
||||||
|
|
||||||
Typically this is called after :py:meth:`~pyglet.window.Window.on_key_press` and before
|
Typically this is called after :py:meth:`~pyglet.window.Window.on_key_press` and before
|
||||||
@ -407,7 +419,7 @@ class BaseScreen(EventDispatcher):
|
|||||||
:event:
|
:event:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def on_text_motion_select(self, motion):
|
def on_text_motion_select(self, motion, window: "ClientWindow"):
|
||||||
"""The user moved the text input cursor while extending the
|
"""The user moved the text input cursor while extending the
|
||||||
selection.
|
selection.
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ def _call_screen_after(func: Callable) -> Callable:
|
|||||||
for a_screen in self.screen_list:
|
for a_screen in self.screen_list:
|
||||||
if hasattr(a_screen, func.__name__):
|
if hasattr(a_screen, func.__name__):
|
||||||
try:
|
try:
|
||||||
getattr(a_screen, func.__name__)(*args, **kwargs)
|
getattr(a_screen, func.__name__)(*args, **kwargs, window=self)
|
||||||
except Exception:
|
except Exception:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
return result
|
return result
|
||||||
@ -136,7 +136,7 @@ def _call_screen_before(func: Callable) -> Callable:
|
|||||||
for a_screen in self.screen_list:
|
for a_screen in self.screen_list:
|
||||||
if hasattr(a_screen, func.__name__):
|
if hasattr(a_screen, func.__name__):
|
||||||
try:
|
try:
|
||||||
getattr(a_screen, func.__name__)(*args, **kwargs)
|
getattr(a_screen, func.__name__)(*args, **kwargs, window=self)
|
||||||
except Exception:
|
except Exception:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
result = func(self, *args, **kwargs)
|
result = func(self, *args, **kwargs)
|
||||||
@ -203,6 +203,7 @@ class ClientWindow(Window):
|
|||||||
def setup(self):
|
def setup(self):
|
||||||
self.load_fonts()
|
self.load_fonts()
|
||||||
self.screen_list: List[BaseScreen]
|
self.screen_list: List[BaseScreen]
|
||||||
|
# TODO 读取配置文件,加载不同的屏幕,解耦
|
||||||
self.screen_list.append(DRDEBUGScreen(self))
|
self.screen_list.append(DRDEBUGScreen(self))
|
||||||
self.screen_list.append(DRScreen(self))
|
self.screen_list.append(DRScreen(self))
|
||||||
self.screen_list.append(SR1ShipRender(self))
|
self.screen_list.append(SR1ShipRender(self))
|
||||||
|
@ -234,7 +234,7 @@ class SR1ShipRender(BaseScreen):
|
|||||||
self.window_pointer.height / 2) + 10, 0
|
self.window_pointer.height / 2) + 10, 0
|
||||||
self.need_update_parts = False
|
self.need_update_parts = False
|
||||||
|
|
||||||
def on_draw(self):
|
def on_draw(self, window: "ClientWindow"):
|
||||||
if self.need_draw:
|
if self.need_draw:
|
||||||
self.render_ship()
|
self.render_ship()
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ class SR1ShipRender(BaseScreen):
|
|||||||
if SR1ShipRender_Option.debug_mouse_d_pos:
|
if SR1ShipRender_Option.debug_mouse_d_pos:
|
||||||
self.debug_mouse_delta_line.draw()
|
self.debug_mouse_delta_line.draw()
|
||||||
|
|
||||||
def on_resize(self, width: int, height: int):
|
def on_resize(self, width: int, height: int, window: "ClientWindow"):
|
||||||
if not self.rendered:
|
if not self.rendered:
|
||||||
return
|
return
|
||||||
self.debug_line.x = width / 2
|
self.debug_line.x = width / 2
|
||||||
@ -278,11 +278,11 @@ class SR1ShipRender(BaseScreen):
|
|||||||
self.debug_mouse_delta_line.y = height / 2
|
self.debug_mouse_delta_line.y = height / 2
|
||||||
self.update_parts()
|
self.update_parts()
|
||||||
|
|
||||||
def on_mouse_scroll(self, x: int, y: int, scroll_x: int, scroll_y: int):
|
def on_mouse_scroll(self, x: int, y: int, scroll_x: int, scroll_y: int, window: "ClientWindow"):
|
||||||
if not self.rendered:
|
if not self.rendered:
|
||||||
return
|
return
|
||||||
mouse_dx = x - (self.window_pointer.width / 2)
|
mouse_dx = x - (window.width / 2)
|
||||||
mouse_dy = y - (self.window_pointer.height / 2)
|
mouse_dy = y - (window.height / 2)
|
||||||
# 鼠标缩放位置相对于屏幕中心的位置
|
# 鼠标缩放位置相对于屏幕中心的位置
|
||||||
mouse_dx_d = mouse_dx - self.camera_rs.dx
|
mouse_dx_d = mouse_dx - self.camera_rs.dx
|
||||||
mouse_dy_d = mouse_dy - self.camera_rs.dy
|
mouse_dy_d = mouse_dy - self.camera_rs.dy
|
||||||
@ -305,15 +305,15 @@ class SR1ShipRender(BaseScreen):
|
|||||||
|
|
||||||
self.debug_mouse_line.x2, self.debug_mouse_line.y2 = x, y
|
self.debug_mouse_line.x2, self.debug_mouse_line.y2 = x, y
|
||||||
self.debug_mouse_delta_line.x2 = (mouse_dx - self.camera_rs.dx) * (1 - (0.5 ** scroll_y)) + (
|
self.debug_mouse_delta_line.x2 = (mouse_dx - self.camera_rs.dx) * (1 - (0.5 ** scroll_y)) + (
|
||||||
self.window_pointer.width / 2)
|
window.width / 2)
|
||||||
self.debug_mouse_delta_line.y2 = (mouse_dy - self.camera_rs.dy) * (1 - (0.5 ** scroll_y)) + (
|
self.debug_mouse_delta_line.y2 = (mouse_dy - self.camera_rs.dy) * (1 - (0.5 ** scroll_y)) + (
|
||||||
self.window_pointer.height / 2)
|
window.height / 2)
|
||||||
self.debug_mouse_label.text = f'x: {mouse_dx} y: {mouse_dy}'
|
self.debug_mouse_label.text = f'x: {mouse_dx} y: {mouse_dy}'
|
||||||
self.debug_mouse_label.position = x, y + 10, 0
|
self.debug_mouse_label.position = x, y + 10, 0
|
||||||
self.need_update_parts = True
|
self.need_update_parts = True
|
||||||
# self.update_parts()
|
# self.update_parts()
|
||||||
|
|
||||||
def on_command(self, command: CommandText):
|
def on_command(self, command: CommandText, window: "ClientWindow"):
|
||||||
if command.re_match('render'):
|
if command.re_match('render'):
|
||||||
if command.re_match('reset'):
|
if command.re_match('reset'):
|
||||||
self.camera_rs.zoom = 1
|
self.camera_rs.zoom = 1
|
||||||
@ -358,7 +358,7 @@ class SR1ShipRender(BaseScreen):
|
|||||||
image_data = screenshot(self.window_pointer)
|
image_data = screenshot(self.window_pointer)
|
||||||
image_data.save('test.png')
|
image_data.save('test.png')
|
||||||
|
|
||||||
def on_mouse_drag(self, x: int, y: int, dx: int, dy: int, buttons: int, modifiers: int):
|
def on_mouse_drag(self, x: int, y: int, dx: int, dy: int, buttons: int, modifiers: int, window: "ClientWindow"):
|
||||||
if not self.focus:
|
if not self.focus:
|
||||||
return
|
return
|
||||||
self.camera_rs.dx += dx
|
self.camera_rs.dx += dx
|
||||||
@ -366,7 +366,7 @@ class SR1ShipRender(BaseScreen):
|
|||||||
self.need_update_parts = True
|
self.need_update_parts = True
|
||||||
# self.update_parts()
|
# self.update_parts()
|
||||||
|
|
||||||
def on_file_drop(self, x: int, y: int, paths: List[str]):
|
def on_file_drop(self, x: int, y: int, paths: List[str], window: "ClientWindow"):
|
||||||
for path in paths:
|
for path in paths:
|
||||||
if self.load_xml(path): # 加载成功一个就停下
|
if self.load_xml(path): # 加载成功一个就停下
|
||||||
break
|
break
|
||||||
|
@ -38,21 +38,21 @@ class DRDEBUGScreen(BaseScreen):
|
|||||||
batch=self.main_batch, group=self.main_group)
|
batch=self.main_batch, group=self.main_group)
|
||||||
self.fps_label.text = "11111114514"
|
self.fps_label.text = "11111114514"
|
||||||
|
|
||||||
def draw_update(self, tick: float):
|
def draw_update(self, tick: float, window: "ClientWindow"):
|
||||||
self.update_label()
|
self.update_label(window)
|
||||||
|
|
||||||
def update_label(self):
|
def update_label(self, window: "ClientWindow"):
|
||||||
now_FPS = get_frequency()
|
now_FPS = get_frequency()
|
||||||
self.fps_label.text = (
|
self.fps_label.text = (
|
||||||
f'FPS: {self.window_pointer.fps_log.fps: >5.1f}('
|
f'FPS: {window.fps_log.fps: >5.1f}('
|
||||||
f'{self.window_pointer.fps_log.middle_fps: >5.1f})[{now_FPS: >.7f}]\n '
|
f'{window.fps_log.middle_fps: >5.1f})[{now_FPS: >.7f}]\n '
|
||||||
f'{self.window_pointer.fps_log.max_fps: >7.1f} '
|
f'{window.fps_log.max_fps: >7.1f} '
|
||||||
f'{self.window_pointer.fps_log.min_fps:>5.1f}'
|
f'{window.fps_log.min_fps:>5.1f}'
|
||||||
)
|
)
|
||||||
|
|
||||||
def on_resize(self, width, height):
|
def on_resize(self, width, height, window: "ClientWindow"):
|
||||||
self.fps_label.y = height - 10
|
self.fps_label.y = height - 10
|
||||||
|
|
||||||
def on_draw(self, *dt):
|
def on_draw(self, *dt, window: "ClientWindow"):
|
||||||
self.main_batch.draw()
|
self.main_batch.draw()
|
||||||
# print(self.window_pointer.try_if_runs)
|
# print(self.window_pointer.try_if_runs)
|
||||||
|
@ -10,3 +10,9 @@ mail: 3695888@qq.com
|
|||||||
github: @shenjackyuanjie
|
github: @shenjackyuanjie
|
||||||
gitee: @shenjackyuanjie
|
gitee: @shenjackyuanjie
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from Difficult_Rocket.api.screen import BaseScreen
|
||||||
|
|
||||||
|
__all__ = ['BaseScreen']
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
# -------------------------------
|
|
||||||
# Difficult Rocket
|
|
||||||
# Copyright © 2020-2023 by shenjackyuanjie 3695888@qq.com
|
|
||||||
# All rights reserved
|
|
||||||
# -------------------------------
|
|
||||||
|
|
||||||
"""
|
|
||||||
writen by shenjackyuanjie
|
|
||||||
mail: 3695888@qq.com
|
|
||||||
github: @shenjackyuanjie
|
|
||||||
gitee: @shenjackyuanjie
|
|
||||||
"""
|
|
||||||
|
|
||||||
"""
|
|
||||||
这里是所有客户端 mod 加载器的装饰器实现
|
|
||||||
可以实现类似
|
|
||||||
|
|
||||||
from Difficult_Rocket.mods.client import KeyBinding
|
|
||||||
|
|
||||||
|
|
||||||
@KeyBinding()
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
def KeyBinding(func):
|
|
||||||
"""
|
|
||||||
客户端键盘事件传递装饰器
|
|
||||||
"""
|
|
||||||
|
|
||||||
def wrapper(*args, **kwargs):
|
|
||||||
func(*args, **kwargs)
|
|
||||||
|
|
||||||
return wrapper
|
|
@ -22,7 +22,7 @@
|
|||||||
- [![Readme-gitee](https://img.shields.io/badge/Readme-中文(点我!)-blue.svg?style=flat-square)](../../README.md)
|
- [![Readme-gitee](https://img.shields.io/badge/Readme-中文(点我!)-blue.svg?style=flat-square)](../../README.md)
|
||||||
- Using [SemVer 2.0.0](https://semver.org/) to manage version
|
- Using [SemVer 2.0.0](https://semver.org/) to manage version
|
||||||
|
|
||||||
## 202304 DR `0.7.2.2` + DR_rs `0.2.7.1`
|
## 202304 DR `0.7.2.2` + DR_rs `0.2.7.1` + DR_api `0.0.2.0` + 14
|
||||||
|
|
||||||
### DR_rs V 0.2.6.1
|
### DR_rs V 0.2.6.1
|
||||||
|
|
||||||
@ -45,6 +45,11 @@
|
|||||||
- `to_sr_part_data`
|
- `to_sr_part_data`
|
||||||
- `to_raw_part_data`
|
- `to_raw_part_data`
|
||||||
|
|
||||||
|
### DR_api V `0.0.2.0`
|
||||||
|
|
||||||
|
- 用于适应 `api.screen` 的变化
|
||||||
|
- Used to adapt to the changes in `api.screen`
|
||||||
|
|
||||||
### Changes
|
### Changes
|
||||||
|
|
||||||
- `DR.py`
|
- `DR.py`
|
||||||
@ -69,6 +74,15 @@
|
|||||||
- Now the system information will be output in the log
|
- Now the system information will be output in the log
|
||||||
- (Actually it's used by `crash`)
|
- (Actually it's used by `crash`)
|
||||||
|
|
||||||
|
### breaking changes
|
||||||
|
|
||||||
|
- `api.screen`
|
||||||
|
- `BaseScreen`
|
||||||
|
- 为每一个函数添加了 `window: "ClientWindow"` 参数
|
||||||
|
- 用于传递父窗口信息
|
||||||
|
- For each function, add `window: "ClientWindow"` parameter
|
||||||
|
- Used to pass parent window information
|
||||||
|
|
||||||
### Translate
|
### Translate
|
||||||
|
|
||||||
- 添加
|
- 添加
|
||||||
|
Loading…
Reference in New Issue
Block a user