尝试包装渲染parts的函数
TypeError: 'builtin_function_or_method' object is not iterable
This commit is contained in:
parent
06835d70b8
commit
bb8d280892
@ -188,21 +188,12 @@ class SR1ShipRender(BaseScreen):
|
||||
traceback.print_exc()
|
||||
self.logger.error(traceback.format_exc(), tag="load_xml")
|
||||
return False
|
||||
|
||||
def gen_sprite(self, each_count: int = 100) -> Generator:
|
||||
"""
|
||||
生成 sprite
|
||||
通过生成器减少一次性渲染的压力
|
||||
:param each_count: 每次生成的数量 (默认 100) (过大会导致卡顿)
|
||||
:return: 生成器
|
||||
"""
|
||||
count = 0
|
||||
self.status.draw_done = False
|
||||
# rust 渲染
|
||||
if DR_mod_runtime.use_DR_rust:
|
||||
cache = self.rust_ship.as_dict()
|
||||
part_group = Group(2, parent=self.part_group)
|
||||
line_box_group = Group(6, parent=self.part_group)
|
||||
def draw_parts(self,
|
||||
cache: Dict[int, List[Tuple[SR1PartType_rs, SR1PartData_rs]]],
|
||||
part_group: Group(2),
|
||||
line_box_group: Group(6),
|
||||
each_count: int,
|
||||
draw_part_box: bool):
|
||||
for p_id, parts in cache.items():
|
||||
p_id: int
|
||||
parts: List[Tuple[SR1PartType_rs, SR1PartData_rs]]
|
||||
@ -225,7 +216,7 @@ class SR1ShipRender(BaseScreen):
|
||||
|
||||
batch.append(part_sprite)
|
||||
part_box = self.rust_ship.get_part_box(p_id)
|
||||
if part_box:
|
||||
if part_box and draw_part_box:
|
||||
# 线框
|
||||
part_line_box = []
|
||||
width = 4
|
||||
@ -291,6 +282,38 @@ class SR1ShipRender(BaseScreen):
|
||||
if count >= each_count:
|
||||
count = 0
|
||||
yield
|
||||
|
||||
def gen_sprite(self, each_count: int = 100) -> Generator:
|
||||
"""
|
||||
生成 sprite
|
||||
通过生成器减少一次性渲染的压力
|
||||
:param each_count: 每次生成的数量 (默认 100) (过大会导致卡顿)
|
||||
:return: 生成器
|
||||
"""
|
||||
count = 0
|
||||
self.status.draw_done = False
|
||||
# rust 渲染
|
||||
if DR_mod_runtime.use_DR_rust:
|
||||
part_group = Group(2, parent=self.part_group)
|
||||
line_box_group = Group(6, parent=self.part_group)
|
||||
|
||||
'''
|
||||
#渲染所有未连接零件
|
||||
all_disconnected_groups = self.rust_ship.disconnected_parts()
|
||||
for cache, connections in all_disconnected_groups:
|
||||
'''
|
||||
|
||||
|
||||
|
||||
|
||||
#渲染所有已连接零件
|
||||
draw_part_box = False
|
||||
cache = self.rust_ship.as_dict()
|
||||
self.draw_parts(cache,
|
||||
part_group,
|
||||
line_box_group,
|
||||
each_count,
|
||||
draw_part_box)
|
||||
connect_line_group = Group(7, parent=self.part_group)
|
||||
for connect in self.rust_ship.connections().get_raw_data:
|
||||
# 连接线
|
||||
|
Loading…
Reference in New Issue
Block a user