Replies: 2 comments 1 reply
-
十分感谢大佬提议🤝. 提供分离的
我再考虑考虑, 看能不能在已暴露部分不产生 breaking changes 的情况下尽量将常用部分融合到 |
Beta Was this translation helpful? Give feedback.
0 replies
-
我看了一下你的使用文档,这边给到以下建议
class MyClass extends Node {
handle_onclick = (index: number) => {
console.log('on click event')
}
foo() {
// subscribe
this.onclick.connect(this.handle_onclick, 0);
// unsubscribe
this.onclick.disconnect(this.handle_onclick);
}
}
const buffer = new ArrayBuffer();
... // 使用 js 的 api 操作 buffer
const bytes = new PackedByteArray(buffer); // 将准备好的数据给引擎使用
... // 使用引擎的 api操作 bytes
// 将操作结果拿出来给js使用
const ret = bytes.to_array_buffer();
// 或者
const ret = bytes.buffer;
readonly login_confirm: Signal<string, string>; // 登陆传递用户名和密码, 通过TS实现约定类型让IDE检查传入的回调函数参数类型是否匹配
...
const handler = this.login_confirm.connect((name: string, password: string)=>{
// 处理登陆逻辑
});
...
this.login_confirm.disconnect(handler) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
建议将GDScript提供的全局变量、全局函数、以及JS绑定添加的功能都通过 godot 模块对外暴露
godot
Beta Was this translation helpful? Give feedback.
All reactions