This commit is contained in:
2025-12-15 18:18:17 +09:00
parent 03a7ed2ef2
commit 4c2c98de8a
216 changed files with 9831 additions and 725 deletions
@@ -8,8 +8,17 @@ import '../models/math_quiz_difficulty.dart'; // 👈 MathQuizDifficulty 정의
class MathQuizController with ChangeNotifier {
late final MathQuizDifficulty difficulty;
late final String userId;
late final String? userName;
// 🔽 [수정] late final -> late (값 변경 또는 별도 초기화를 위해 final 제거)
late String userId;
late String? userName;
// ... (기존 멤버 변수들 유지) ...
// 🔽 [신규 추가] 유저 정보 설정 메서드
void setUserInfo(String userId, String? userName) {
this.userId = userId;
this.userName = userName;
}
late MathQuizPuzzle puzzle;
late List<String?> _userAnswers;
@@ -71,10 +80,10 @@ class MathQuizController with ChangeNotifier {
_timer?.cancel();
}
void startNewGame(MathQuizDifficulty level, String userId, String? userName) {
void startNewGame(MathQuizDifficulty level) {
this.difficulty = level;
this.userId = userId;
this.userName = userName;
// this.userId = userId;
// this.userName = userName;
_totalPuzzlesInLevel = level.puzzleCount;
_currentPuzzleIndex = 0;
_isGameCompleted = false;
@@ -1,2 +1,3 @@
// 이 패키지의 메인 진입점 (로비 화면)을 export합니다.
export 'screens/math_quiz_lobby_screen.dart';
export 'screens/math_quiz_lobby_screen.dart';
export 'screens/math_quiz_screen.dart';
@@ -91,7 +91,8 @@ class _MathQuizLobbyScreenState extends State<MathQuizLobbyScreen> {
// 1. 컨트롤러 생성 및 새 게임 시작 (제너레이터 호출)
final controller = MathQuizController();
controller.startNewGame(level, session.userId, session.userName);
controller.setUserInfo(session.userId, session.userName);
controller.startNewGame(level);
if (mounted) {
await Navigator.push(
@@ -6,8 +6,8 @@ import '../controllers/math_quiz_controller.dart';
import '../models/math_quiz_difficulty.dart';
import '../models/math_quiz_models.dart';
class MathQuizScreen extends StatefulWidget {
const MathQuizScreen({super.key});
class MathQuizScreen extends BaseGameScreen {
const MathQuizScreen({super.key,super.onNextGame});
@override
State<MathQuizScreen> createState() => _MathQuizScreenState();