Skip to content

Commit

Permalink
feat: #106-뷰모델 수정
Browse files Browse the repository at this point in the history
- 진행자, 참가자로 이름이 저장되게
- 초기화 시 플레이어 속성 수정
  • Loading branch information
HyunJaeyeon committed Nov 30, 2024
1 parent 71303e5 commit 04b70fd
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,18 @@ import SwiftUI

/// 플레이어 초기화
func resetPlayer() {
tempPlayers = [Player(turn: 1), Player(turn: 2)]
tempPlayers = [Player(turn: 1, isHost: true), Player(turn: 2)]
}

/// 변경사항 저장
func saveChanges() {
for (index, player) in tempPlayers.enumerated() {
if player.nickname.isEmpty {
tempPlayers[index].nickname = "\(index + 1)"
if player.isHost {
tempPlayers[index].nickname = "진행자"
} else {
tempPlayers[index].nickname = "참가자\(player.turn)"
}
}
}
gameData.players = tempPlayers
Expand Down

0 comments on commit 04b70fd

Please sign in to comment.