[mod] fix移除變數

This commit is contained in:
建喵 2024-01-13 11:36:48 +08:00
parent 36a676acb4
commit 0d3840c9bf
2 changed files with 5 additions and 6 deletions

View File

@ -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<ReqJoin, ResJoin>) {
call.error("房間已滿");
return;
}
const type: EGameType = room.Join(conn);
const type: number = room.Join(conn);
conn.Room = room;
call.succ([room.ConnCount(), type]);

View File

@ -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<BaseConnection<any>, RoomConnData> = new Map<BaseConnection, RoomConnData>();
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,