future 1 жил өмнө
parent
commit
786d74e7d1

+ 4 - 4
assets/scene/main.scene

@@ -105,7 +105,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 540,
-      "y": 960,
+      "y": 960.0000000000002,
       "z": 0
     },
     "_lrot": {
@@ -192,7 +192,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 1920
+      "height": 1920.0000000000002
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -561,7 +561,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 1920
+      "height": 1920.0000000000002
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -867,7 +867,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 1920
+      "height": 1920.0000000000002
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",

+ 7 - 7
assets/script/config.ts

@@ -197,13 +197,13 @@ export class config  {
         ADS_ID_GET_SUIPIAN:"23i59fd7sd31n9ctc3",            //获取碎片
     }
     public static WX_CONFIG = {
-        SHARE_RELIFE_TITLE:"",            //分享复活标题
-        ADS_ID_INFINITE_DEGREE_VIDEO:"",  //无限次数
-        ADS_ID_RELIFE_VIDEO:"",           //游戏看视频复活
-        ADS_ID_RESTART:"",                //在玩一局
-        ADS_ID_SIGN_DOUBLE:"",            //签到双倍
-        ADS_ID_SIGN_BUQIAN:"",            //签到补签
-        ADS_ID_GET_SUIPIAN:"",            //获取碎片
+        SHARE_RELIFE_TITLE:"分享游戏获得复活",            //分享复活标题
+        ADS_ID_INFINITE_DEGREE_VIDEO:"adunit-f619f3cfee86dc81",  //无限次数
+        ADS_ID_RELIFE_VIDEO:"adunit-4b9fc0c27ecc4a2a",           //游戏看视频复活
+        ADS_ID_RESTART:"adunit-6134665cfaa8c26f",                //在玩一局
+        ADS_ID_SIGN_DOUBLE:"adunit-0bc32c99de188dce",            //签到双倍
+        ADS_ID_SIGN_BUQIAN:"adunit-6f0a5a1eeaed2a24",            //签到补签
+        ADS_ID_GET_SUIPIAN:"adunit-dd8bf215d557fed6",            //获取碎片
     }
     public static KS_CONFIG = {
         SHARE_RELIFE_TITLE:"",            //分享复活标题

+ 34 - 13
assets/script/sdkUtil.ts

@@ -554,10 +554,8 @@ export class SdkUtil {
                 SdkUtil.videoAd = tt.createRewardedVideoAd({adUnitId: _adUnitId});
                 break;
             case config.Platform.WX:
-                // uiManager.Instance().showLoading()
-                // SdkUtil.videoAd = wx.createRewardedVideoAd({adUnitId: _adUnitId});
-                call_back && call_back({"isEnded":true})
-                return
+                uiManager.Instance().showLoading()
+                SdkUtil.videoAd = wx.createRewardedVideoAd({adUnitId: _adUnitId});
                 break;
             case config.Platform.KS:
                 // uiManager.Instance().showLoading()
@@ -575,24 +573,45 @@ export class SdkUtil {
             uiManager.Instance().hideLoading()
             return
         }
-
+        if(tools.platform == config.Platform.WX) {
+            // 取消关闭,取消错误,提示重复回调,造成奖励重复发送的问题或错误重复发送的问题
+            SdkUtil.videoAd.offClose() 
+            SdkUtil.videoAd.offError()
+            SdkUtil.videoAd.load().then(()=>{
+                console.log("wx 广告加载完成");
+                SdkUtil.isLookAd = true
+                SdkUtil.videoAd.show()
+                setTimeout(()=>{
+                    uiManager.Instance().hideLoading()
+                },1000)
+            }).catch(err=>{
+                console.error('wx 视频广告加载或展示失败:', err);
+                let errorString = err.errCode + '-' + err.errMsg
+                call_back && call_back({isEnded:false,errorString:errorString})
+                SdkUtil.isLookAd = false
+                uiManager.Instance().hideLoading()
+            })
+        }
         if(tools.platform==config.Platform.KS) {
             SdkUtil.videoAd.show().then(()=>{
                 console.log("ks 广告加载完成");
                 SdkUtil.isLookAd = true
             })
         }
-
-        SdkUtil.videoAd.onLoad(() => {
-            console.log("广告加载完成");
-            SdkUtil.isLookAd = true
-            SdkUtil.videoAd.show();
-        });
+        if(tools.platform==config.Platform.TT) {
+            SdkUtil.videoAd.onLoad(() => {
+                console.log("tt 广告加载完成");
+                SdkUtil.isLookAd = true
+                SdkUtil.videoAd.show();
+            });
+        }
         SdkUtil.videoAd.onClose((res) => {
             console.log('广告关闭=',res)
             uiManager.Instance().hideLoading()
             SdkUtil.isLookAd = false
-            SdkUtil.videoAd.destroy()
+            if(tools.platform!=config.Platform.WX) {
+                SdkUtil.videoAd.destroy() // 微信销毁后,再次获取广告,不会显示
+            }
             call_back && call_back(res)
         });
         SdkUtil.videoAd.onError((res) => {
@@ -601,7 +620,9 @@ export class SdkUtil {
             let errorString = res.errCode + '-' + res.errMsg
             call_back && call_back({isEnded:false,errorString:errorString})
             SdkUtil.isLookAd = false
-            SdkUtil.videoAd.destroy()
+            if(tools.platform!=config.Platform.WX) {
+                SdkUtil.videoAd.destroy() // 微信销毁后,再次获取广告,不会显示
+            }
         });
         if(tools.platform==config.Platform.TT) {
             SdkUtil.videoAd.load()