future 1 ano atrás
pai
commit
254610307a

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

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

+ 2 - 1
assets/script/config.ts

@@ -110,7 +110,8 @@ export class config  {
     }
 
     public static UI_EVENT ={
-        GET_NEW_CAR:"get_new_car"
+        GET_NEW_CAR:"get_new_car",
+        UPDATE_USER_DEFAULT_CAR:"update_user_default_car",
     }
 
     public static ADS_CONFIG = {

+ 4 - 0
assets/script/ui/car_lib/car_lib.ts

@@ -4,6 +4,9 @@ import { car_lib_top } from './car_lib_top';
 import { car_lib_bottom } from './car_lib_bottom';
 import { car_lib_list_item } from './car_lib_list_item';
 import { userDataManager } from '../../manager/userDataManager';
+import { uiManager } from '../../manager/uiManager';
+import { ClientEvent } from '../../lib/clientEvent';
+import { config } from '../../config';
 const { ccclass, property } = _decorator;
 
 @ccclass('car_lib')
@@ -28,6 +31,7 @@ export class car_lib extends base_ui {
     private onClickListItem(item:car_lib_list_item) {
         userDataManager.user_car_list.default_car_id = item.getData().id
         this.top_node.getComponent(car_lib_top).reloadUserCar()
+        ClientEvent.dispatchEvent(config.UI_EVENT.UPDATE_USER_DEFAULT_CAR)
     }
 }
 

+ 6 - 5
assets/script/ui/home/home.ts

@@ -25,21 +25,22 @@ export class home extends Component {
             this.node.parent.active = false
         })
         ClientEvent.on(config.UI_EVENT.GET_NEW_CAR,this.onGetNewCar.bind(this),this)
-        this.reloadCountryRankData()
+        ClientEvent.on(config.UI_EVENT.UPDATE_USER_DEFAULT_CAR,this.onUpdateUserDefaultCar.bind(this),this)
     }
 
     onGetNewCar(){
         console.log("获取新车:",dataManager.getCarInfoById(userDataManager.user_car_list.default_car_id))
     }
+
+    onUpdateUserDefaultCar() {
+        this.home_car.getComponent(home_car).updateCar()
+    }
+    
     public init(){
         this.home_car.getComponent(home_car).updateCar()
         this.top.getComponent(home_top).init()
         this.bottom.getComponent(home_bottom).init()
     }
-
-    public reloadCountryRankData() {
-        this.bottom.getComponent(home_bottom).reloadCountryRankData()
-    }
 }
 
 

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

@@ -34,6 +34,7 @@ export class home_bottom extends Component {
 
     public init() {
         this.lab_week_score.getComponent(Label).string = tools.mine_rank_data.score + ''
+        this.reloadCountryRankData()
     }
     
     public reloadCountryRankData(){