onDeskButtonClick() {
//从桌面图标打开的小游戏,获取的scene 值 是91020
console.log("点击桌面按钮");
GameManager.ButtonClickEvent("Btn");
// UIManager.ShowPanel("PanelDesk", false);
if (window.tt) {
//@ts-ignore
tt.addShortcut({
success() {
console.log("添加桌面成功");
},
fail(err:any) {
console.log("添加桌面失败", err.errMsg);
},
});
}
}
方法需要手动绑定到按钮上,不要在代码中调用
不要这样使用
//this.desk_button.on(NodeEventType.TOUCH_START, this.onDeskButtonClick, this);