import { _decorator, Color, Component, Label, Node, Sprite } from 'cc'; const { ccclass, property } = _decorator; @ccclass('LeaderBoardItem') export class LeaderBoardItem extends Component { @property({ type: Sprite, visible: true }) private _bg: Sprite; @property({ type: Label, visible: true }) private _scoreText: Label; @property({ type: Label, visible: true }) private _topText: Label; @property({ visible: true }) private _highLightColor: Color = new Color(); public init(top: number, score: number, isPlayer: boolean) { if (isPlayer) { this._bg.color = this._highLightColor; } this._topText.string = top.toString(); this._scoreText.string = score.toString(); } }