Files
netease-modsdk-wiki/docs/mcguide/20-玩法开发/14-预设玩法编程/9-第一个预设Mod/4-创建和挂接零件.md
2025-03-18 14:46:12 +08:00

21 lines
955 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 创建零件
零件是预设架构下,一种可以挂接到预设下的玩法逻辑对象。
我们首先通过新建文件向导创建一个零件。通过资源管理器左侧的“新建”按钮打开新建文件向导,然后在常用页签里选择空零件,点击下一步。
![part001](./images/part001.png)
我们将零件命名为Chat在这里你会发现我们在创建零件的时候同时创建了4个文件。
- Chat.part零件的本体文件与.preset的预设类似
- ChatPart.py这个是零件绑定的python脚本文件我们后续的逻辑需要写在这个文件里。
- ChatPartMeta.py这个是ChatPart.py的Meta文件主要用于将ChatPart.py的属性暴露至属性面板中。
- \_init\_.py固定的文件结构
![part002](./images/part002.png)
点击创建完成Chat零件的创建资源管理器自动跳转到刚创建的零件的文件夹。
![part003](./images/part003.png)