|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
// ignore_for_file: must_call_super
|
|
|
|
|
|
|
|
|
|
import 'dart:async';
|
|
|
|
|
|
|
|
|
|
import 'package:flame_bloc/flame_bloc.dart';
|
|
|
|
|
import 'package:flame_forge2d/flame_forge2d.dart';
|
|
|
|
|
import 'package:pinball/game/game.dart';
|
|
|
|
@ -14,26 +16,53 @@ class TestGame extends Forge2DGame with FlameBloc {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class PinballTestGame extends PinballGame {
|
|
|
|
|
PinballTestGame()
|
|
|
|
|
: super(
|
|
|
|
|
PinballTestGame([List<String>? assets])
|
|
|
|
|
: _assets = assets,
|
|
|
|
|
super(
|
|
|
|
|
audio: MockPinballAudio(),
|
|
|
|
|
theme: const PinballTheme(
|
|
|
|
|
characterTheme: DashTheme(),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
final List<String>? _assets;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<void> onLoad() async {
|
|
|
|
|
if (_assets != null) {
|
|
|
|
|
await Future.wait(_assets!.map(images.load));
|
|
|
|
|
}
|
|
|
|
|
await super.onLoad();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class DebugPinballTestGame extends DebugPinballGame {
|
|
|
|
|
DebugPinballTestGame()
|
|
|
|
|
: super(
|
|
|
|
|
DebugPinballTestGame([List<String>? assets])
|
|
|
|
|
: _assets = assets,
|
|
|
|
|
super(
|
|
|
|
|
audio: MockPinballAudio(),
|
|
|
|
|
theme: const PinballTheme(
|
|
|
|
|
characterTheme: DashTheme(),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
final List<String>? _assets;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<void> onLoad() async {
|
|
|
|
|
if (_assets != null) {
|
|
|
|
|
await Future.wait(_assets!.map(images.load));
|
|
|
|
|
}
|
|
|
|
|
await super.onLoad();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class EmptyPinballTestGame extends PinballTestGame {
|
|
|
|
|
EmptyPinballTestGame([List<String>? assets]) : super(assets);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<void> onLoad() async {}
|
|
|
|
|
Future<void> onLoad() async {
|
|
|
|
|
if (_assets != null) {
|
|
|
|
|
await Future.wait(_assets!.map(images.load));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|