Skip to content

Object Architecture

BOHYEON SEO edited this page Nov 21, 2019 · 3 revisions

ν”„λ‘ νŠΈμ—”λ“œ

component
β”œβ”€β”€ Login				//둜그인 νŽ˜μ΄μ§€
β”‚   β”œβ”€β”€ index.js
β”‚   └── Button.js
β”œβ”€β”€ Lobby				//λ‘œλΉ„ νŽ˜μ΄μ§€
β”‚   β”œβ”€β”€ index.js
β”‚   β”œβ”€β”€ Info
β”‚   β”‚   └── index.js
β”‚   β”œβ”€β”€ RoomList
β”‚   β”‚   β”œβ”€β”€ index.js
β”‚   β”‚   └── RoomInfo.js
β”‚   └── CreateRoomModal
β”‚       └──index.js
└── Room				//λ£Έ νŽ˜μ΄μ§€
    β”œβ”€β”€ index.js
    β”œβ”€β”€ GameArea
    β”‚   └── index.js
    └── ChatArea
        └── index.js
  • .jsλŠ” μ»΄ν¬λ„ŒνŠΈ, λ””λ ‰ν† λ¦¬λŠ” μ»΄ν¬λ„ŒνŠΈ 묢음

State

  • lobby
    • roomList
      • roomInfo
        • name
        • numOfPlayer
        • state
  • room
    • playerList
      • player
        • nickname
        • character
        • location
        • state
        • isMaster
    • state
    • quiz
      • question
      • time
    • winnerList
      • nickname
    • chatList
      • chat
        • nickname
        • message

Action type

  • ROOM_CREATE // λ‘œλΉ„μ—μ„œ 룸이 μƒμ„±λ˜μ—ˆμ„ λ•Œ
  • ROOM_MODIFIED // 인원 λ³€κ²½μ΄λ‚˜ ν™œμ„±ν™”/λΉ„ν™œμ„±ν™”
  • ROOM_ENTER // μžκΈ°κ°€ 듀어왔을 λ•Œ
  • PLAYER_ENTER // λ‹€λ₯Έ ν”Œλ ˆμ΄μ–΄ 듀어왔을 λ•Œ
  • PLAYER_EXIT // λ‹€λ₯Έ ν”Œλ ˆμ΄μ–΄ λ‚˜κ°”μ„ λ•Œ
  • PLAYER_MOVE // ν”Œλ ˆμ΄μ–΄ μ›€μ§μž„
  • GAME_START // κ²Œμž„μ΄ 처음 μ‹œμž‘λ˜μ—ˆμ„ λ•Œ
  • QUIZ // μƒˆλ‘œμš΄ λΌμš΄λ“œ (문제 좜제)
  • TIME_COUNT // μ‹œκ°„ 카운트
  • TIME_OUT // μ‹œκ°„μ΄ λλ‚˜μ„œ λ‹΅ 곡개, νƒˆλ½ μ• λ‹ˆλ©”μ΄μ…˜
  • GAME_OVER // 우승자 ν‘œμ‹œ
  • CHAT // μƒˆλ‘œμš΄ μ±„νŒ…
  • PLAYER_NUMBER // μ‚΄μ•„μžˆλŠ” ν”Œλ ˆμ΄μ–΄ 수, κ΄€μ „ ν”Œλ ˆμ΄μ–΄ 수 λ³€κ²½

λ°±μ—”λ“œ

└── server
    β”œβ”€β”€ app.js
    β”œβ”€β”€ bin
    β”‚   └── www
    β”œβ”€β”€ database
    β”‚   β”œβ”€β”€ connection.js
    β”‚   β”œβ”€β”€ user.js
    β”‚   β”œβ”€β”€ quiz.js
    β”‚   └── nickname.js
    β”œβ”€β”€ middlewares
    β”‚   β”œβ”€β”€ passport.js
    β”‚   └── isAdmin.js
    β”œβ”€β”€ event
    β”‚   └──index.js
    β”œβ”€β”€ controller
    β”‚   └── index.js
    β”œβ”€β”€ models
    β”‚   β”œβ”€β”€ user.js
    β”‚   β”œβ”€β”€ quiz.js
    β”‚   β”œβ”€β”€ nickname.js
    β”‚   β”œβ”€β”€ lobby.js
    β”‚   β”œβ”€β”€ room.js
    β”‚   β”œβ”€β”€ player.js
    β”‚   └── game.js
    β”œβ”€β”€ routes
    β”‚   β”œβ”€β”€ index.js
    β”‚   β”œβ”€β”€ login.js
    β”‚   └── lobby.js
    └── util
        └── index.js

controller

  • socket으둜 model μ‚¬μš©ν•΄μ„œ μ„œλΉ„μŠ€ 진행

models

  • user
    • μœ μ € 검색
    • κ΄€λ¦¬μžμΈμ§€ 확인
  • quiz
    • ν€΄μ¦ˆ 10개 κ°€μ Έμ˜€κΈ°
  • nickname
    • λ‹‰λ„€μž„ μ‘°ν•©ν•΄μ„œ 20개 κ°€μ Έμ˜€κΈ°
  • lobby
    • playerList
      • player
    • roomList
      • room
    • ν•˜λŠ” 일: ν”Œλ ˆμ΄μ–΄ 관리, 룸의 정보λ₯Ό μ΄μš©ν•΄μ„œ μ»¨νŠΈλ‘€λŸ¬μ—κ²Œ 정보λ₯Ό 제곡
  • room
    • name
    • id
    • gameState
    • roomState
    • masterPlayer
    • playerList
      • player
    • chatLog
      • nickname
      • message
    • ν•˜λŠ” 일: ν”Œλ ˆμ΄μ–΄μ˜ 정보λ₯Ό μ΄μš©ν•΄μ„œ μ»¨νŠΈλ‘€λŸ¬μ—κ²Œ μžμ‹ μ˜ 정보λ₯Ό 제곡, ν”Œλ ˆμ΄μ–΄ 관리, λ‘œλΉ„μ—κ²Œ λ£Έ 정보λ₯Ό 제곡
  • player
    • socketId
    • nickname
    • character
    • isAlive
    • locationInField
    • ν•˜λŠ” 일: λ‘œλΉ„, λ£Έμ—κ²Œ μžμ‹ μ˜ 정보λ₯Ό 제곡
  • game
    • quizList
    • round
    • ν•˜λŠ” 일: ν€΄μ¦ˆλ₯Ό 뢈러였고, 정닡을 μ•Œκ³  μžˆλ‹€. μ»¨νŠΈλ‘€λŸ¬μ—κ²Œ ν€΄μ¦ˆμ™€ 정닡을 제곡
Clone this wiki locally