refactor: renamed active/inactive to lit/dimmed

pull/286/head
alestiago 3 years ago
parent 0dcfacea85
commit fa86d88c6e

@ -18,6 +18,7 @@ class $AssetsImagesGen {
/// File path: assets/images/board-background.png /// File path: assets/images/board-background.png
AssetGenImage get boardBackground => AssetGenImage get boardBackground =>
const AssetGenImage('assets/images/board-background.png'); const AssetGenImage('assets/images/board-background.png');
$AssetsImagesBoundaryGen get boundary => const $AssetsImagesBoundaryGen(); $AssetsImagesBoundaryGen get boundary => const $AssetsImagesBoundaryGen();
$AssetsImagesDashGen get dash => const $AssetsImagesDashGen(); $AssetsImagesDashGen get dash => const $AssetsImagesDashGen();
$AssetsImagesDinoGen get dino => const $AssetsImagesDinoGen(); $AssetsImagesDinoGen get dino => const $AssetsImagesDinoGen();
@ -316,88 +317,88 @@ class $AssetsImagesDashBumperGen {
const $AssetsImagesDashBumperMainGen(); const $AssetsImagesDashBumperMainGen();
} }
class $AssetsImagesDinoAnimatronicGen {
const $AssetsImagesDinoAnimatronicGen();
/// File path: assets/images/dino/animatronic/head.png
AssetGenImage get head =>
const AssetGenImage('assets/images/dino/animatronic/head.png');
/// File path: assets/images/dino/animatronic/mouth.png
AssetGenImage get mouth =>
const AssetGenImage('assets/images/dino/animatronic/mouth.png');
}
class $AssetsImagesGoogleWordLetter1Gen { class $AssetsImagesGoogleWordLetter1Gen {
const $AssetsImagesGoogleWordLetter1Gen(); const $AssetsImagesGoogleWordLetter1Gen();
/// File path: assets/images/google_word/letter1/active.png /// File path: assets/images/google_word/letter1/dimmed.png
AssetGenImage get active => AssetGenImage get dimmed =>
const AssetGenImage('assets/images/google_word/letter1/active.png'); const AssetGenImage('assets/images/google_word/letter1/dimmed.png');
/// File path: assets/images/google_word/letter1/inactive.png /// File path: assets/images/google_word/letter1/lit.png
AssetGenImage get inactive => AssetGenImage get lit =>
const AssetGenImage('assets/images/google_word/letter1/inactive.png'); const AssetGenImage('assets/images/google_word/letter1/lit.png');
} }
class $AssetsImagesGoogleWordLetter2Gen { class $AssetsImagesGoogleWordLetter2Gen {
const $AssetsImagesGoogleWordLetter2Gen(); const $AssetsImagesGoogleWordLetter2Gen();
/// File path: assets/images/google_word/letter2/active.png /// File path: assets/images/google_word/letter2/dimmed.png
AssetGenImage get active => AssetGenImage get dimmed =>
const AssetGenImage('assets/images/google_word/letter2/active.png'); const AssetGenImage('assets/images/google_word/letter2/dimmed.png');
/// File path: assets/images/google_word/letter2/inactive.png /// File path: assets/images/google_word/letter2/lit.png
AssetGenImage get inactive => AssetGenImage get lit =>
const AssetGenImage('assets/images/google_word/letter2/inactive.png'); const AssetGenImage('assets/images/google_word/letter2/lit.png');
} }
class $AssetsImagesGoogleWordLetter3Gen { class $AssetsImagesGoogleWordLetter3Gen {
const $AssetsImagesGoogleWordLetter3Gen(); const $AssetsImagesGoogleWordLetter3Gen();
/// File path: assets/images/google_word/letter3/active.png /// File path: assets/images/google_word/letter3/dimmed.png
AssetGenImage get active => AssetGenImage get dimmed =>
const AssetGenImage('assets/images/google_word/letter3/active.png'); const AssetGenImage('assets/images/google_word/letter3/dimmed.png');
/// File path: assets/images/google_word/letter3/inactive.png /// File path: assets/images/google_word/letter3/lit.png
AssetGenImage get inactive => AssetGenImage get lit =>
const AssetGenImage('assets/images/google_word/letter3/inactive.png'); const AssetGenImage('assets/images/google_word/letter3/lit.png');
} }
class $AssetsImagesGoogleWordLetter4Gen { class $AssetsImagesGoogleWordLetter4Gen {
const $AssetsImagesGoogleWordLetter4Gen(); const $AssetsImagesGoogleWordLetter4Gen();
/// File path: assets/images/google_word/letter4/active.png /// File path: assets/images/google_word/letter4/dimmed.png
AssetGenImage get active => AssetGenImage get dimmed =>
const AssetGenImage('assets/images/google_word/letter4/active.png'); const AssetGenImage('assets/images/google_word/letter4/dimmed.png');
/// File path: assets/images/google_word/letter4/inactive.png /// File path: assets/images/google_word/letter4/lit.png
AssetGenImage get inactive => AssetGenImage get lit =>
const AssetGenImage('assets/images/google_word/letter4/inactive.png'); const AssetGenImage('assets/images/google_word/letter4/lit.png');
} }
class $AssetsImagesGoogleWordLetter5Gen { class $AssetsImagesGoogleWordLetter5Gen {
const $AssetsImagesGoogleWordLetter5Gen(); const $AssetsImagesGoogleWordLetter5Gen();
/// File path: assets/images/google_word/letter5/active.png /// File path: assets/images/google_word/letter5/dimmed.png
AssetGenImage get active => AssetGenImage get dimmed =>
const AssetGenImage('assets/images/google_word/letter5/active.png'); const AssetGenImage('assets/images/google_word/letter5/dimmed.png');
/// File path: assets/images/google_word/letter5/inactive.png /// File path: assets/images/google_word/letter5/lit.png
AssetGenImage get inactive => AssetGenImage get lit =>
const AssetGenImage('assets/images/google_word/letter5/inactive.png'); const AssetGenImage('assets/images/google_word/letter5/lit.png');
} }
class $AssetsImagesGoogleWordLetter6Gen { class $AssetsImagesGoogleWordLetter6Gen {
const $AssetsImagesGoogleWordLetter6Gen(); const $AssetsImagesGoogleWordLetter6Gen();
/// File path: assets/images/google_word/letter6/active.png /// File path: assets/images/google_word/letter6/dimmed.png
AssetGenImage get active => AssetGenImage get dimmed =>
const AssetGenImage('assets/images/google_word/letter6/active.png'); const AssetGenImage('assets/images/google_word/letter6/dimmed.png');
/// File path: assets/images/google_word/letter6/inactive.png
AssetGenImage get inactive =>
const AssetGenImage('assets/images/google_word/letter6/inactive.png');
}
class $AssetsImagesDinoAnimatronicGen {
const $AssetsImagesDinoAnimatronicGen();
/// File path: assets/images/dino/animatronic/head.png
AssetGenImage get head =>
const AssetGenImage('assets/images/dino/animatronic/head.png');
/// File path: assets/images/dino/animatronic/mouth.png /// File path: assets/images/google_word/letter6/lit.png
AssetGenImage get mouth => AssetGenImage get lit =>
const AssetGenImage('assets/images/dino/animatronic/mouth.png'); const AssetGenImage('assets/images/google_word/letter6/lit.png');
} }
class $AssetsImagesKickerLeftGen { class $AssetsImagesKickerLeftGen {

@ -7,6 +7,33 @@ import 'package:pinball_flame/pinball_flame.dart';
export 'cubit/google_letter_cubit.dart'; export 'cubit/google_letter_cubit.dart';
final _spritePaths = <Map<GoogleLetterState, String>>[
{
GoogleLetterState.lit: Assets.images.googleWord.letter1.lit.keyName,
GoogleLetterState.dimmed: Assets.images.googleWord.letter1.dimmed.keyName,
},
{
GoogleLetterState.lit: Assets.images.googleWord.letter2.lit.keyName,
GoogleLetterState.dimmed: Assets.images.googleWord.letter2.dimmed.keyName,
},
{
GoogleLetterState.lit: Assets.images.googleWord.letter3.lit.keyName,
GoogleLetterState.dimmed: Assets.images.googleWord.letter3.dimmed.keyName,
},
{
GoogleLetterState.lit: Assets.images.googleWord.letter4.lit.keyName,
GoogleLetterState.dimmed: Assets.images.googleWord.letter4.dimmed.keyName,
},
{
GoogleLetterState.lit: Assets.images.googleWord.letter5.lit.keyName,
GoogleLetterState.dimmed: Assets.images.googleWord.letter5.dimmed.keyName,
},
{
GoogleLetterState.lit: Assets.images.googleWord.letter6.lit.keyName,
GoogleLetterState.dimmed: Assets.images.googleWord.letter6.dimmed.keyName,
},
];
/// {@template google_letter} /// {@template google_letter}
/// Circular sensor that represents a letter in "GOOGLE" for a given index. /// Circular sensor that represents a letter in "GOOGLE" for a given index.
/// {@endtemplate} /// {@endtemplate}
@ -28,10 +55,8 @@ class GoogleLetter extends BodyComponent with InitialPosition {
}) : super( }) : super(
children: [ children: [
_GoogleLetterSpriteGroupComponent( _GoogleLetterSpriteGroupComponent(
activeAssetPath: _GoogleLetterSpriteGroupComponent litAssetPath: _spritePaths[index][GoogleLetterState.lit]!,
.spritePaths[index][GoogleLetterState.lit]!, dimmedAssetPath: _spritePaths[index][GoogleLetterState.dimmed]!,
inactiveAssetPath: _GoogleLetterSpriteGroupComponent
.spritePaths[index][GoogleLetterState.dimmed]!,
current: bloc.state, current: bloc.state,
), ),
GoogleLetterBallContactBehavior(), GoogleLetterBallContactBehavior(),
@ -81,51 +106,18 @@ class _GoogleLetterSpriteGroupComponent
extends SpriteGroupComponent<GoogleLetterState> extends SpriteGroupComponent<GoogleLetterState>
with HasGameRef, ParentIsA<GoogleLetter> { with HasGameRef, ParentIsA<GoogleLetter> {
_GoogleLetterSpriteGroupComponent({ _GoogleLetterSpriteGroupComponent({
required String activeAssetPath, required String litAssetPath,
required String inactiveAssetPath, required String dimmedAssetPath,
required GoogleLetterState current, required GoogleLetterState current,
}) : _activeAssetPath = activeAssetPath, }) : _litAssetPath = litAssetPath,
_inactiveAssetPath = inactiveAssetPath, _dimmedAssetPath = dimmedAssetPath,
super( super(
anchor: Anchor.center, anchor: Anchor.center,
current: current, current: current,
); );
final String _activeAssetPath; final String _litAssetPath;
final String _inactiveAssetPath; final String _dimmedAssetPath;
static final spritePaths = <Map<GoogleLetterState, String>>[
{
GoogleLetterState.lit: Assets.images.googleWord.letter1.active.keyName,
GoogleLetterState.dimmed:
Assets.images.googleWord.letter1.inactive.keyName,
},
{
GoogleLetterState.lit: Assets.images.googleWord.letter2.active.keyName,
GoogleLetterState.dimmed:
Assets.images.googleWord.letter2.inactive.keyName,
},
{
GoogleLetterState.lit: Assets.images.googleWord.letter3.active.keyName,
GoogleLetterState.dimmed:
Assets.images.googleWord.letter3.inactive.keyName,
},
{
GoogleLetterState.lit: Assets.images.googleWord.letter4.active.keyName,
GoogleLetterState.dimmed:
Assets.images.googleWord.letter4.inactive.keyName,
},
{
GoogleLetterState.lit: Assets.images.googleWord.letter5.active.keyName,
GoogleLetterState.dimmed:
Assets.images.googleWord.letter5.inactive.keyName,
},
{
GoogleLetterState.lit: Assets.images.googleWord.letter6.active.keyName,
GoogleLetterState.dimmed:
Assets.images.googleWord.letter6.inactive.keyName,
},
];
@override @override
Future<void> onLoad() async { Future<void> onLoad() async {
@ -134,10 +126,10 @@ class _GoogleLetterSpriteGroupComponent
final sprites = { final sprites = {
GoogleLetterState.lit: Sprite( GoogleLetterState.lit: Sprite(
gameRef.images.fromCache(_activeAssetPath), gameRef.images.fromCache(_litAssetPath),
), ),
GoogleLetterState.dimmed: Sprite( GoogleLetterState.dimmed: Sprite(
gameRef.images.fromCache(_inactiveAssetPath), gameRef.images.fromCache(_dimmedAssetPath),
), ),
}; };
this.sprites = sprites; this.sprites = sprites;

Loading…
Cancel
Save