반응형
enum GameStatus{
initial,
loading,
inProgress,
win,
loss,
error,
}
class GameState{
final GameStatus status;
final String? errorMessage;
final List<String>? attempts;
final String? currentAttempt;
final String? word;
final int? attemptsCount;
GameState._(
{required this.status,
this.errorMessage,
this.attempts,
this.currentAttempt,
this.word,
this.attemptsCount});
factory GameState.initial() => GameState._(status: GameStatus.initial);
GameState copyWith(
{GameStatus? status,
String? errorMessage,
List<String>? attempts,
String? currentAttempt,
String? word,
int? attemptsCount}) =>
GameState._(
status: status ?? this.status,
errorMessage: errorMessage ??this.errorMessage,
attempts: attempts ?? this.attempts,
currentAttempt: currentAttempt ?? this.currentAttempt,
attemptsCount: attemptsCount ?? this.attemptsCount,
word: word ?? this.word);반응형
'새내기 게임 개발자[Unity]' 카테고리의 다른 글
| Flutter Word Game features/game/presentation/widget/letter_box_widget.dart (0) | 2025.10.19 |
|---|---|
| Flutter Word Game features/game/presentation/widget/attempt_row_widget.dart (0) | 2025.10.19 |
| Flutter Word Game features/game/presentation/bloc/game_event.dart (0) | 2025.10.19 |
| Flutter Word Game features/game/presentation/bloc/game_bloc.dart (0) | 2025.10.19 |
| Flutter Word Game main code (0) | 2025.10.19 |