...
This commit is contained in:
@@ -2,14 +2,20 @@
|
||||
|
||||
class GameRankDto {
|
||||
final String playerName;
|
||||
final int primaryScore; // 스도쿠에서는 시간(초)
|
||||
final int primaryScore; // 시간 (초)
|
||||
final int? secondaryScore; // 점수 (저장된 값, 예: 0~4)
|
||||
|
||||
GameRankDto({required this.playerName, required this.primaryScore});
|
||||
GameRankDto({
|
||||
required this.playerName,
|
||||
required this.primaryScore,
|
||||
this.secondaryScore
|
||||
});
|
||||
|
||||
factory GameRankDto.fromJson(Map<String, dynamic> json) {
|
||||
return GameRankDto(
|
||||
playerName: json['playerName'],
|
||||
primaryScore: (json['primaryScore'] as num).toInt(),
|
||||
secondaryScore: (json['secondaryScore'] as num?)?.toInt(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,23 @@
|
||||
// lib/models/sudoku_game_dto.dart
|
||||
|
||||
// 🔽 [수정] PuzzleData.kt의 새 DTO (puzzleId -> blockSize)
|
||||
class SudokuGameDto {
|
||||
final int puzzleId; // 👈 [추가] 서버에서 보낸 ID
|
||||
final String question;
|
||||
final String solution;
|
||||
final int blockSize; // 예: 3 (3x3 블록)
|
||||
|
||||
// 🔽 [추가] blockSize로부터 gridSize 계산 (예: 9)
|
||||
final int blockSize;
|
||||
final int gridSize;
|
||||
|
||||
SudokuGameDto({
|
||||
required this.puzzleId, // 👈 [추가]
|
||||
required this.question,
|
||||
required this.solution,
|
||||
required this.blockSize,
|
||||
}) : gridSize = blockSize * blockSize; // 생성 시 gridSize 자동 계산
|
||||
}) : gridSize = blockSize * blockSize;
|
||||
|
||||
factory SudokuGameDto.fromJson(Map<String, dynamic> json) {
|
||||
int bs = json['blockSize'] ?? 3;
|
||||
return SudokuGameDto(
|
||||
puzzleId: json['puzzleId'], // 👈 [추가] 서버의 puzzleId 매핑
|
||||
question: json['question'],
|
||||
solution: json['solution'],
|
||||
blockSize: bs,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// lib/models/unified_rank_dto.dart
|
||||
|
||||
class UnifiedRankDto {
|
||||
final String userId; // 👈 [추가] 앱-고유 ID
|
||||
final String gameType;
|
||||
final String? contextId;
|
||||
final String playerName;
|
||||
@@ -8,6 +9,7 @@ class UnifiedRankDto {
|
||||
final int? secondaryScore;
|
||||
|
||||
UnifiedRankDto({
|
||||
required this.userId, // 👈 [추가] 생성자에 추가
|
||||
required this.gameType,
|
||||
this.contextId,
|
||||
required this.playerName,
|
||||
@@ -18,6 +20,7 @@ class UnifiedRankDto {
|
||||
// Dart 객체를 JSON으로 변환 (서버 전송용)
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'userId': userId, // 👈 [추가]
|
||||
'gameType': gameType,
|
||||
'contextId': contextId,
|
||||
'playerName': playerName,
|
||||
|
||||
Reference in New Issue
Block a user