update、bump version [page skip]

This commit is contained in:
shenjack 2023-01-24 19:49:46 +08:00
parent f32319c6f7
commit b3f262e817
5 changed files with 28 additions and 23 deletions

View File

@ -23,7 +23,7 @@ from libs.MCDR.version import Version
game_version = Version("0.6.5.0") # 游戏版本
build_version = Version("1.1.0.0") # 编译文件版本(与游戏本体无关)
DR_rust_version = Version("0.0.5.0") # DR 的 Rust 编写部分的版本
DR_rust_version = Version("0.0.5.2") # DR 的 Rust 编写部分的版本
__version__ = game_version
long_version: int = 10

View File

@ -175,13 +175,14 @@ class SR1ShipRender(BaseScreen):
if DR_option.DR_rust_available:
print(type(self.part_data))
self.rust_parts = PartDatas(self.part_data)
# print(self.rust_parts.get_rust_pointer())
self.rendered = True
def update_parts(self) -> bool:
if DR_option.DR_rust_available:
return better_update_parts(self, SR1ShipRender_Option, self.window_pointer, self.rust_parts)
if not self.rendered:
return False
if DR_option.DR_rust_available:
return better_update_parts(self, SR1ShipRender_Option, self.window_pointer, self.rust_parts)
self.debug_line.x2, self.debug_line.y2 = self.dx + (self.window_pointer.width / 2), self.dy + (
self.window_pointer.height / 2)
self.debug_d_pos_label.text = f'x: {self.dx} y: {self.dy}'
@ -189,10 +190,8 @@ class SR1ShipRender(BaseScreen):
self.window_pointer.height / 2) + 10, 0
for part_id in self.part_data:
# x y scale
self.parts_sprite[part_id].x = self.part_data[
part_id].x * DR_option.gui_scale * self.scale * 60 + self.window_pointer.width / 2 + self.dx
self.parts_sprite[part_id].y = self.part_data[
part_id].y * DR_option.gui_scale * self.scale * 60 + self.window_pointer.height / 2 + self.dy
self.parts_sprite[part_id].x = self.part_data[part_id].x * DR_option.gui_scale * self.scale * 60 + self.window_pointer.width / 2 + self.dx
self.parts_sprite[part_id].y = self.part_data[part_id].y * DR_option.gui_scale * self.scale * 60 + self.window_pointer.height / 2 + self.dy
self.parts_sprite[part_id].scale = self.scale * DR_option.gui_scale
def on_draw(self):
@ -232,10 +231,8 @@ class SR1ShipRender(BaseScreen):
self.dy += (mouse_dy - self.dy) * (1 - (0.5 ** scroll_y))
else:
self.scale = 10
self.debug_mouse_delta_line.x2 = (mouse_dx - self.dx) * (1 - (0.5 ** scroll_y)) + (
self.window_pointer.width / 2)
self.debug_mouse_delta_line.y2 = (mouse_dy - self.dy) * (1 - (0.5 ** scroll_y)) + (
self.window_pointer.height / 2)
self.debug_mouse_delta_line.x2 = (mouse_dx - self.dx) * (1 - (0.5 ** scroll_y)) + (self.window_pointer.width / 2)
self.debug_mouse_delta_line.y2 = (mouse_dy - self.dy) * (1 - (0.5 ** scroll_y)) + (self.window_pointer.height / 2)
self.debug_mouse_label.text = f'x: {mouse_dx} y: {mouse_dy}'
self.debug_mouse_label.position = x, y + 10, 0
self.update_parts()

View File

@ -21,6 +21,8 @@ if TYPE_CHECKING:
""" 用于在 PyObj 里塞一个浓眉大眼的 HashMap<uszie, SR1PartData>"""
def __new__(cls, py_part_data: Dict[int, SR1PartData]) -> "PartDatas": ...
def get_rust_pointer(self) -> int: ...
def better_update_parts(render: SR1ShipRender,
option: SR1ShipRender_Option,
window: BaseScreen,

View File

@ -12,7 +12,7 @@ use pyo3::prelude::*;
#[pyfunction]
fn get_version_str() -> String {
return String::from("0.0.5.0");
return String::from("0.0.5.2");
}
#[pyfunction]

View File

@ -9,7 +9,7 @@
use std::collections::HashMap;
use pyo3::intern;
use pyo3::prelude::*;
use pyo3::types::PyDict;
use crate::sr1_render::types::SR1PartData;
#[allow(dead_code)]
pub mod types {
@ -43,24 +43,24 @@ pub mod types {
#[pyclass(name = "PartDatas")]
pub struct PartDatas {
pub part_structs: HashMap<usize, SR1PartData>
pub part_structs: HashMap<usize, SR1PartData>,
}
impl PartDatas {
fn get_rust_data(&self) -> &HashMap<usize, SR1PartData> {
return &self.part_structs;
}
}
#[pymethods]
impl PartDatas {
#[new]
pub fn py_new(py_part_data: &PyDict) -> PyResult<Self> {
fn py_new(py_part_data: &PyDict) -> PyResult<Self> {
let datas: HashMap<usize, SR1PartData> = part_data_tp_SR1PartDatas(py_part_data)?;
// let datas: HashMap<usize, SR1PartData> = HashMap::new();
return Ok(PartDatas { part_structs: datas })
}
}
impl PartDatas{
pub fn get_rust_data(&self) -> &HashMap<usize, SR1PartData> {
return &self.part_structs;
}
}
#[allow(non_snake_case)]
pub fn part_data_to_SR1PartData(input: &PyAny) -> Result<SR1PartData, PyErr> {
@ -125,10 +125,16 @@ pub fn better_update_parts(render: &PyAny, option: &PyAny, window: &PyAny, parts
let y_center: f32 = window.getattr(intern!(window.py(), "height"))?.extract()?;
let x_center: f32 = x_center / 2.0;
let y_center: f32 = y_center / 2.0;
let part_datas: &PyDict = render.getattr(intern!(render.py(), "part_data"))?.extract()?;
let parts: HashMap<usize, types::Point> = types::part_datas_to_points(part_datas)?;
let datas: &HashMap<usize, SR1PartData> = &parts.part_structs;
for keys in datas {
println!("{}", keys.0);
}
if option.getattr("debug_d_pos")?.is_true()? {
let line = render.getattr(intern!(render.py(), "debug_line"))?;
}
// for part in parts.
Ok(true)
}