From 7bf55f9928f96bce780e7677bf2f4e3e2c2d3dd0 Mon Sep 17 00:00:00 2001 From: sli97 <775303361@qq.com> Date: Fri, 6 Jan 2023 20:30:08 +0800 Subject: [PATCH] update --- apps/client/assets/Scripts/UI/RoomManager.ts | 23 ++++++++++---------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/apps/client/assets/Scripts/UI/RoomManager.ts b/apps/client/assets/Scripts/UI/RoomManager.ts index c9c2ebf..6596b8a 100644 --- a/apps/client/assets/Scripts/UI/RoomManager.ts +++ b/apps/client/assets/Scripts/UI/RoomManager.ts @@ -1,19 +1,20 @@ -import { _decorator, Component, Node, Label } from "cc"; -import { EventEnum } from "../Enum"; -import EventManager from "../Global/EventManager"; -const { ccclass, property } = _decorator; +import { _decorator, Component, Node, Label } from "cc" +import { IRoom } from "../Common" +import { EventEnum } from "../Enum" +import EventManager from "../Global/EventManager" +const { ccclass, property } = _decorator @ccclass("RoomManager") export class RoomManager extends Component { - id: number; - init({ id, players }: { id: number; players: Array<{ id: number; nickname: string }> }) { - this.id = id; - const label = this.getComponent(Label); - label.string = `房间id:${id},当前人数:${players.length}`; - this.node.active = true; + id: number + init({ id, players }: IRoom) { + this.id = id + const label = this.getComponent(Label) + label.string = `房间id:${id},当前人数:${players.length}` + this.node.active = true } handleClick() { - EventManager.Instance.emit(EventEnum.RoomJoin, this.id); + EventManager.Instance.emit(EventEnum.RoomJoin, this.id) } }