games/packages/feature_common/lib/models/game_result_args.dart
2025-11-14 18:03:50 +09:00

45 lines
1.4 KiB
Dart

import 'package:flutter/material.dart';
/// 게임 완료 화면에 전달할 데이터 묶음
class GameResultArgs {
/// 랭킹 등록 시 사용할 게임 타입 (예: "SUDOKU", "SPIDER")
final String gameType;
/// 랭킹 등록 시 사용할 난이도 ID (예: "SUDOKU_9x9_L5")
final String contextId;
/// 랭킹 등록용 주 점수 (스도쿠: 시간, 스파이더: 이동 횟수)
final int primaryScore;
/// 랭킹 등록용 보조 점수 (스도쿠: (5-점수), 스파이더: 시간)
final int? secondaryScore;
/// 랭킹 등록에 필요한 유저 ID
final String userId;
/// 이름 입력 필드에 미리 채워줄 유저 이름
final String? userName;
/// 랭킹 목록에 점수를 표시할 포맷터 함수
/// 예: (120, 2) => "02:00 (Score: 3)"
final String Function(int primary, int? secondary) scoreFormatter;
/// 랭킹 등록 성공 시 호출될 게임별 후속 처리 콜백
/// (예: 다음 레벨 잠금 해제)
final Future<void> Function(String playerName) onProgressSave;
/// 팝업이 닫힐 때 게임 화면을 닫기 위한 콜백
final VoidCallback onScreenClose;
GameResultArgs({
required this.gameType,
required this.contextId,
required this.primaryScore,
this.secondaryScore,
required this.userId,
this.userName,
required this.scoreFormatter,
required this.onProgressSave,
required this.onScreenClose,
});
}