Spring774
2025-10-30 a972605e1cf8122330de5b6ff53857be130972be
assets/Script/RewardLayer.ts
@@ -17,20 +17,22 @@
    eventNode: cc.Node = null;
    onClickClose() {
        SoundManager.playButton();
        this.cliamReward(1);
        this.hide();
        Global.debounceClicks(() => {
            SoundManager.playButton();
            this.cliamReward(1);
            this.hide();
        }, 'RewardLayer-onClickClose');
    }
    hide() {
        this.node.destroy();
    }
    onDisable(){
    onDisable() {
        Userdata.saveUserdata();
    }
    setEventNode(node: cc.Node){
    setEventNode(node: cc.Node) {
        this.eventNode = node;
    }
@@ -49,34 +51,38 @@
    }
    onClickCliam() {
        SoundManager.playButton();
        Global.debounceClicks(() => {
            SoundManager.playButton();
        if (this.isGot) {
            return;
        }
            if (this.isGot) {
                return;
            }
        if (Sdk.isToutiao) {
            SdkToutiao.showRewardVideoAd(() => {
                if (!this.isGot){
                    this.isGot = true;
                    this.cliamReward(5);
                    this.hide();
                }
            }, () => {
                Global.showTip('广告展示失败, 请稍后重试!!');
            });
        } else {
            Sdk.ins.showVideoAd((res) => {
                if (res) {
                    this.isGot = true;
                    this.cliamReward(5);
                    this.hide();
                } else {
                    Global.showTip('No ads ready!!');
                }
            });
        }
            if (Sdk.isToutiao) {
                SdkToutiao.showRewardVideoAd(() => {
                    if (!this.isGot) {
                        this.isGot = true;
                        this.cliamReward(5);
                        this.hide();
                    }
                }, () => {
                    Global.showTip('广告展示失败, 请稍后重试!!');
                });
            } else {
                Sdk.ins.showVideoAd((res) => {
                    if (res) {
                        if (!this.isGot) {
                            this.isGot = true;
                            this.cliamReward(5);
                            this.hide();
                        }
                    } else {
                        Global.showTip('广告展示失败, 请稍后重试!!');
                        // Global.showTip('No ads ready!!');
                    }
                });
            }
        }, 'RewardLayer-onClickCliam');
    }
}