diff --git a/src/api/room/ApiJoin.ts b/src/api/room/ApiJoin.ts index 95e6750..e14dd5c 100644 --- a/src/api/room/ApiJoin.ts +++ b/src/api/room/ApiJoin.ts @@ -1,6 +1,5 @@ import { ApiCall, BaseConnection } from "tsrpc"; import Room from "../../component/Room/Room"; -import { EGameType } from "../../shared/protocols/define/enum"; import { ReqJoin, ResJoin } from "../../shared/protocols/room/PtlJoin"; import { ServiceType } from "../../shared/protocols/serviceProto"; @@ -13,7 +12,7 @@ export default async function (call: ApiCall) { call.error("房間已滿"); return; } - const type: EGameType = room.Join(conn); + const type: number = room.Join(conn); conn.Room = room; call.succ([room.ConnCount(), type]); diff --git a/src/component/Room/Room.ts b/src/component/Room/Room.ts index 410993b..dae4b7b 100644 --- a/src/component/Room/Room.ts +++ b/src/component/Room/Room.ts @@ -1,7 +1,7 @@ import { BaseConnection, WsConnection } from "tsrpc"; import { server } from "../.."; import { RandomEx } from "../../Engine/Utils/Number/RandomEx"; -import { EGameState, EGameType } from "../../shared/protocols/define/enum"; +import { EGameState } from "../../shared/protocols/define/enum"; import { MsgChangeState } from "../../shared/protocols/room/MsgChangeState"; import { MsgGoToGame } from "../../shared/protocols/room/MsgGoToGame"; import { ServiceType } from "../../shared/protocols/serviceProto"; @@ -33,7 +33,7 @@ export default class Room { private connData: Map, RoomConnData> = new Map(); - private type: EGameType; + private type: number; //#endregion @@ -42,7 +42,7 @@ export default class Room { /** * */ - constructor(type: EGameType) { + constructor(type: number) { // 给每个新房间生成一个唯一的 ID this.RoomId = ++Room.maxRoomId; Room.rooms[this.RoomId] = this; @@ -216,7 +216,7 @@ export default class Room { } /** Join */ - public Join(conn: BaseConnection): EGameType { + public Join(conn: BaseConnection): number { this.conns.push(conn); const data: RoomConnData = { state: undefined,