DR -> DR SDK #16

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

View File

@ -81,6 +81,7 @@ class Options:
请注意这个函数请尽量使用 try 包裹住可能出现错误的部分 请注意这个函数请尽量使用 try 包裹住可能出现错误的部分
否则会在控制台输出你的报错""" 否则会在控制台输出你的报错"""
return True
def option(self) -> Dict[str, Any]: def option(self) -> Dict[str, Any]:
""" """
@ -149,7 +150,7 @@ class Options:
return cls.options return cls.options
@staticmethod @staticmethod
def init_option(options_class: 'Options'.__class__, init_value: Optional[dict] = None) -> 'Options': def init_option(options_class: Type['Options'], init_value: Optional[dict] = None) -> 'Options':
return options_class(**init_value if init_value is not None else {}) return options_class(**init_value if init_value is not None else {})

View File

@ -7,8 +7,8 @@ fonts_folder = "libs/fonts"
[window] [window]
style = "None" style = "None"
width = 958 width = 2048
height = 587 height = 1165
visible = true visible = true
gui_scale = 1 gui_scale = 1
caption = "Difficult Rocket v{DR_version}|DR_rs v{DR_Rust_get_version}" caption = "Difficult Rocket v{DR_version}|DR_rs v{DR_Rust_get_version}"

View File

@ -17,7 +17,7 @@ mod types;
use pyo3::prelude::*; use pyo3::prelude::*;
#[pyfunction] #[pyfunction]
fn get_version_str() -> String { "0.2.6.1".to_string() } fn get_version_str() -> String { "0.2.6.2".to_string() }
#[pyfunction] #[pyfunction]
fn test_call(py_obj: &PyAny) -> PyResult<bool> { fn test_call(py_obj: &PyAny) -> PyResult<bool> {

View File

@ -11,7 +11,7 @@ use rapier2d_f64::prelude::*;
#[pyfunction] #[pyfunction]
#[pyo3(name = "simluation")] #[pyo3(name = "simluation")]
pub fn simluation() -> PyResult<()> { pub fn simluation() -> () {
let mut rigid_body_set = RigidBodySet::new(); let mut rigid_body_set = RigidBodySet::new();
let mut collider_set = ColliderSet::new(); let mut collider_set = ColliderSet::new();
@ -61,5 +61,4 @@ pub fn simluation() -> PyResult<()> {
let ball_body = &rigid_body_set[ball_body_handle]; let ball_body = &rigid_body_set[ball_body_handle];
println!("Ball altitude: {} {}", ball_body.translation().x, ball_body.translation().y); println!("Ball altitude: {} {}", ball_body.translation().x, ball_body.translation().y);
} }
Ok(())
} }

View File

@ -4,6 +4,8 @@
# All rights reserved # All rights reserved
# ------------------------------- # -------------------------------
from typing import Optional
from .sr1_ship import SR1ShipRender from .sr1_ship import SR1ShipRender
from MCDR.version import Version from MCDR.version import Version
@ -28,8 +30,9 @@ class DR_mod(ModInfo):
# DR_Api_version = # DR Api版本 # DR_Api_version = # DR Api版本
# 同理 不管 API 版本 这东西要是不兼容了才是大问题 # 同理 不管 API 版本 这东西要是不兼容了才是大问题
def on_load(self, game: Game): def on_load(self, game: Game, old_self: Optional["DR_mod"] = None):
... if old_self:
...
def on_client_start(self, game: Game, client: ClientWindow): def on_client_start(self, game: Game, client: ClientWindow):
print('DR_mod: on_client_start') print('DR_mod: on_client_start')