update
This commit is contained in:
parent
c7a859b9bb
commit
7bf55f9928
@ -1,19 +1,20 @@
|
|||||||
import { _decorator, Component, Node, Label } from "cc";
|
import { _decorator, Component, Node, Label } from "cc"
|
||||||
import { EventEnum } from "../Enum";
|
import { IRoom } from "../Common"
|
||||||
import EventManager from "../Global/EventManager";
|
import { EventEnum } from "../Enum"
|
||||||
const { ccclass, property } = _decorator;
|
import EventManager from "../Global/EventManager"
|
||||||
|
const { ccclass, property } = _decorator
|
||||||
|
|
||||||
@ccclass("RoomManager")
|
@ccclass("RoomManager")
|
||||||
export class RoomManager extends Component {
|
export class RoomManager extends Component {
|
||||||
id: number;
|
id: number
|
||||||
init({ id, players }: { id: number; players: Array<{ id: number; nickname: string }> }) {
|
init({ id, players }: IRoom) {
|
||||||
this.id = id;
|
this.id = id
|
||||||
const label = this.getComponent(Label);
|
const label = this.getComponent(Label)
|
||||||
label.string = `房间id:${id},当前人数:${players.length}`;
|
label.string = `房间id:${id},当前人数:${players.length}`
|
||||||
this.node.active = true;
|
this.node.active = true
|
||||||
}
|
}
|
||||||
|
|
||||||
handleClick() {
|
handleClick() {
|
||||||
EventManager.Instance.emit(EventEnum.RoomJoin, this.id);
|
EventManager.Instance.emit(EventEnum.RoomJoin, this.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user