future 1 yıl önce
ebeveyn
işleme
c361fc32cb

+ 16 - 1
assets/script/config.ts

@@ -1,4 +1,4 @@
-import { _decorator, Component, Node } from 'cc';
+import { _decorator, Component, Node, sys } from 'cc';
 import { scene_item_data, widget_item_data } from '../data/data';
 const { ccclass, property } = _decorator;
 
@@ -292,6 +292,14 @@ export class config {
     static MSG_CODE = {
         SUCCESS: 10000,
     }
+    static AD_TYPE = {
+        UNKNOWN: "UNKNOWN",
+        RE_LIFE:"RE_LIFE",
+        ANSWER:"ANSWER",
+        LOOK_TIPS:"LOOK_TIPS",
+        UN_LOCK_24:"UN_LOCK_24",
+        UN_LOCK:"UN_LOCK",
+    }
     static TOKEN:string = ""
     static USER_DATA:string = "userData"
     static TT_SHARE_TEMPLATEID:String = "i6e10hgb28e41bj68g"
@@ -302,6 +310,13 @@ export class config {
         UN_LOCK_24: "38vhsipa5qe3tkpnve",
         UN_LOCK: "52kg38k634094h9b19",
     }
+    static WX_REWARD ={
+        RE_LIFE: "",
+        ANSWER: "",
+        LOOK_TIPS: "",
+        UN_LOCK_24: "",
+        UN_LOCK: "",
+    }
     static STATISTICS_ACTION_TYPE = {
         UNKNOWN: 0,              //未知
         GUAN_KA_FU_HUO: 1,       //关卡复活

+ 2 - 1
assets/script/run/gameManager.ts

@@ -233,7 +233,8 @@ export class gameManager extends Component {
     }
 
     public reLife(){
-        SdkUtil.showVideoAd(config.TT_REWARD.RE_LIFE,(res)=>{
+        let ad_id = SdkUtil.getAdId(config.AD_TYPE.RE_LIFE)
+        SdkUtil.showVideoAd(ad_id,(res)=>{
             if(res.isEnded){
                 this.mGameRun.onlaunch(()=>{
                     gameManager.Singleton.startLevelGame()

+ 5 - 3
assets/script/run/game_list_view/game_list.ts

@@ -169,7 +169,8 @@ export class game_list extends Component {
             }
 
             gameManager.Singleton.showUnLockView((view:unLock_view)=>{
-                SdkUtil.showVideoAd(config.TT_REWARD.UN_LOCK,(res)=>{
+                let ad_id = SdkUtil.getAdId(config.AD_TYPE.UN_LOCK)
+                SdkUtil.showVideoAd(ad_id,(res)=>{
                     if(res.isEnded){
                         item.UnLock()
                         view.close()
@@ -179,8 +180,9 @@ export class game_list extends Component {
                     statisticsManager.request_collect_rewardVideoData(collect_data)
                 })
 
-            },(view:unLock_view)=>{                
-                SdkUtil.showVideoAd(config.TT_REWARD.UN_LOCK_24,(res)=>{
+            },(view:unLock_view)=>{    
+                let ad_id = SdkUtil.getAdId(config.AD_TYPE.UN_LOCK_24)            
+                SdkUtil.showVideoAd(ad_id,(res)=>{
                     if(res.isEnded){
                         gameManager.lookVideoAdsNumber++;
                         view.updateLookVideo()

+ 4 - 2
assets/script/run/tips/tips_view.ts

@@ -35,7 +35,8 @@ export class tips_view extends Component {
             if(this.isLookTipsVideo){
                 this.showTips()
             }else{
-                SdkUtil.showVideoAd(config.TT_REWARD.LOOK_TIPS,(res)=>{
+                let ad_id = SdkUtil.getAdId(config.AD_TYPE.LOOK_TIPS)
+                SdkUtil.showVideoAd(ad_id,(res)=>{
                     if(res.isEnded){
                         this.isLookTipsVideo = true;
                         this.showTips()
@@ -54,7 +55,8 @@ export class tips_view extends Component {
             if( this.isLookAnswerVideo){
                 this.showAnswer()
             }else{                
-                SdkUtil.showVideoAd(config.TT_REWARD.LOOK_TIPS,(res)=>{
+                let ad_id = SdkUtil.getAdId(config.AD_TYPE.ANSWER)
+                SdkUtil.showVideoAd(ad_id,(res)=>{
                     if(res.isEnded){
                         this.isLookAnswerVideo = true;
                         this.showAnswer()

+ 2 - 1
assets/script/run/tips/ui_manifestations.ts

@@ -54,7 +54,8 @@ export class ui_manifestations extends Component {
         if(this.tipsMap.get(data.tips_res)){
             ClientEvent.dispatchEvent(config.EventRun.SHOW_TIPS,data.tips_res)
         }else{
-            SdkUtil.showVideoAd(config.TT_REWARD.LOOK_TIPS,(res)=>{
+            let ad_id = SdkUtil.getAdId(config.AD_TYPE.LOOK_TIPS)
+            SdkUtil.showVideoAd(ad_id,(res)=>{
                 if(res.isEnded){
                     data.is_look_video_ads = true
                     this.updateBtnTipStatus(data)

+ 31 - 0
assets/script/sdkUtil.ts

@@ -151,6 +151,36 @@ export class SdkUtil {
         //     });
         // }
     }
+
+    public static getAdId(ad_type = config.AD_TYPE.UNKNOWN):string {
+        let ad_id = ""
+        if(sys.platform == sys.Platform.BYTEDANCE_MINI_GAME) {
+            if(ad_type == config.AD_TYPE.RE_LIFE) {
+                ad_id = config.TT_REWARD.RE_LIFE
+            } else if (ad_type == config.AD_TYPE.ANSWER) {
+                ad_id = config.TT_REWARD.ANSWER
+            } else if (ad_type == config.AD_TYPE.LOOK_TIPS) {
+                ad_id = config.TT_REWARD.LOOK_TIPS
+            } else if (ad_type == config.AD_TYPE.UN_LOCK_24) {
+                ad_id = config.TT_REWARD.UN_LOCK_24
+            } else if (ad_type == config.AD_TYPE.UN_LOCK) {
+                ad_id = config.TT_REWARD.UN_LOCK
+            }
+        } else if (sys.platform == sys.Platform.WECHAT_GAME) {
+            if(ad_type == config.AD_TYPE.RE_LIFE) {
+                ad_id = config.WX_REWARD.RE_LIFE
+            } else if (ad_type == config.AD_TYPE.ANSWER) {
+                ad_id = config.WX_REWARD.ANSWER
+            } else if (ad_type == config.AD_TYPE.LOOK_TIPS) {
+                ad_id = config.WX_REWARD.LOOK_TIPS
+            } else if (ad_type == config.AD_TYPE.UN_LOCK_24) {
+                ad_id = config.WX_REWARD.UN_LOCK_24
+            } else if (ad_type == config.AD_TYPE.UN_LOCK) {
+                ad_id = config.WX_REWARD.UN_LOCK
+            }
+        }
+        return ad_id
+    }
     
     /**
      * 抖音/微信激励视频
@@ -178,6 +208,7 @@ export class SdkUtil {
             }
 
             if(SdkUtil.videoAd==null){ 
+                gameManager.Singleton.hideLoadingLevel()
                 return
              }