From 24d1f8782c262a20ead3e0d68a93eb28cac7d376 Mon Sep 17 00:00:00 2001
From: Spring774 <337905794@qq.com>
Date: Thu, 30 Oct 2025 16:17:05 +0800
Subject: [PATCH] 已打包华为广告验收,并发邮件QQ申报白名单
---
assets/Script/Sdk/SdkHuawei.ts | 51 ++++++++++++++++++++++++++++-----------------------
1 files changed, 28 insertions(+), 23 deletions(-)
diff --git a/assets/Script/Sdk/SdkHuawei.ts b/assets/Script/Sdk/SdkHuawei.ts
index 910e0e1..61735d6 100644
--- a/assets/Script/Sdk/SdkHuawei.ts
+++ b/assets/Script/Sdk/SdkHuawei.ts
@@ -1,19 +1,20 @@
+import { SdkDefault } from "./SdkDefault";
var rewardCallback = null;
-export class SdkHuawei {
+export class SdkHuawei extends SdkDefault {
private lastShowInterAdTime: number = 0;
- private static interstitialAd = null;
- private static rewardedVideoAd = null;
- private static interstitialAdLoaded: boolean = false;
+ private interstitialAd = null;
+ private rewardedVideoAd = null;
+ private interstitialAdLoaded: boolean = false;
/**
* 开始游戏
* @param cb
*/
- static startGame(cb?: Function): void {
+ startGame(cb?: Function): void {
cc.log('SdkHuawei startGame.');
qg.gameLoginWithReal({
@@ -36,20 +37,20 @@
if (code == 7004 || code == 2012) {
console.log("玩家取消登录,返回游戏界面让玩家重新登录。");
cc.director.loadScene('logo');
- }else
- //状态码为7021表示玩家取消实名认证。
- //在中国大陆的情况下,此时需要禁止玩家进入游戏。
- if (code == 7021) {
- console.log("The player has canceled identity verification. Forbid the player from entering the game.")
- cc.director.loadScene('logo');
- }else{
- cc.game.end();
- }
+ } else
+ //状态码为7021表示玩家取消实名认证。
+ //在中国大陆的情况下,此时需要禁止玩家进入游戏。
+ if (code == 7021) {
+ console.log("The player has canceled identity verification. Forbid the player from entering the game.")
+ cc.director.loadScene('logo');
+ } else {
+ cc.game.end();
+ }
}
});
}
- static getOAID() {
+ getOAID() {
"function" == typeof qg.getOAID && qg.getOAID({
success: function (ret) {
console.log("qg.getOAID success :" + JSON.stringify(ret));
@@ -64,7 +65,7 @@
}
//Ads
- static showInterAd() {
+ showInterAd() {
cc.log('show InterAd');
// if (Date.now() - this.lastShowInterAdTime > 30000) {//最少间隔30秒
// this.lastShowInterAdTime = Date.now();
@@ -76,14 +77,14 @@
}
- static loadInterAd() {
+ loadInterAd() {
if (this.interstitialAd) {
this.interstitialAd.destroy();
}
this.interstitialAd = qg.createInterstitialAd({
adUnitId:
- "g2tz5d4wkv" //测试ID
- //"q5m5hlquus"//正式ID
+ // "g2tz5d4wkv" //测试ID
+ "q5m5hlquus"//正式ID
});
this.interstitialAd.load({
"channelExtras": {
@@ -110,11 +111,11 @@
});
}
- static reLoadVideo() {
+ reLoadVideo() {
this.rewardedVideoAd = qg.createRewardedVideoAd({
adUnitId:
- "testx9dtjwj8hp" //测试ID
- //"v1gtsb1ga8" //正式ID
+ // "testx9dtjwj8hp" //测试ID
+ "v1gtsb1ga8" //正式ID
,
success: (code) => {
cc.log("ad demo : loadAndShowVideoAd createRewardedVideoAd success");
@@ -153,7 +154,7 @@
this.rewardedVideoAd.load()
}
- static showVideoAd(cb?: (result: boolean) => void) {
+ showVideoAd(cb?: (result: boolean) => void) {
cc.log('show VideoAd');
// cb && cb(true);
@@ -162,4 +163,8 @@
this.rewardedVideoAd.load();
}
+ isPaymentReady(cb?: (result: boolean) => void) {
+ cb && cb(false);
+ }
+
}
--
Gitblit v1.9.1