Parcourir la source

Merge branch 'master' of http://120.79.128.142:3000/904118851/car

xx il y a 1 an
Parent
commit
dec11eb9f2

+ 8 - 8
assets/resources/ui/home.prefab

@@ -143,7 +143,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 1919.9999999999998
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -290,7 +290,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": 463.9999999999999,
+      "y": 464,
       "z": 0
     },
     "_lrot": {
@@ -3723,7 +3723,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": -959.9999999999999,
+      "y": -960,
       "z": 0
     },
     "_lrot": {
@@ -4353,7 +4353,7 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 145,
+      "width": 135,
       "height": 30
     },
     "_anchorPoint": {
@@ -5119,7 +5119,7 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 160,
+      "width": 145,
       "height": 30
     },
     "_anchorPoint": {
@@ -5162,7 +5162,7 @@
     "_fontSize": 25,
     "_fontFamily": "Arial",
     "_lineHeight": 30,
-    "_overflow": 2,
+    "_overflow": 1,
     "_enableWrapText": false,
     "_font": null,
     "_isSystemFontUsed": true,
@@ -5885,7 +5885,7 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 145,
+      "width": 135,
       "height": 30
     },
     "_anchorPoint": {
@@ -9021,7 +9021,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 1919.9999999999998
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",

+ 10 - 10
assets/resources/ui/rank.prefab

@@ -109,7 +109,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": 864.9999999999999,
+      "y": 865,
       "z": 0
     },
     "_lrot": {
@@ -469,7 +469,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": 699.9999999999999,
+      "y": 700,
       "z": 0
     },
     "_lrot": {
@@ -1169,7 +1169,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": -10.000000000000114,
+      "y": -10,
       "z": 0
     },
     "_lrot": {
@@ -1235,7 +1235,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": 319.9999999999998,
+      "y": 320,
       "z": 0
     },
     "_lrot": {
@@ -5613,7 +5613,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": 324.9999999999998,
+      "y": 325,
       "z": 0
     },
     "_lrot": {
@@ -5654,7 +5654,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1000,
-      "height": 649.9999999999995
+      "height": 650
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -5927,7 +5927,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 649.9999999999995
+      "height": 650
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -6046,7 +6046,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 1299.9999999999995
+      "height": 1300
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -6184,7 +6184,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": -829.9999999999999,
+      "y": -830,
       "z": 0
     },
     "_lrot": {
@@ -8302,7 +8302,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 1919.9999999999998
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",

+ 2 - 2
assets/resources/ui/user_info_view.prefab

@@ -140,7 +140,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 1919.9999999999998
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -2473,7 +2473,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 1919.9999999999998
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",

+ 4 - 4
assets/scene/main.scene

@@ -192,7 +192,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 1919.9999999999998
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -290,7 +290,7 @@
     "_priority": 0,
     "_fov": 45,
     "_fovAxis": 0,
-    "_orthoHeight": 959.9999999999999,
+    "_orthoHeight": 960,
     "_near": 0,
     "_far": 1000,
     "_color": {
@@ -561,7 +561,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 1919.9999999999998
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -867,7 +867,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 1919.9999999999998
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",

+ 3 - 1
assets/script/GameManager.ts

@@ -4,6 +4,7 @@ import { settingData } from './data';
 import { http } from './http';
 import { imageCacheManager } from './manager/imageCacheManager';
 import { userDataManager } from './manager/userDataManager';
+import { SdkUtil } from './sdkUtil';
 const { ccclass, property } = _decorator;
 
 @ccclass('GameManager')
@@ -11,6 +12,7 @@ export class GameManager extends Component {
     public static openId:string = 'asd'
     public static settingData:settingData = null
 
+    // 设置
     public static getUserDefaultCarSf():SpriteFrame {
         let sf = imageCacheManager.getHomeCarImageById(userDataManager.user_car_list.default_car_id)
         return sf
@@ -38,7 +40,7 @@ export class GameManager extends Component {
     }
 
     //获取用户车列表
-    public static getUserCarList(cb=null) {
+    public static requestUserCarList(cb=null) {
         http.post(config.API.user_car_list,null,(err,d)=>{
             if(!err){
                 let nd = JSON.parse(d)

+ 7 - 4
assets/script/config.ts

@@ -33,8 +33,10 @@ export class config  {
     static USE_RFREE_ADS_LOOK_VIDEO_COUNT:string = "USE_RFREE_ADS_LOOK_VIDEO_COUNT"
     static USE_RFREE_ADS_TIME:string = "USE_RFREE_ADS_TIME"
 
-    public static AD_TYPE = {
-        UNKNOWN:""
+    public static ADS_TYPE = {
+        UNKNOWN:"",
+        GAME_RELIFE_VIDEO:"GAME_RELIFE_VIDEO",
+        GAME_INFINITE_DEGREE_VIDEO:"GAME_INFINITE_DEGREE_VIDEO",
     }
 
 
@@ -119,8 +121,9 @@ export class config  {
     }
 
     public static ADS_CONFIG = {
-        GAME_RELIFE_VIDEO:"5t1nl6s6ibt7a2dhhk", //游戏看视频复活
-        GAME_RELIFE_SHARE_TITLE:"分享游戏获得复活"//游戏分享复活
+        GAME_RELIFE_VIDEO:"129f13tkcgi1k9i38h",           //游戏看视频复活
+        GAME_RELIFE_SHARE_TITLE:"分享游戏获得复活",          //游戏分享复活
+        GAME_INFINITE_DEGREE_VIDEO:"c7lih7for4j2vjmllv",  //无限次数
     }
 }
 

+ 2 - 3
assets/script/game/results.ts

@@ -33,10 +33,9 @@ export class results extends Component {
                 this.back_home_cb()
            }
         })
-
-
         uiManager.Instance().onButtonListen(this.btn_video_reLife,()=>{
-            SdkUtil.showVideoAd(config.ADS_CONFIG.GAME_RELIFE_VIDEO,()=>{
+            let ad_id = SdkUtil.getAdId(config.ADS_TYPE.GAME_RELIFE_VIDEO)
+            SdkUtil.showVideoAd(ad_id,()=>{
                 if(this.call_back){
                     this.call_back(true)
                     this.close()

+ 2 - 2
assets/script/manager/uiManager.ts

@@ -42,7 +42,7 @@ export class uiManager  {
 
     public showLoading(){
         if(this.loading_view!=null){
-
+            this.loading_view.active = true
         }else{
             console.error("loading view not init..")
         }
@@ -50,7 +50,7 @@ export class uiManager  {
 
     public hideLoading(){
         if(this.loading_view!=null){
-            
+            this.loading_view.active = false
         }else{
             console.error("loading view not init..")
         }

+ 2 - 2
assets/script/manager/userDataManager.ts

@@ -18,7 +18,7 @@ export class userDataManager  {
     // 用户免广告看视频次数 
     public static getUserFreeAdsLookVideoCount():number {
         let count = sys.localStorage.getItem(config.USE_RFREE_ADS_LOOK_VIDEO_COUNT)
-        if(count==null||count==undefined) {
+        if(count==null||count==undefined||count=='') {
             return 0
         }
         return count
@@ -35,7 +35,7 @@ export class userDataManager  {
 
     public static getUserFreeAdsTime() {
         // sys.localStorage.removeItem(config.USE_RFREE_ADS_TIME)
-        // sys.localStorage.removeItem(config.USE_RFREE_ADS_COUNT)
+        // sys.localStorage.removeItem(config.USE_RFREE_ADS_LOOK_VIDEO_COUNT)
         let old_time = sys.localStorage.getItem(config.USE_RFREE_ADS_TIME)
         // console.log('old_time=',old_time)
         if(old_time==null||old_time==undefined) {

+ 17 - 35
assets/script/sdkUtil.ts

@@ -1,5 +1,6 @@
 import { _decorator, error, SpriteFrame, sys } from "cc";
 import { config } from "./config";
+import { uiManager } from "./manager/uiManager";
 //管理广告、分享、SDK相关内容的组件
 export class SdkUtil {
     public static platform: string = 'cocos'; //平台
@@ -107,45 +108,26 @@ export class SdkUtil {
     // }
 
     // 获取广告id
-    public static getAdId(ad_type = config.AD_TYPE.UNKNOWN):string {
+    public static getAdId(ad_type = config.ADS_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 (ad_type == config.AD_TYPE.ADD_TIME) {
-        //         ad_id = config.TT_REWARD.ADD_TIME
-        //     }
-        // } 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
-        //     } else if (ad_type == config.AD_TYPE.ADD_TIME) {
-        //         ad_id = config.WX_REWARD.ADD_TIME
-        //     }
-        // }
+        if(sys.platform == sys.Platform.BYTEDANCE_MINI_GAME) {
+            if(ad_type==config.ADS_TYPE.GAME_RELIFE_VIDEO) {
+                ad_id = config.ADS_CONFIG.GAME_RELIFE_VIDEO
+            } else if(ad_type==config.ADS_TYPE.GAME_INFINITE_DEGREE_VIDEO) {
+                ad_id = config.ADS_CONFIG.GAME_INFINITE_DEGREE_VIDEO
+            }
+        } else if (sys.platform == sys.Platform.WECHAT_GAME) {
+            // if(SdkUtil.KS_GAME) {
+            // } else {
+            // }
+        }
         return ad_id
     }
     
     // 显示激励视频广告
     public static showVideoAd(_adUnitId: string, call_back) {
-        call_back()
         if(sys.platform==sys.Platform.BYTEDANCE_MINI_GAME) {
-            // gameManager.Singleton.showLoadingLevel()
+            uiManager.Instance().showLoading()
             SdkUtil.videoAd = tt.createRewardedVideoAd({adUnitId: _adUnitId});
         } else {
             call_back({"isEnded":true})
@@ -153,7 +135,7 @@ export class SdkUtil {
         }
 
         if(SdkUtil.videoAd==null){ 
-            // gameManager.Singleton.hideLoadingLevel()
+            uiManager.Instance().hideLoading()
             return
         }
 
@@ -166,14 +148,14 @@ export class SdkUtil {
             call_back(res)
             SdkUtil.isLookAd = false
             SdkUtil.videoAd.destroy()
-            // gameManager.Singleton.hideLoadingLevel()
+            uiManager.Instance().hideLoading()
         });
         SdkUtil.videoAd.onError((res) => {
             let errorString = res.errCode + '-' + res.errMsg
             call_back({isEnded:false,errorString:errorString})
             SdkUtil.isLookAd = false
             SdkUtil.videoAd.destroy()
-            // gameManager.Singleton.hideLoadingLevel()
+            uiManager.Instance().hideLoading()
         });
         SdkUtil.videoAd.load()
     }

+ 1 - 26
assets/script/tools.ts

@@ -64,32 +64,7 @@ export class tools  {
             }
         }); 
     }
-
-    // 获取广告id
-    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 (ad_type == config.AD_TYPE.ADD_TIME) {
-            //     ad_id = config.TT_REWARD.ADD_TIME
-            // }
-        } else if (sys.platform == sys.Platform.WECHAT_GAME) {
-            // if(SdkUtil.KS_GAME) {
-            // } else {
-            // }
-        }
-        return ad_id
-    }
-
+    
 }
 
 

+ 0 - 1
assets/script/ui/home/home_bottom.ts

@@ -39,7 +39,6 @@ export class home_bottom extends Component {
             }
             uiManager.Instance().showUi(config.UI.ui_unLock_view, null, (node:Node)=>{
                 node.getComponent(unLock_view).initView((v:unLock_view)=>{
-                    v.closeSelf()
                     this.reloadCountdown()
                 })
             })

+ 1 - 0
assets/script/ui/home/home_bottom_countdown.ts

@@ -22,6 +22,7 @@ export class home_bottom_countdown extends Component {
             this.seconds --
             if(this.seconds<=0) {
                 userDataManager.is_free_ads = false
+                userDataManager.saveUserFreeAdsLookVideoCount(0)
                 this.unscheduleAllCallbacks()
                 this.node.active = false
                 return

+ 8 - 1
assets/script/ui/home/home_bottom_rank_item.ts

@@ -23,7 +23,14 @@ export class home_bottom_rank_item extends Component {
         this.m_data = data
         this.m_cb = cb
         this.img_car.getComponent(Sprite).spriteFrame = imageCacheManager.getRankCarImageById(data.car_id)
-        this.lab_nickname.getComponent(Label).string = data.nickName
+        let lab_component = this.lab_nickname.getComponent(Label)
+        if(data.nickName.length>5) {
+            lab_component.string = data.nickName.substring(0,5) + '...'
+            lab_component.horizontalAlign = Label.HorizontalAlign.LEFT
+        } else {
+            lab_component.horizontalAlign = Label.HorizontalAlign.CENTER
+            lab_component.string = data.nickName
+        }
         this.lab_score.getComponent(Label).string = data.score + '分'
     }
 

+ 3 - 3
assets/script/ui/loading_view.ts

@@ -59,7 +59,7 @@ export class loading_view extends Component {
                     break
                 case 0.4:
                     this.m_pause_status = true
-                    this.getUserCarList(()=>{
+                    this.initUserCarList(()=>{
                         this.m_pause_status = false
                     })
                     break
@@ -182,8 +182,8 @@ export class loading_view extends Component {
         })
     }
 
-    private getUserCarList(cb){
-        GameManager.getUserCarList((d_content)=>{
+    private initUserCarList(cb){
+        GameManager.requestUserCarList((d_content)=>{
             userDataManager.user_car_list = d_content
             if(cb!=null) {
                 cb()

+ 19 - 10
assets/script/ui/unLock_view.ts

@@ -2,6 +2,8 @@ import { _decorator, Component, Label, Node, Animation } from 'cc';
 import { base_ui } from '../fw/base_ui';
 import { userDataManager } from '../manager/userDataManager';
 import { tools } from '../tools';
+import { SdkUtil } from '../sdkUtil';
+import { config } from '../config';
 const { ccclass, property } = _decorator;
 
 @ccclass('unLock_view')
@@ -43,17 +45,24 @@ export class unLock_view extends base_ui {
         if(this.m_cur_count>=this.m_max_count) {
             return
         }
-        this.m_cur_count++
-        userDataManager.saveUserFreeAdsLookVideoCount(this.m_cur_count)
-        this.lab_look_video.getComponent(Label).string = '看视频' + this.m_cur_count + '/' + this.m_max_count
-        if(this.m_cur_count>=this.m_max_count) {
-            if(this.m_lookVideo_finish_cb) {
-                let cur_time = new Date().getTime()
-                userDataManager.saveUserFreeAdsTime(cur_time)
-                userDataManager.saveUserFreeAdsLookVideoCount(0)
-                this.m_lookVideo_finish_cb(this)
+        let ad_id = SdkUtil.getAdId(config.ADS_TYPE.GAME_INFINITE_DEGREE_VIDEO)
+        SdkUtil.showVideoAd(ad_id,(res)=>{
+            if(res.isEnded){
+                this.m_cur_count++
+                userDataManager.saveUserFreeAdsLookVideoCount(this.m_cur_count)
+                this.lab_look_video.getComponent(Label).string = '看视频' + this.m_cur_count + '/' + this.m_max_count
+                if(this.m_cur_count>=this.m_max_count) {
+                    if(this.m_lookVideo_finish_cb) {
+                        let cur_time = new Date().getTime()
+                        userDataManager.saveUserFreeAdsTime(cur_time)
+                        userDataManager.saveUserFreeAdsLookVideoCount(0)
+                        this.m_lookVideo_finish_cb(this)
+                    }
+                    this.closeSelf()
+                }
             }
-        }
+        })
+        
     }
 
     closeSelf() {