|
|
@ -1,6 +1,7 @@
|
|
|
|
import 'dart:async';
|
|
|
|
import 'dart:async';
|
|
|
|
import 'dart:math';
|
|
|
|
import 'dart:math';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:flame/assets.dart';
|
|
|
|
import 'package:flame/components.dart';
|
|
|
|
import 'package:flame/components.dart';
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'package:pinball_components/pinball_components.dart';
|
|
|
|
import 'package:pinball_components/pinball_components.dart';
|
|
|
@ -18,11 +19,14 @@ class BackboardGameOver extends PositionComponent with HasGameRef {
|
|
|
|
/// {@macro backboard_game_over}
|
|
|
|
/// {@macro backboard_game_over}
|
|
|
|
BackboardGameOver({
|
|
|
|
BackboardGameOver({
|
|
|
|
required int score,
|
|
|
|
required int score,
|
|
|
|
|
|
|
|
required String characterIconPath,
|
|
|
|
BackboardOnSubmit? onSubmit,
|
|
|
|
BackboardOnSubmit? onSubmit,
|
|
|
|
}) : _score = score,
|
|
|
|
}) : _score = score,
|
|
|
|
|
|
|
|
_characterIconPath = characterIconPath,
|
|
|
|
_onSubmit = onSubmit;
|
|
|
|
_onSubmit = onSubmit;
|
|
|
|
|
|
|
|
|
|
|
|
final int _score;
|
|
|
|
final int _score;
|
|
|
|
|
|
|
|
final String _characterIconPath;
|
|
|
|
final BackboardOnSubmit? _onSubmit;
|
|
|
|
final BackboardOnSubmit? _onSubmit;
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
@ -30,7 +34,6 @@ class BackboardGameOver extends PositionComponent with HasGameRef {
|
|
|
|
final backgroundSprite = await gameRef.loadSprite(
|
|
|
|
final backgroundSprite = await gameRef.loadSprite(
|
|
|
|
Assets.images.backboard.backboardGameOver.keyName,
|
|
|
|
Assets.images.backboard.backboardGameOver.keyName,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
unawaited(
|
|
|
|
unawaited(
|
|
|
|
add(
|
|
|
|
add(
|
|
|
|
SpriteComponent(
|
|
|
|
SpriteComponent(
|
|
|
@ -44,7 +47,6 @@ class BackboardGameOver extends PositionComponent with HasGameRef {
|
|
|
|
final displaySprite = await gameRef.loadSprite(
|
|
|
|
final displaySprite = await gameRef.loadSprite(
|
|
|
|
Assets.images.backboard.display.keyName,
|
|
|
|
Assets.images.backboard.display.keyName,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
unawaited(
|
|
|
|
unawaited(
|
|
|
|
add(
|
|
|
|
add(
|
|
|
|
SpriteComponent(
|
|
|
|
SpriteComponent(
|
|
|
@ -60,20 +62,35 @@ class BackboardGameOver extends PositionComponent with HasGameRef {
|
|
|
|
add(
|
|
|
|
add(
|
|
|
|
TextComponent(
|
|
|
|
TextComponent(
|
|
|
|
text: _score.formatScore(),
|
|
|
|
text: _score.formatScore(),
|
|
|
|
position: Vector2(-22, -46.5),
|
|
|
|
position: Vector2(-34, -45),
|
|
|
|
anchor: Anchor.center,
|
|
|
|
anchor: Anchor.centerLeft,
|
|
|
|
textRenderer: Backboard.textPaint,
|
|
|
|
textRenderer: Backboard.textPaint,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final characterIconSprite = await Sprite.load(
|
|
|
|
|
|
|
|
_characterIconPath,
|
|
|
|
|
|
|
|
images: Images(prefix: ''),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
unawaited(
|
|
|
|
|
|
|
|
add(
|
|
|
|
|
|
|
|
SpriteComponent(
|
|
|
|
|
|
|
|
sprite: characterIconSprite,
|
|
|
|
|
|
|
|
size: characterIconSprite.originalSize / 10,
|
|
|
|
|
|
|
|
anchor: Anchor.center,
|
|
|
|
|
|
|
|
position: Vector2(18.4, -45),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < 3; i++) {
|
|
|
|
for (var i = 0; i < 3; i++) {
|
|
|
|
unawaited(
|
|
|
|
unawaited(
|
|
|
|
add(
|
|
|
|
add(
|
|
|
|
BackboardLetterPrompt(
|
|
|
|
BackboardLetterPrompt(
|
|
|
|
position: Vector2(
|
|
|
|
position: Vector2(
|
|
|
|
20 + (6 * i).toDouble(),
|
|
|
|
24.3 + (4.5 * i),
|
|
|
|
-46.5,
|
|
|
|
-45,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
hasFocus: i == 0,
|
|
|
|
hasFocus: i == 0,
|
|
|
|
),
|
|
|
|
),
|
|
|
|