refactor: defined in line

pull/346/head
alestiago 3 years ago
parent 85da19bb00
commit 636d275ca9

@ -25,7 +25,7 @@ class FocusData {
/// Changes the game focus when the [GameBloc] status changes. /// Changes the game focus when the [GameBloc] status changes.
class CameraFocusingBehavior extends Component class CameraFocusingBehavior extends Component
with ParentIsA<FlameGame>, BlocComponent<GameBloc, GameState> { with ParentIsA<FlameGame>, BlocComponent<GameBloc, GameState> {
final Map<String, FocusData> _foci = {}; late final Map<String, FocusData> _foci;
@override @override
bool listenWhen(GameState? previousState, GameState newState) { bool listenWhen(GameState? previousState, GameState newState) {
@ -49,18 +49,20 @@ class CameraFocusingBehavior extends Component
@override @override
Future<void> onLoad() async { Future<void> onLoad() async {
await super.onLoad(); await super.onLoad();
_foci['game'] = FocusData( _foci = {
zoom: parent.size.y / 16, 'game': FocusData(
position: Vector2(0, -7.8), zoom: parent.size.y / 16,
); position: Vector2(0, -7.8),
_foci['waiting'] = FocusData( ),
zoom: parent.size.y / 18, 'waiting': FocusData(
position: Vector2(0, -112), zoom: parent.size.y / 18,
); position: Vector2(0, -112),
_foci['backbox'] = FocusData( ),
zoom: parent.size.y / 10, 'gameOver': FocusData(
position: Vector2(0, -111), zoom: parent.size.y / 10,
); position: Vector2(0, -111),
),
};
_snap(_foci['waiting']!); _snap(_foci['waiting']!);
} }

Loading…
Cancel
Save