This commit is contained in:
sli97
2022-12-14 20:25:40 +08:00
parent 2004a33531
commit 1ade200675
4 changed files with 62 additions and 63 deletions

View File

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