future 1 жил өмнө
parent
commit
02234e6991

+ 24 - 10
assets/script/sdkUtil.ts

@@ -438,11 +438,16 @@ export class SdkUtil {
         } 
         } 
         else if(sys.platform==sys.Platform.WECHAT_GAME) {
         else if(sys.platform==sys.Platform.WECHAT_GAME) {
             call_back({"isEnded":true})
             call_back({"isEnded":true})
-            // uiManager.Instance().showLoading()
-            // if(SdkUtil.KS_GAME) {
+            // if(SdkUtil.KS_GAME) { 
+            //     uiManager.Instance().showLoading()
             //     SdkUtil.videoAd = ks.createRewardedVideoAd({adUnitId: _adUnitId});
             //     SdkUtil.videoAd = ks.createRewardedVideoAd({adUnitId: _adUnitId});
-            // } else {
-            //     SdkUtil.videoAd = wx.createRewardedVideoAd({adUnitId: _adUnitId});
+            // } 
+            // else { 
+            //     console.log('wx ad') 
+            //     call_back({"isEnded":true})
+            //     // gameManager.Singleton.showLoadingLevel()
+            //     // SdkUtil.videoAd = wx.createRewardedVideoAd({adUnitId: _adUnitId});
+            //     return
             // }
             // }
         }
         }
         else {
         else {
@@ -455,27 +460,36 @@ export class SdkUtil {
             return
             return
         }
         }
 
 
+        if(SdkUtil.KS_GAME) {
+            SdkUtil.videoAd.show().then(()=>{
+                console.log("ks 广告加载完成");
+                SdkUtil.isLookAd = true
+            })
+        }
+
         SdkUtil.videoAd.onLoad(() => {
         SdkUtil.videoAd.onLoad(() => {
+            console.log("广告加载完成");
             SdkUtil.isLookAd = true
             SdkUtil.isLookAd = true
             SdkUtil.videoAd.show();
             SdkUtil.videoAd.show();
-            console.log("广告加载完成");
         });
         });
         SdkUtil.videoAd.onClose((res) => {
         SdkUtil.videoAd.onClose((res) => {
-            // console.log('广告关闭')
+            console.log('广告关闭=',res)
             uiManager.Instance().hideLoading()
             uiManager.Instance().hideLoading()
             SdkUtil.isLookAd = false
             SdkUtil.isLookAd = false
             SdkUtil.videoAd.destroy()
             SdkUtil.videoAd.destroy()
             call_back(res)
             call_back(res)
         });
         });
         SdkUtil.videoAd.onError((res) => {
         SdkUtil.videoAd.onError((res) => {
-            // console.log('广告错误')
+            console.log('广告加载失败=',res)
             uiManager.Instance().hideLoading()
             uiManager.Instance().hideLoading()
-            SdkUtil.isLookAd = false
-            SdkUtil.videoAd.destroy()
             let errorString = res.errCode + '-' + res.errMsg
             let errorString = res.errCode + '-' + res.errMsg
             call_back({isEnded:false,errorString:errorString})
             call_back({isEnded:false,errorString:errorString})
+            SdkUtil.isLookAd = false
+            SdkUtil.videoAd.destroy()
         });
         });
-        SdkUtil.videoAd.load()
+        if(sys.platform==sys.Platform.BYTEDANCE_MINI_GAME) {
+            SdkUtil.videoAd.load()
+        }
     }
     }
 
 
     //------------------------------  微信相关  ------------------------------//
     //------------------------------  微信相关  ------------------------------//