Showing
3 changed files
with
36 additions
and
1 deletions
server/game/Game.ts
0 → 100644
server/game/WordGuessingGame.ts
0 → 100644
| 1 | +import { roomChatHandler } from "../message/handler/roomChatHandler"; | ||
| 2 | +import { Room } from "../room/Room"; | ||
| 3 | +import { User } from "../user/User"; | ||
| 4 | +import { Game } from "./Game"; | ||
| 5 | + | ||
| 6 | +export class WorldGuessingGame implements Game { | ||
| 7 | + room: Room; | ||
| 8 | + maxRound: number; | ||
| 9 | + round: number; | ||
| 10 | + | ||
| 11 | + constructor(room: Room) { | ||
| 12 | + this.room = room; | ||
| 13 | + if (this.room.users.length < 2) { | ||
| 14 | + throw new Error("인원이 부족합니다."); | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + // TODO: 방장이 설정 | ||
| 18 | + this.maxRound = 5; | ||
| 19 | + this.round = 1; | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + join(user: User): void { | ||
| 23 | + throw new Error("Method not implemented."); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + leave(user: User): void { | ||
| 27 | + throw new Error("Method not implemented."); | ||
| 28 | + } | ||
| 29 | +} |
| ... | @@ -15,7 +15,7 @@ export class Room { | ... | @@ -15,7 +15,7 @@ export class Room { |
| 15 | public name: string; | 15 | public name: string; |
| 16 | public readonly maxUsers: number; | 16 | public readonly maxUsers: number; |
| 17 | 17 | ||
| 18 | - private users: User[] = []; | 18 | + public users: User[] = []; |
| 19 | 19 | ||
| 20 | private closed: boolean = false; | 20 | private closed: boolean = false; |
| 21 | 21 | ... | ... |
-
Please register or login to post a comment