Skip to content

Feature 使用者進入現有房間 - 3 #166

Closed
@JohnsonMao

Description

@JohnsonMao

image

Stories

  1. 使用者進入現有房間 (無密碼)
  2. 使用者進入現有房間 (有密碼)
  3. 房間人數已滿
  4. 一人只能進入一間房

DoD

WS 的部分可以先標註 TODO

使用者進入現有房間 (無密碼)

  1. 遊戲房間需顯示「進入房間」按鈕( POST /rooms/{roomId}/players )
  • POST -> WS - postMsg('room.enter' )
  1. 使用者點擊按鈕後,跳轉進房間畫面( GET /rooms/{roomId} )
  2. 大廳的該房間人數+1 -> WS - on('room.enter') 

使用者進入現有房間 (有密碼)

  1. 遊戲房間需顯示「進入房間」按鈕
  2. 使用者點擊按鈕後,跳出「輸入密碼」的彈窗
  3. 密碼完成後跳轉進房間畫面

房間人數已滿

使用者進入現有房間 (有密碼)

一人只能進入一間房間

點擊「加入房間」按鈕時,用 Popup 顯示 API 回傳的錯誤訊息,確認後結束動作。

Related APIs

POST /rooms/{roomId}/players
{
     "password": null | { 4 digits }
}

Response 200
{
   "message": "success"
}

Response 400
{
    "message": "wrong password"
}

Response 400
{
    "message": "room is full"
}

Response 400
{
    "message": "you can only join 1 room"
}
GET /rooms/{roomId}

Response 200
{
 "id": string,
 "name":  string,
    "status": { WAITING | PLAYING }
    "game":  Game { },
    "host" : User {
          "id" : string,
          "nickname": string,
           "isReady" : bool
     },
    "isLocked": bool,
    "players": [{       // 存 Array
     "id" : string,
       "nickname": string
          "isReady" : bool
     }],
    "currentPlayers": int,
    "minPlayers": int,
    "maxPlayers": int
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions