xx 1 ano atrás
pai
commit
3f8ec2f476
3 arquivos alterados com 18 adições e 13 exclusões
  1. 6 0
      assets/script/game/car.ts
  2. 1 3
      assets/script/game/game.ts
  3. 11 10
      assets/script/game/results.ts

+ 6 - 0
assets/script/game/car.ts

@@ -45,7 +45,9 @@ export class car extends Component {
     private isStartGame:Boolean = false
     @property(Node) spr:Node = null
     @property(Node) hp_bar:Node = null
+    private mIsReLife:boolean = false
     public init(m:Node,cb,cb1,g:game,isReLife:boolean = false){
+        this.mIsReLife = isReLife
         this.spr.getComponent(Sprite).spriteFrame = imageCacheManager.getGameCarImageById(userDataManager.user_car_list.default_car_id)
         this.spr.getComponent(buff_manager).init()
         this.origin_pos_y = this.node.position.y
@@ -129,6 +131,10 @@ export class car extends Component {
         this.spr.getComponent(buff_manager).init()
     }
 
+    public getIsReLife(){
+        return this.mIsReLife
+    }
+
     addSpeed(){
         let speed = this.move_speed_y.valueOf()+(tools.game_config.car_add_speed_num)
         if(speed<tools.game_config.car_add_speed_max){

+ 1 - 3
assets/script/game/game.ts

@@ -125,9 +125,7 @@ export class game extends Component {
             },()=>{
                 this.removeSelf()
                 this.mCallBackHome()
-            },this.isFristOverGame)
-
-            this.isFristOverGame = false
+            },!this.car.getComponent(car).getIsReLife())
         })
    
     }

+ 11 - 10
assets/script/game/results.ts

@@ -8,10 +8,11 @@ import { userDataManager } from '../manager/userDataManager';
 import { ClientEvent } from '../lib/clientEvent';
 import { SdkUtil } from '../sdkUtil';
 import { results_unlock_car } from './results_unlock_car';
+import { base_ui } from '../fw/base_ui';
 const { ccclass, property } = _decorator;
 
 @ccclass('results')
-export class results extends Component {
+export class results extends base_ui {
     @property(Node) btn_restart:Node = null
     @property(Node) lab_scores:Node = null
     @property(Node) btn_back_home:Node = null
@@ -22,18 +23,18 @@ export class results extends Component {
     private call_back = null
     private back_home_cb = null
     start() {
-        uiManager.Instance().onButtonListen(this.btn_restart,()=>{
+        this.onButtonListen(this.btn_restart,()=>{
             if(this.call_back!=null){
                 this.call_back()
                 this.close()
             }
         })
-        uiManager.Instance().onButtonListen(this.btn_back_home,()=>{
-           if(this.back_home_cb){
+        this.onButtonListen(this.btn_back_home,()=>{
+            if(this.back_home_cb){
                 this.back_home_cb()
-           }
+            }
         })
-        uiManager.Instance().onButtonListen(this.btn_video_reLife,()=>{
+        this.onButtonListen(this.btn_video_reLife,()=>{
             let ad_id = SdkUtil.getAdId(config.ADS_TYPE.GAME_RELIFE_VIDEO)
             SdkUtil.showVideoAd(ad_id,()=>{
                 if(this.call_back){
@@ -43,7 +44,7 @@ export class results extends Component {
             })
         })
 
-         uiManager.Instance().onButtonListen(this.btn_share,()=>{
+        this.onButtonListen(this.btn_share,()=>{
             SdkUtil.shareGame(config.ADS_CONFIG.GAME_RELIFE_SHARE_TITLE,()=>{
                 // if(this.call_back){
                 //     this.call_back(true)
@@ -53,14 +54,14 @@ export class results extends Component {
          })
     }
 
-    private close(){
+    protected close(){
         this.node.active = false;
     }
 
 
-    public show(scores:number,call,back_home_cb,isFristOverGame:boolean){
+    public show(scores:number,call,back_home_cb,isReLife:boolean){
         this.back_home_cb = back_home_cb
-        this.btn_video_reLife.active = isFristOverGame
+        this.btn_video_reLife.active = isReLife
         http.post(config.API.sync_integral,{"integral":scores},(err,data)=>{
             if(!err){
                 let d = JSON.parse(data)