translate and DR_rs 0.2.6.0
This commit is contained in:
parent
f1afdc5467
commit
ab1359e68c
@ -24,7 +24,7 @@ from libs.MCDR.version import Version
|
|||||||
|
|
||||||
game_version = Version("0.7.1.4") # 游戏版本
|
game_version = Version("0.7.1.4") # 游戏版本
|
||||||
build_version = Version("1.2.1.0") # 编译文件版本(与游戏本体无关)
|
build_version = Version("1.2.1.0") # 编译文件版本(与游戏本体无关)
|
||||||
DR_rust_version = Version("0.2.5.7") # DR 的 Rust 编写部分的版本
|
DR_rust_version = Version("0.2.6.0") # DR 的 Rust 编写部分的版本
|
||||||
Api_version = Version("0.0.1.0") # API 版本
|
Api_version = Version("0.0.1.0") # API 版本
|
||||||
__version__ = game_version
|
__version__ = game_version
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
import time
|
import time
|
||||||
import logging
|
import logging
|
||||||
import contextlib
|
|
||||||
from xml.etree import ElementTree
|
from xml.etree import ElementTree
|
||||||
from xml.etree.ElementTree import Element
|
from xml.etree.ElementTree import Element
|
||||||
from typing import List, TYPE_CHECKING, Union, Dict, Optional, Generator
|
from typing import List, TYPE_CHECKING, Union, Dict, Optional, Generator
|
||||||
@ -113,6 +112,7 @@ class SR1ShipRender(BaseScreen):
|
|||||||
x=main_window.width / 2, y=main_window.height / 2)
|
x=main_window.width / 2, y=main_window.height / 2)
|
||||||
self.debug_mouse_label.visible = SR1ShipRender_Option.debug_mouse_pos
|
self.debug_mouse_label.visible = SR1ShipRender_Option.debug_mouse_pos
|
||||||
self.textures: Union[SR1Textures, None] = None
|
self.textures: Union[SR1Textures, None] = None
|
||||||
|
self.xml_name = 'configs/dock1.xml'
|
||||||
self.xml_doc: ElementTree = parse('configs/dock1.xml')
|
self.xml_doc: ElementTree = parse('configs/dock1.xml')
|
||||||
self.xml_root: ElementTree.Element = self.xml_doc.getroot()
|
self.xml_root: ElementTree.Element = self.xml_doc.getroot()
|
||||||
self.part_batch = Batch()
|
self.part_batch = Batch()
|
||||||
@ -130,13 +130,19 @@ class SR1ShipRender(BaseScreen):
|
|||||||
self.camera_rs = CenterCamera_rs(main_window,
|
self.camera_rs = CenterCamera_rs(main_window,
|
||||||
min_zoom=(1 / 2) ** 10, max_zoom=10)
|
min_zoom=(1 / 2) ** 10, max_zoom=10)
|
||||||
self.rust_parts = None
|
self.rust_parts = None
|
||||||
# self.part_list_rs =
|
self.part_list_rs = SR1PartList_rs('configs/PartList.xml', 'default_part_list')
|
||||||
|
|
||||||
def load_xml(self, file_path: str) -> bool:
|
def load_xml(self, file_path: str) -> bool:
|
||||||
try:
|
try:
|
||||||
|
start_time = time.time_ns()
|
||||||
|
logger.info(tr().client.sr1_render.xml.loading().format(file_path))
|
||||||
cache_doc = parse(file_path)
|
cache_doc = parse(file_path)
|
||||||
self.xml_doc = cache_doc
|
self.xml_doc = cache_doc
|
||||||
self.xml_root = self.xml_doc.getroot()
|
self.xml_root = self.xml_doc.getroot()
|
||||||
|
self.xml_name = file_path
|
||||||
|
logger.info(tr().client.sr1_render.xml.load_done())
|
||||||
|
logger.info(tr().client.sr1_render.xml.load_time().format(
|
||||||
|
(time.time_ns() - start_time) / 1000000000))
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
@ -181,6 +187,7 @@ class SR1ShipRender(BaseScreen):
|
|||||||
def render_ship(self):
|
def render_ship(self):
|
||||||
if self.textures is None:
|
if self.textures is None:
|
||||||
self.load_textures()
|
self.load_textures()
|
||||||
|
logger.info(tr().client.sr1_render.ship.load().format(self.xml_name))
|
||||||
start_time = time.perf_counter_ns()
|
start_time = time.perf_counter_ns()
|
||||||
self.part_data: Dict[int, SR1PartData] = {}
|
self.part_data: Dict[int, SR1PartData] = {}
|
||||||
self.parts_sprite: Dict[int, Sprite] = {}
|
self.parts_sprite: Dict[int, Sprite] = {}
|
||||||
@ -228,8 +235,11 @@ class SR1ShipRender(BaseScreen):
|
|||||||
self.render_ship()
|
self.render_ship()
|
||||||
|
|
||||||
if self.drawing:
|
if self.drawing:
|
||||||
with contextlib.suppress(GeneratorExit):
|
try:
|
||||||
next(self.gen_draw)
|
next(self.gen_draw)
|
||||||
|
except GeneratorExit:
|
||||||
|
self.drawing = False
|
||||||
|
logger.info(tr().client.sr1_render.ship.render.done())
|
||||||
|
|
||||||
if self.need_update_parts:
|
if self.need_update_parts:
|
||||||
self.update_parts()
|
self.update_parts()
|
||||||
|
@ -16,12 +16,12 @@ logger.logfile_datefmt = "Log file date format : "
|
|||||||
game_start.at = "The main thread of the game starts with : "
|
game_start.at = "The main thread of the game starts with : "
|
||||||
|
|
||||||
[client]
|
[client]
|
||||||
setup.done = "Client loaded"
|
setup.start = "Client start loading"
|
||||||
setup.use_time = "Client loading has used: {} second"
|
setup.use_time = "Client loading has used: {} second"
|
||||||
setup.use_time_ns = "Client loading has used: {} nano second"
|
setup.use_time_ns = "Client loading has used: {} nano second"
|
||||||
|
|
||||||
[window]
|
[window]
|
||||||
setup.done = "Window loaded"
|
setup.start = "Window start loading"
|
||||||
setup.use_time = "Window loading has used: {} second"
|
setup.use_time = "Window loading has used: {} second"
|
||||||
setup.use_time_ns = "Window loading has used: {} nano second"
|
setup.use_time_ns = "Window loading has used: {} nano second"
|
||||||
os.pid_is = "Window's PID: {} PPID: {}"
|
os.pid_is = "Window's PID: {} PPID: {}"
|
||||||
@ -48,7 +48,8 @@ game.stop = "game closing, saving data……"
|
|||||||
game.end = "game closed"
|
game.end = "game closed"
|
||||||
|
|
||||||
[server]
|
[server]
|
||||||
setup.done = "Server loaded "
|
setup.start = "Server start loading"
|
||||||
|
setup.use_time = "Server loading has used: {} second"
|
||||||
os.pid_is = "Server PID: {} PPID: {}"
|
os.pid_is = "Server PID: {} PPID: {}"
|
||||||
|
|
||||||
[game]
|
[game]
|
||||||
@ -57,12 +58,12 @@ command = "in game commands"
|
|||||||
window = "window"
|
window = "window"
|
||||||
|
|
||||||
[client.sr1_render]
|
[client.sr1_render]
|
||||||
setup.done = "SR1 Renderer loaded"
|
setup.start = "SR1 Renderer start loading"
|
||||||
setup.use_time = "SR1 Renderer loading has used: {} second"
|
setup.use_time = "SR1 Renderer loading has used: {} second"
|
||||||
xml.loading = "Loading XML file: {}"
|
xml.loading = "Loading XML file: {}"
|
||||||
xml.load_done = "XML file loaded"
|
xml.load_done = "XML file loaded"
|
||||||
xml.load_time = "XML file loading has used: {} second"
|
xml.load_time = "XML file loading has used: {} second"
|
||||||
ship.load = "Loading ship: {}"
|
ship.load = "Loading ship: {}"
|
||||||
ship.load_time = "Ship loading has used: {} second"
|
ship.load_time = "Ship loading has used: {} second"
|
||||||
ship.info = "Ship info:\n- Parts: {}\n- Weight: {}\n- File size: {}"
|
ship.info = "Ship info:\n- Parts: {}\n- Weight: {}"
|
||||||
|
ship.render.done = "Ship render done"
|
||||||
|
@ -17,7 +17,7 @@ use pyo3::prelude::*;
|
|||||||
|
|
||||||
#[pyfunction]
|
#[pyfunction]
|
||||||
fn get_version_str() -> String {
|
fn get_version_str() -> String {
|
||||||
return "0.2.5.7".to_string();
|
return "0.2.6.0".to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyfunction]
|
#[pyfunction]
|
||||||
|
@ -26,10 +26,12 @@ pub mod data {
|
|||||||
#[new]
|
#[new]
|
||||||
fn new(file_path: String, list_name: String) -> Self {
|
fn new(file_path: String, list_name: String) -> Self {
|
||||||
let raw_part_list: RawPartList = RawPartList::from_file(file_path).unwrap();
|
let raw_part_list: RawPartList = RawPartList::from_file(file_path).unwrap();
|
||||||
Self {
|
let part_list = raw_part_list.to_sr_part_list(Some(list_name));
|
||||||
part_list: raw_part_list.to_sr_part_list(Some(list_name.to_string())),
|
Self { part_list }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fn get_weight(&self, part_type: String) -> PyRe<f64> {
|
||||||
|
// self.part_list.get_weight()
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -207,6 +207,7 @@ pub mod sr1 {
|
|||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct SR1PartList {
|
pub struct SR1PartList {
|
||||||
pub types: Vec<SR1PartType>,
|
pub types: Vec<SR1PartType>,
|
||||||
|
pub cache: Option<HashMap<String, SR1PartType>>,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,7 +234,11 @@ pub mod sr1 {
|
|||||||
impl SR1PartList {
|
impl SR1PartList {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new(name: String, types: Vec<SR1PartType>) -> Self {
|
pub fn new(name: String, types: Vec<SR1PartType>) -> Self {
|
||||||
SR1PartList { name, types }
|
SR1PartList {
|
||||||
|
name,
|
||||||
|
cache: None,
|
||||||
|
types,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn part_types_new(part_types: Vec<SR1PartType>, name: Option<String>) -> Self {
|
pub fn part_types_new(part_types: Vec<SR1PartType>, name: Option<String>) -> Self {
|
||||||
|
Loading…
Reference in New Issue
Block a user