home.ts 900 B

12345678910111213141516171819202122232425262728
  1. import { _decorator, Component, Node } from 'cc';
  2. import { uiManager } from '../../manager/uiManager';
  3. import { home_car } from './home_car';
  4. import { home_top } from './home_top';
  5. import { home_bottom } from './home_bottom';
  6. import { tools } from '../../tools';
  7. const { ccclass, property } = _decorator;
  8. @ccclass('home')
  9. export class home extends Component {
  10. @property(Node) home_car:Node = null
  11. @property(Node) top:Node = null
  12. @property(Node) bottom:Node = null
  13. @property(Node) btn_start_game:Node = null
  14. protected start(): void {
  15. uiManager.Instance().onButtonListen(this.btn_start_game,()=>{
  16. tools.playGame()
  17. this.node.parent.active = false
  18. })
  19. }
  20. public init(){
  21. this.home_car.getComponent(home_car).updateCar()
  22. this.top.getComponent(home_top).init()
  23. this.bottom.getComponent(home_bottom).init()
  24. }
  25. }