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

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

Loading…
Cancel
Save