import { _decorator, Component, Node } from 'cc';
import { tools } from '../tools';
import { userDataManager } from './userDataManager';
const { ccclass, property } = _decorator;

@ccclass('dataManager')
export class dataManager  {
  public static getCurUserCar(){ //获取当前汽车
    return dataManager.getCarInfoById(userDataManager.user_car_list.default_car_id)
  }

  public static getCarInfoById(id:number){ //根据id获取车的详情
    for (let index = 0; index < tools.all_car_list.length; index++) {
        const element = tools.all_car_list[index];
        if(element.id===id){
            return element
        }
    }
    return null
  }
}


