12345678910111213141516171819202122232425262728293031323334 |
- import { _decorator, Component, Label, Node, Sprite } from 'cc';
- import { uiManager } from '../../manager/uiManager';
- import { rankData } from '../../data';
- import { imageCacheManager } from '../../manager/imageCacheManager';
- const { ccclass, property } = _decorator;
- @ccclass('home_bottom_rank_item')
- export class home_bottom_rank_item extends Component {
- @property(Node) img_car:Node = null
- @property(Node) lab_nickname:Node = null
- @property(Node) lab_score:Node = null
- private m_data:rankData = null
- private m_cb = null
- protected start(): void {
- uiManager.Instance().onButtonListen(this.node, ()=>{
- if(this.m_cb!=null) {
- this.m_cb(this)
- }
- })
- }
- public initView(data:rankData, cb) {
- this.m_data = data
- this.m_cb = cb
- this.img_car.getComponent(Sprite).spriteFrame = imageCacheManager.getRankCarImageById(data.car_id)
- this.lab_nickname.getComponent(Label).string = data.nickName
- this.lab_score.getComponent(Label).string = data.score + '分'
- }
- public getData():rankData {
- return this.m_data
- }
- }
|