Spring774
2025-11-12 2379cc78112ecbe65a9fcb817d6441875f785803
assets/Script/Sdk/SdkHuawei.ts
@@ -23,8 +23,10 @@
            success: (data) => {
                // 登录成功后,可以存储账号信息。             
                console.log(" game login with real success:" + JSON.stringify(data));
                cb && cb();
                this.isLogin = true;
                cb && cb(true);
                this.lastShowInterAdTime = Date.now();
                this.getOAID();
                this.reLoadVideo();
@@ -36,13 +38,15 @@
                //此时,建议返回游戏界面,可以让玩家重新进行登录操作。
                if (code == 7004 || code == 2012) {
                    console.log("玩家取消登录,返回游戏界面让玩家重新登录。");
                    cc.director.loadScene('logo');
                    // cc.director.loadScene('logo');
                    cb && cb(false);
                } else
                    //状态码为7021表示玩家取消实名认证。
                    //在中国大陆的情况下,此时需要禁止玩家进入游戏。
                    if (code == 7021) {
                        console.log("The player has canceled identity verification. Forbid the player from entering the game.")
                        cc.director.loadScene('logo');
                        // cc.director.loadScene('logo');
                        cc.game.end();
                    } else {
                        cc.game.end();
                    }
@@ -67,13 +71,11 @@
    //Ads
    showInterAd() {
        cc.log('show InterAd');
        // if (Date.now() - this.lastShowInterAdTime > 30000) {//最少间隔30秒
        //     this.lastShowInterAdTime = Date.now();
        if (Date.now() - this.lastShowInterAdTime > 40000) {//最少间隔40秒
            this.lastShowInterAdTime = Date.now();
        // }
        this.loadInterAd();
            this.loadInterAd();
        }
    }
@@ -83,8 +85,8 @@
        }
        this.interstitialAd = qg.createInterstitialAd({
            adUnitId:
            //    "g2tz5d4wkv" //测试ID
            "q5m5hlquus"//正式ID
                //    "g2tz5d4wkv" //测试ID
                "q5m5hlquus"//正式ID
        });
        this.interstitialAd.load({
            "channelExtras": {
@@ -114,8 +116,8 @@
    reLoadVideo() {
        this.rewardedVideoAd = qg.createRewardedVideoAd({
            adUnitId:
            //    "testx9dtjwj8hp" //测试ID
            "v1gtsb1ga8" //正式ID
                //    "testx9dtjwj8hp" //测试ID
                "v1gtsb1ga8" //正式ID
            ,
            success: (code) => {
                cc.log("ad demo : loadAndShowVideoAd createRewardedVideoAd success");
@@ -159,6 +161,7 @@
        // cb && cb(true);
        rewardCallback = cb;
        this.lastShowInterAdTime = Date.now();
        this.rewardedVideoAd.show();
        this.rewardedVideoAd.load();
    }