cocos creator 3.8 字节跳动抖音添加桌面功能

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);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值