Quellcode durchsuchen

上次1.1.8版本

tang biao vor 5 Jahren
Ursprung
Commit
e80dd87cbb

+ 0 - 1
assets/scripts/applet/MyApplet.js

@@ -8,7 +8,6 @@ cc.Class({
     properties: {
         btnSpriteFrame: [cc.SpriteFrame],
         gainButton: cc.Button
-
     },
 
     // LIFE-CYCLE CALLBACKS:

+ 1 - 1
assets/scripts/draw/DrawContent.js

@@ -210,7 +210,6 @@ cc.Class({
             } else {
                 Global._adVideo.showVideo('draw');
             }
-            
         }
     },
 
@@ -292,6 +291,7 @@ cc.Class({
         } else if (Global._adVideoState === 1) {
             this._adState = 0;
         }
+        /// 如果是cd时间就不做处理
         if (this.normalDrawButton.interactable) {
             this.setUpNormalButton();
         }

+ 4 - 1
assets/scripts/game/Game.js

@@ -112,7 +112,6 @@ cc.Class({
 
         this.additionTipsNode = this.additionTipsNode.getComponent('AdditionTips');
 
-
         if (Global.shareType == ShareAction.SHOW_GROUP_RANK && Global.shareTicket.length > 0) {
             if (this.homeGuide.guideState.state1.pass) {
                 GameEvent.fire(GameNotificationKey.GameShowGroupRank);
@@ -127,6 +126,10 @@ cc.Class({
         }
 
         if (Global.messageNotice !== undefined && Global.messageNotice.length > 0) {
+            if (Global.noticeDiamond !== undefined && Global.noticeDiamond > 0) {
+                let showText = `钻石 x ${Global.noticeDiamond}`;
+                AlertManager.showActGiftAlert('diamond', showText);
+            }
             AlertManager.showNoticeAlert(Global.messageNotice);
         }
 

+ 2 - 1
assets/scripts/login/LoginCtrl.js

@@ -295,7 +295,8 @@ cc.Class({
             //签到的次数
             Global.signCount = data.signCount;
             Global.rsDiamond = data.rsDiamond;
-
+            /// 通知获得的钻石数量
+            Global.noticeDiamond = data.noticeDiamond;
 
             //// 用户拥有的商品
             Global.shops = data.shops;

+ 53 - 32
assets/scripts/utils/ADVideo.js

@@ -15,22 +15,32 @@ class ADVideo {
         /// 默认是加载成功的 啦
         Global._adVideoState = ADVideoLoadState.success;
         this.videoAd = videoAd;
-        videoAd.onLoad(() => {
-            /// 视频加载成功
-            Global._adVideoState = ADVideoLoadState.success;
-            GameEvent.fire(GameNotificationKey.AdUpdateStateNotification, ADVideoLoadState.success);
-            console.log('视频加载成功');
+
+        videoAd.load()
+            .then(() => {
+                Global._adVideoState = ADVideoLoadState.success;
+                GameEvent.fire(GameNotificationKey.AdUpdateStateNotification, ADVideoLoadState.success);
+                console.log('视频加载成功');
+            })
+            .catch(err => {
+                // if ((err.errMsg && err.errMsg.includes('fetch advertisement failed')) || (err.errCode && err.errCode == 1004)) {
+                //     Global.commonAlert.showCommonErrorAlert('今日份视频已经播放完啦~~');
+                // } else {
+                //     Global.commonAlert.showCommonErrorAlert('获取视频失败');
+                // }
+             this.handelVideoErr(err);
         });
 
+        // videoAd.onLoad(() => {
+        //     /// 视频加载成功
+        //     Global._adVideoState = ADVideoLoadState.success;
+        //     GameEvent.fire(GameNotificationKey.AdUpdateStateNotification, ADVideoLoadState.success);
+        //     console.log('视频加载成功');
+        // });
+
         //处理获取视频错误
         videoAd.onError( (res) => {
-            if (this.isNeedShowErr) {
-                Global.commonAlert.showCommonErrorAlert('获取视频失败');
-            } 
-            Global._adVideoState = ADVideoLoadState.fail;
-            this.isNeedShowErr = true;
-            console.log('获取视频失败 fa' + res.errMsg);
-            GameEvent.fire(GameNotificationKey.AdUpdateStateNotification, ADVideoLoadState.fail);
+            this.handelVideoErr(res);
         });
 
         
@@ -53,12 +63,37 @@ class ADVideo {
     }
     /// 需要在close中回调的对象
     showVideo(callBackObjct = null) {
-        if (GameModule.audioMng) {
-            GameModule.audioMng.stopBgm();
-        }
-        console.log('开始播放视频');
         this.callBackObjct = callBackObjct;
-        this.videoAd.show();
+        this.videoAd.load()
+            .then(() => {
+                if (GameModule.audioMng) {
+                    GameModule.audioMng.stopBgm();
+                }
+                this.videoAd.show();
+            })
+            .catch(err => {
+                // if ((err.errMsg && err.errMsg.includes('fetch advertisement failed')) || (err.errCode && err.errCode == 1004)) {
+                //     Global.commonAlert.showCommonErrorAlert('今日份视频已经播放完啦~~');
+                // } else {
+                //     Global.commonAlert.showCommonErrorAlert('获取视频失败');
+                // }
+                if (err.errMsg && err.errMsg.includes('video-ad is showed')) {
+                    Global.commonAlert.showCommonErrorAlert('视频正在播放请不要重复点击~~');
+                    return;
+                } else {
+                    this.handelVideoErr(err);
+                }
+        });
+    }
+
+    handelVideoErr(res) {
+        if (this.isNeedShowErr) {
+            Global.commonAlert.showCommonErrorAlert('获取视频失败');
+        } 
+        Global._adVideoState = ADVideoLoadState.fail;
+        this.isNeedShowErr = true;
+        console.log('获取视频失败 fa' + res.errMsg);
+        GameEvent.fire(GameNotificationKey.AdUpdateStateNotification, ADVideoLoadState.fail);
     }
 
     // static wxPlayADVideo(adId,error,close) {
@@ -66,21 +101,7 @@ class ADVideo {
     //         adUnitId: adId
     //     })
 
-    //     videoAd.load()
-    //         .then(() => {
-    //             if (GameModule.audioMng) {
-    //                 GameModule.audioMng.stopBgm();
-    //             }
-    //                 videoAd.show()
-    //             })
-    //         .catch(err => {
-    //             if ((err.errMsg && err.errMsg.includes('fetch advertisement failed')) || (err.errCode && err.errCode == 1004)) {
-    //                 Global.commonAlert.showCommonErrorAlert('今日份视频已经播放完啦~~');
-    //             } else {
-    //                 Global.commonAlert.showCommonErrorAlert('获取视频失败');
-    //             }
-    //             error && error();
-    //         });
+
 
     //     //处理获取视频错误
     //     videoAd.onError( (res) => {

+ 1 - 1
assets/scripts/utils/Global.js

@@ -14,7 +14,7 @@ window.Global = {
 
     debug: false,
 
-    ver: 117, //游戏版本号发版时需要核对
+    ver: 118, //游戏版本号发版时需要核对
     
     isCheck: false,