ui替换
This commit is contained in:
parent
99ef5c0253
commit
30a5669bc5
10
demo.py
10
demo.py
@ -3973,6 +3973,9 @@ class MyWorld(CoreWorld):
|
||||
if gui_element in self.gui_manager.gui_elements:
|
||||
self.gui_manager.gui_elements.remove(gui_element)
|
||||
|
||||
# 获取节点名称(在删除之前)
|
||||
node_name = node.getName() if not node.isEmpty() else '未命名节点'
|
||||
|
||||
# 删除节点本身
|
||||
node.removeNode()
|
||||
|
||||
@ -3982,7 +3985,7 @@ class MyWorld(CoreWorld):
|
||||
self.selection.clearSelection()
|
||||
|
||||
# 添加成功消息
|
||||
self.add_success_message(f"已删除节点: {node.getName() or '未命名节点'}")
|
||||
self.add_success_message(f"已删除节点: {node_name}")
|
||||
|
||||
def _copy_node(self, node):
|
||||
"""复制节点"""
|
||||
@ -4204,6 +4207,11 @@ class MyWorld(CoreWorld):
|
||||
text_node.setAlign(TextNode.ACenter)
|
||||
text_node.setTextColor(1, 1, 1, 1) # 白色
|
||||
|
||||
# 设置中文字体
|
||||
chinese_font = self._get_chinese_font()
|
||||
if chinese_font:
|
||||
text_node.setFont(chinese_font)
|
||||
|
||||
# 创建节点路径并设置位置
|
||||
text_np = NodePath(text_node)
|
||||
text_np.reparentTo(self.render)
|
||||
|
||||
8021
gui/gui_manager.py
8021
gui/gui_manager.py
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user