Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions NewProject/assets/HelloCocos.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// TypeScript API for native/plugins/hello_cocos/include/hello_cocos.h

declare class Demo {
constructor(name: string);
hello(message: string): string;
}
22 changes: 22 additions & 0 deletions NewProject/assets/SayHello.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { _decorator, Component, Node, Label } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('SayHello')
export class SayHello extends Component {

@property({type: Label})
public resultLabel: Label | null = null;

start() {

}

update(deltaTime: number) {

}

onSayHelloButtonClick() {
let demo = new Demo('World');
this.resultLabel.string = demo.hello('Cocos');
}
}
Loading