12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- import { _decorator, Component, Label, Node } from 'cc';
- import { uiManager } from '../../manager/uiManager';
- import { config } from '../../config';
- import { userDataManager } from '../../manager/userDataManager';
- import { select_area } from '../select_area/select_area';
- import { area_item_data } from '../../data';
- import { GameManager } from '../../GameManager';
- const { ccclass, property } = _decorator;
- @ccclass('home_top')
- export class home_top extends Component {
- @property(Node) btn_region:Node = null
- @property(Node) lab_region:Node = null
- @property(Node) btn_gong_gao:Node = null
- @property(Node) btn_setting:Node = null
- @property(Node) lab_nickname:Node = null
- @property(Node) btn_car_lib:Node = null
- @property(Node) lab_car_pai:Node = null
- protected start(): void {
- uiManager.Instance().onButtonListen(this.btn_region,()=>{
- uiManager.Instance().showUi(config.UI.ui_select_area, null, (node:Node)=>{
- node.getComponent(select_area).initView(true, this.onSelectArea.bind(this))
- })
- })
- uiManager.Instance().onButtonListen(this.btn_gong_gao,()=>{
- uiManager.Instance().showUi(config.UI.ui_announcement)
- })
- uiManager.Instance().onButtonListen(this.btn_setting,()=>{
- uiManager.Instance().showUi(config.UI.ui_setting)
- })
- uiManager.Instance().onButtonListen(this.btn_car_lib, ()=>{
- uiManager.Instance().showUi(config.UI.car_lib)
- })
- }
- public init(){
- let user_data = userDataManager.user_data
- this.lab_region.getComponent(Label).string = user_data.province_name + ' - ' + user_data.city_name
- this.lab_nickname.getComponent(Label).string = user_data.nickName
- this.lab_car_pai.getComponent(Label).string = user_data.license_code
- }
- private onSelectArea(obj:select_area, data:area_item_data) {
- GameManager.requestUserSetRegion(data.id, 2, (d)=>{
- obj.closeSelf()
- })
- }
- }
|