2022-12-01 22:26:41 +08:00

23 lines
656 B
TypeScript

import { _decorator, Component, Node, Label } from 'cc';
import { EventEnum } from '../Enum';
import DataManager from '../Global/DataManager';
import EventManager from '../Global/EventManager';
const { ccclass, property } = _decorator;
@ccclass('PlayerItemManager')
export class PlayerItemManager extends Component {
init({ id, nickname, rid }: { id: number, nickname: string, rid: number }) {
const label = this.getComponent(Label)
let str = nickname
if (DataManager.Instance.myPlayerId === id) {
str += `(我)`
}
if (rid !== -1) {
str += `(房间${rid})`
}
label.string = str
this.node.active = true
}
}