This commit is contained in:
boybook
2025-12-01 20:59:16 +08:00
parent 12738a142c
commit 760c2dd9ad
5535 changed files with 21070 additions and 2021 deletions

View File

@@ -0,0 +1,23 @@
---
front: https://mc.res.netease.com/pc/zt/20201109161633/mc-dev/assets/img/4_1.2374ef65.jpg
hard: 进阶
time: 20分钟
---
# 绑定界面控件和脚本
#### 作者:境界
①在 __ init __ 下新建四个实例变量分别对应继承基础画布后出现的主节点路径主节点路径下的color_image路径主节点路径下的black_button路径主节点路径下的white_button路径。
②重写Main类的Create方法使用AddTouchEventHandler接口添加两个按钮的回调第一个参数是路径第二个是回调函数名。
![](./images/4_1.jpg)
③在回调函数内将color_image图片设置为黑色或白色其中白色的rgb值为255255255除以255后为0.0,0.0,0.0。黑色的rgb值为000除以255后为1.01.01.0。