@ -0,0 +1,18 @@
|
|||||||
|
name: share_repository
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- "packages/share_repository/**"
|
||||||
|
- ".github/workflows/share_repository.yaml"
|
||||||
|
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- "packages/share_repository/**"
|
||||||
|
- ".github/workflows/share_repository.yaml"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1
|
||||||
|
with:
|
||||||
|
working_directory: packages/share_repository
|
Before Width: | Height: | Size: 306 KiB After Width: | Height: | Size: 306 KiB |
Before Width: | Height: | Size: 171 KiB After Width: | Height: | Size: 171 KiB |
Before Width: | Height: | Size: 222 KiB After Width: | Height: | Size: 222 KiB |
After Width: | Height: | Size: 11 KiB |
@ -1,52 +0,0 @@
|
|||||||
// ignore_for_file: avoid_renaming_method_parameters
|
|
||||||
|
|
||||||
import 'package:flame/components.dart';
|
|
||||||
import 'package:flame_forge2d/flame_forge2d.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:pinball/game/game.dart';
|
|
||||||
import 'package:pinball_components/pinball_components.dart';
|
|
||||||
import 'package:pinball_flame/pinball_flame.dart';
|
|
||||||
|
|
||||||
/// {@template controlled_sparky_computer}
|
|
||||||
/// [SparkyComputer] with a [SparkyComputerController] attached.
|
|
||||||
/// {@endtemplate}
|
|
||||||
class ControlledSparkyComputer extends SparkyComputer
|
|
||||||
with Controls<SparkyComputerController>, HasGameRef<Forge2DGame> {
|
|
||||||
/// {@macro controlled_sparky_computer}
|
|
||||||
ControlledSparkyComputer() : super() {
|
|
||||||
controller = SparkyComputerController(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> onLoad() async {
|
|
||||||
await super.onLoad();
|
|
||||||
gameRef.addContactCallback(SparkyComputerSensorBallContactCallback());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// {@template sparky_computer_controller}
|
|
||||||
/// Controller attached to a [SparkyComputer] that handles its game related
|
|
||||||
/// logic.
|
|
||||||
/// {@endtemplate}
|
|
||||||
// TODO(allisonryan0002): listen for turbo charge game bonus and animate Sparky.
|
|
||||||
class SparkyComputerController
|
|
||||||
extends ComponentController<ControlledSparkyComputer> {
|
|
||||||
/// {@macro sparky_computer_controller}
|
|
||||||
SparkyComputerController(ControlledSparkyComputer controlledComputer)
|
|
||||||
: super(controlledComputer);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// {@template sparky_computer_sensor_ball_contact_callback}
|
|
||||||
/// Turbo charges the [Ball] when it enters the [SparkyComputer]
|
|
||||||
/// {@endtemplate}
|
|
||||||
@visibleForTesting
|
|
||||||
class SparkyComputerSensorBallContactCallback
|
|
||||||
extends ContactCallback<SparkyComputerSensor, ControlledBall> {
|
|
||||||
/// {@macro sparky_computer_sensor_ball_contact_callback}
|
|
||||||
SparkyComputerSensorBallContactCallback();
|
|
||||||
|
|
||||||
@override
|
|
||||||
void begin(_, ControlledBall ball, __) {
|
|
||||||
ball.controller.turboCharge();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,46 +1,122 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:pinball/game/game.dart';
|
import 'package:pinball/game/game.dart';
|
||||||
|
import 'package:pinball/gen/gen.dart';
|
||||||
|
import 'package:pinball/theme/app_colors.dart';
|
||||||
|
|
||||||
/// {@template game_hud}
|
/// {@template game_hud}
|
||||||
/// Overlay of a [PinballGame] that displays the current [GameState.score] and
|
/// Overlay on the [PinballGame].
|
||||||
/// [GameState.balls].
|
///
|
||||||
|
/// Displays the current [GameState.score], [GameState.balls] and animates when
|
||||||
|
/// the player gets a [GameBonus].
|
||||||
/// {@endtemplate}
|
/// {@endtemplate}
|
||||||
class GameHud extends StatelessWidget {
|
class GameHud extends StatefulWidget {
|
||||||
/// {@macro game_hud}
|
/// {@macro game_hud}
|
||||||
const GameHud({Key? key}) : super(key: key);
|
const GameHud({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<GameHud> createState() => _GameHudState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _GameHudState extends State<GameHud> {
|
||||||
|
bool showAnimation = false;
|
||||||
|
|
||||||
|
/// Ratio from sprite frame (width 500, height 144) w / h = ratio
|
||||||
|
static const _ratio = 3.47;
|
||||||
|
static const _width = 265.0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final state = context.watch<GameBloc>().state;
|
final isGameOver = context.select((GameBloc bloc) => bloc.state.isGameOver);
|
||||||
|
|
||||||
return Container(
|
return _ScoreViewDecoration(
|
||||||
color: Colors.redAccent,
|
child: SizedBox(
|
||||||
width: 200,
|
height: _width / _ratio,
|
||||||
height: 100,
|
width: _width,
|
||||||
padding: const EdgeInsets.all(16),
|
child: BlocListener<GameBloc, GameState>(
|
||||||
child: Row(
|
listenWhen: (previous, current) =>
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
previous.bonusHistory.length != current.bonusHistory.length,
|
||||||
children: [
|
listener: (_, __) => setState(() => showAnimation = true),
|
||||||
Text(
|
child: AnimatedSwitcher(
|
||||||
'${state.score}',
|
duration: kThemeAnimationDuration,
|
||||||
style: Theme.of(context).textTheme.headline3,
|
child: showAnimation && !isGameOver
|
||||||
),
|
? _AnimationView(
|
||||||
Wrap(
|
onComplete: () {
|
||||||
direction: Axis.vertical,
|
if (mounted) {
|
||||||
children: [
|
setState(() => showAnimation = false);
|
||||||
for (var i = 0; i < state.balls; i++)
|
}
|
||||||
const Padding(
|
},
|
||||||
padding: EdgeInsets.only(top: 6, right: 6),
|
)
|
||||||
child: CircleAvatar(
|
: const ScoreView(),
|
||||||
radius: 8,
|
),
|
||||||
backgroundColor: Colors.black,
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class _ScoreViewDecoration extends StatelessWidget {
|
||||||
|
const _ScoreViewDecoration({
|
||||||
|
Key? key,
|
||||||
|
required this.child,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
final Widget child;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
const radius = BorderRadius.all(Radius.circular(12));
|
||||||
|
const boardWidth = 5.0;
|
||||||
|
|
||||||
|
return DecoratedBox(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: radius,
|
||||||
|
border: Border.all(
|
||||||
|
color: AppColors.white,
|
||||||
|
width: boardWidth,
|
||||||
|
),
|
||||||
|
image: DecorationImage(
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
image: AssetImage(
|
||||||
|
Assets.images.score.miniScoreBackground.path,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(boardWidth - 1),
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: radius,
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AnimationView extends StatelessWidget {
|
||||||
|
const _AnimationView({
|
||||||
|
Key? key,
|
||||||
|
required this.onComplete,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
final VoidCallback onComplete;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final lastBonus = context.select(
|
||||||
|
(GameBloc bloc) => bloc.state.bonusHistory.last,
|
||||||
|
);
|
||||||
|
switch (lastBonus) {
|
||||||
|
case GameBonus.dashNest:
|
||||||
|
return BonusAnimation.dashNest(onCompleted: onComplete);
|
||||||
|
case GameBonus.sparkyTurboCharge:
|
||||||
|
return BonusAnimation.sparkyTurboCharge(onCompleted: onComplete);
|
||||||
|
case GameBonus.dinoChomp:
|
||||||
|
return BonusAnimation.dinoChomp(onCompleted: onComplete);
|
||||||
|
case GameBonus.googleWord:
|
||||||
|
return BonusAnimation.googleWord(onCompleted: onComplete);
|
||||||
|
case GameBonus.androidSpaceship:
|
||||||
|
return BonusAnimation.androidSpaceship(onCompleted: onComplete);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -0,0 +1,70 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:pinball/game/game.dart';
|
||||||
|
import 'package:pinball/l10n/l10n.dart';
|
||||||
|
import 'package:pinball/theme/theme.dart';
|
||||||
|
|
||||||
|
/// {@template round_count_display}
|
||||||
|
/// Colored square indicating if a round is available.
|
||||||
|
/// {@endtemplate}
|
||||||
|
class RoundCountDisplay extends StatelessWidget {
|
||||||
|
/// {@macro round_count_display}
|
||||||
|
const RoundCountDisplay({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final l10n = context.l10n;
|
||||||
|
// TODO(arturplaczek): refactor when GameState handle balls and rounds and
|
||||||
|
// select state.rounds property instead of state.ball
|
||||||
|
final balls = context.select((GameBloc bloc) => bloc.state.balls);
|
||||||
|
|
||||||
|
return Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
l10n.rounds,
|
||||||
|
style: AppTextStyle.subtitle1.copyWith(
|
||||||
|
color: AppColors.orange,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
RoundIndicator(isActive: balls >= 1),
|
||||||
|
RoundIndicator(isActive: balls >= 2),
|
||||||
|
RoundIndicator(isActive: balls >= 3),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// {@template round_indicator}
|
||||||
|
/// [Widget] that displays the round indicator.
|
||||||
|
/// {@endtemplate}
|
||||||
|
@visibleForTesting
|
||||||
|
class RoundIndicator extends StatelessWidget {
|
||||||
|
/// {@macro round_indicator}
|
||||||
|
const RoundIndicator({
|
||||||
|
Key? key,
|
||||||
|
required this.isActive,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
/// A value that describes whether the indicator is active.
|
||||||
|
final bool isActive;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final color = isActive ? AppColors.orange : AppColors.orange.withAlpha(128);
|
||||||
|
const size = 8.0;
|
||||||
|
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||||
|
child: Container(
|
||||||
|
color: color,
|
||||||
|
height: size,
|
||||||
|
width: size,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,86 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:pinball/game/game.dart';
|
||||||
|
import 'package:pinball/l10n/l10n.dart';
|
||||||
|
import 'package:pinball/theme/theme.dart';
|
||||||
|
import 'package:pinball_components/pinball_components.dart';
|
||||||
|
|
||||||
|
/// {@template score_view}
|
||||||
|
/// [Widget] that displays the score.
|
||||||
|
/// {@endtemplate}
|
||||||
|
class ScoreView extends StatelessWidget {
|
||||||
|
/// {@macro score_view}
|
||||||
|
const ScoreView({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final isGameOver = context.select((GameBloc bloc) => bloc.state.isGameOver);
|
||||||
|
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 16,
|
||||||
|
vertical: 8,
|
||||||
|
),
|
||||||
|
child: AnimatedSwitcher(
|
||||||
|
duration: kThemeAnimationDuration,
|
||||||
|
child: isGameOver ? const _GameOver() : const _ScoreDisplay(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _GameOver extends StatelessWidget {
|
||||||
|
const _GameOver({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final l10n = context.l10n;
|
||||||
|
|
||||||
|
return Text(
|
||||||
|
l10n.gameOver,
|
||||||
|
style: AppTextStyle.headline1.copyWith(
|
||||||
|
color: AppColors.white,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ScoreDisplay extends StatelessWidget {
|
||||||
|
const _ScoreDisplay({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final l10n = context.l10n;
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
l10n.score.toLowerCase(),
|
||||||
|
style: AppTextStyle.subtitle1.copyWith(
|
||||||
|
color: AppColors.orange,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const _ScoreText(),
|
||||||
|
const RoundCountDisplay(),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ScoreText extends StatelessWidget {
|
||||||
|
const _ScoreText({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final score = context.select((GameBloc bloc) => bloc.state.score);
|
||||||
|
|
||||||
|
return Text(
|
||||||
|
score.formatScore(),
|
||||||
|
style: AppTextStyle.headline1.copyWith(
|
||||||
|
color: AppColors.white,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -1,3 +1,5 @@
|
|||||||
export 'bonus_animation.dart';
|
export 'bonus_animation.dart';
|
||||||
export 'game_hud.dart';
|
export 'game_hud.dart';
|
||||||
export 'play_button_overlay.dart';
|
export 'play_button_overlay.dart';
|
||||||
|
export 'round_count_display.dart';
|
||||||
|
export 'score_view.dart';
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
// ignore_for_file: public_member_api_docs
|
||||||
|
// TODO(allisonryan0002): Document this section when the API is stable.
|
||||||
|
|
||||||
|
part of 'character_theme_cubit.dart';
|
||||||
|
|
||||||
|
class CharacterThemeState extends Equatable {
|
||||||
|
const CharacterThemeState(this.characterTheme);
|
||||||
|
|
||||||
|
const CharacterThemeState.initial() : characterTheme = const DashTheme();
|
||||||
|
|
||||||
|
final CharacterTheme characterTheme;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [characterTheme];
|
||||||
|
}
|
@ -0,0 +1,2 @@
|
|||||||
|
export 'cubit/character_theme_cubit.dart';
|
||||||
|
export 'view/view.dart';
|
@ -1,16 +0,0 @@
|
|||||||
// ignore_for_file: public_member_api_docs
|
|
||||||
// TODO(allisonryan0002): Document this section when the API is stable.
|
|
||||||
|
|
||||||
part of 'theme_cubit.dart';
|
|
||||||
|
|
||||||
class ThemeState extends Equatable {
|
|
||||||
const ThemeState(this.theme);
|
|
||||||
|
|
||||||
const ThemeState.initial()
|
|
||||||
: theme = const PinballTheme(characterTheme: DashTheme());
|
|
||||||
|
|
||||||
final PinballTheme theme;
|
|
||||||
|
|
||||||
@override
|
|
||||||
List<Object> get props => [theme];
|
|
||||||
}
|
|
Before Width: | Height: | Size: 283 KiB After Width: | Height: | Size: 270 KiB |
After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 365 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 7.1 KiB |
@ -1,2 +1,3 @@
|
|||||||
export 'assets.gen.dart';
|
export 'assets.gen.dart';
|
||||||
|
export 'fonts.gen.dart';
|
||||||
export 'pinball_fonts.dart';
|
export 'pinball_fonts.dart';
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
import 'package:flame/components.dart';
|
||||||
|
import 'package:pinball_components/pinball_components.dart';
|
||||||
|
|
||||||
|
/// {@template sparky_animatronic}
|
||||||
|
/// Animated Sparky that sits on top of the [SparkyComputer].
|
||||||
|
/// {@endtemplate}
|
||||||
|
class SparkyAnimatronic extends SpriteAnimationComponent with HasGameRef {
|
||||||
|
/// {@macro sparky_animatronic}
|
||||||
|
SparkyAnimatronic()
|
||||||
|
: super(
|
||||||
|
anchor: Anchor.center,
|
||||||
|
playing: false,
|
||||||
|
priority: RenderPriority.sparkyAnimatronic,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> onLoad() async {
|
||||||
|
await super.onLoad();
|
||||||
|
|
||||||
|
final spriteSheet = gameRef.images.fromCache(
|
||||||
|
Assets.images.sparky.animatronic.keyName,
|
||||||
|
);
|
||||||
|
|
||||||
|
const amountPerRow = 9;
|
||||||
|
const amountPerColumn = 7;
|
||||||
|
final textureSize = Vector2(
|
||||||
|
spriteSheet.width / amountPerRow,
|
||||||
|
spriteSheet.height / amountPerColumn,
|
||||||
|
);
|
||||||
|
size = textureSize / 10;
|
||||||
|
|
||||||
|
animation = SpriteAnimation.fromFrameData(
|
||||||
|
spriteSheet,
|
||||||
|
SpriteAnimationData.sequenced(
|
||||||
|
amount: (amountPerRow * amountPerColumn) - 1,
|
||||||
|
amountPerRow: amountPerRow,
|
||||||
|
stepTime: 1 / 24,
|
||||||
|
textureSize: textureSize,
|
||||||
|
loop: false,
|
||||||
|
),
|
||||||
|
)..onComplete = () {
|
||||||
|
animation?.reset();
|
||||||
|
playing = false;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
import 'package:dashbook/dashbook.dart';
|
||||||
|
import 'package:flame/game.dart';
|
||||||
|
import 'package:sandbox/common/common.dart';
|
||||||
|
|
||||||
|
const _path =
|
||||||
|
'https://github.com/VGVentures/pinball/tree/main/packages/pinball_components/sandbox/lib/stories/';
|
||||||
|
|
||||||
|
extension StoryAddGame on Story {
|
||||||
|
void addGame({
|
||||||
|
required String title,
|
||||||
|
required String description,
|
||||||
|
required Game Function(DashbookContext) gameBuilder,
|
||||||
|
}) {
|
||||||
|
final _chapter = Chapter(
|
||||||
|
title,
|
||||||
|
(DashbookContext context) {
|
||||||
|
final game = gameBuilder(context);
|
||||||
|
if (game is Traceable) {
|
||||||
|
game.trace = context.boolProperty('Trace', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return GameWidget(game: game);
|
||||||
|
},
|
||||||
|
this,
|
||||||
|
codeLink: '$_path${name.toPath()}/${title.toPath()}',
|
||||||
|
info: description,
|
||||||
|
);
|
||||||
|
chapters.add(_chapter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension on String {
|
||||||
|
String toPath() {
|
||||||
|
return replaceAll(' ', '_')..toLowerCase();
|
||||||
|
}
|
||||||
|
}
|
@ -1,3 +1,3 @@
|
|||||||
|
export 'add_game.dart';
|
||||||
export 'games.dart';
|
export 'games.dart';
|
||||||
export 'methods.dart';
|
|
||||||
export 'trace.dart';
|
export 'trace.dart';
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
String buildSourceLink(String path) {
|
|
||||||
return 'https://github.com/VGVentures/pinball/tree/main/packages/pinball_components/sandbox/lib/stories/$path';
|
|
||||||
}
|
|
@ -1,25 +1,36 @@
|
|||||||
import 'package:dashbook/dashbook.dart';
|
import 'package:dashbook/dashbook.dart';
|
||||||
import 'package:flame/game.dart';
|
|
||||||
import 'package:sandbox/common/common.dart';
|
import 'package:sandbox/common/common.dart';
|
||||||
import 'package:sandbox/stories/alien_zone/alien_bumper_a_game.dart';
|
import 'package:sandbox/stories/alien_zone/alien_bumper_a_game.dart';
|
||||||
import 'package:sandbox/stories/alien_zone/alien_bumper_b_game.dart';
|
import 'package:sandbox/stories/alien_zone/alien_bumper_b_game.dart';
|
||||||
|
import 'package:sandbox/stories/alien_zone/spaceship_game.dart';
|
||||||
|
import 'package:sandbox/stories/alien_zone/spaceship_rail_game.dart';
|
||||||
|
import 'package:sandbox/stories/alien_zone/spaceship_ramp_game.dart';
|
||||||
|
|
||||||
void addAlienZoneStories(Dashbook dashbook) {
|
void addAlienZoneStories(Dashbook dashbook) {
|
||||||
dashbook.storiesOf('Alien Zone')
|
dashbook.storiesOf('Alien Zone')
|
||||||
..add(
|
..addGame(
|
||||||
'Alien Bumper A',
|
title: 'Alien Bumper A',
|
||||||
(context) => GameWidget(
|
description: AlienBumperAGame.description,
|
||||||
game: AlienBumperAGame()..trace = context.boolProperty('Trace', true),
|
gameBuilder: (_) => AlienBumperAGame(),
|
||||||
),
|
|
||||||
codeLink: buildSourceLink('alien_zone/alien_bumper_a.dart'),
|
|
||||||
info: AlienBumperAGame.info,
|
|
||||||
)
|
)
|
||||||
..add(
|
..addGame(
|
||||||
'Alien Bumper B',
|
title: 'Alien Bumper B',
|
||||||
(context) => GameWidget(
|
description: AlienBumperBGame.description,
|
||||||
game: AlienBumperBGame()..trace = context.boolProperty('Trace', true),
|
gameBuilder: (_) => AlienBumperBGame(),
|
||||||
),
|
)
|
||||||
codeLink: buildSourceLink('alien_zone/alien_bumper_b.dart'),
|
..addGame(
|
||||||
info: AlienBumperAGame.info,
|
title: 'Spaceship',
|
||||||
|
description: SpaceshipGame.description,
|
||||||
|
gameBuilder: (_) => SpaceshipGame(),
|
||||||
|
)
|
||||||
|
..addGame(
|
||||||
|
title: 'Spaceship Rail',
|
||||||
|
description: SpaceshipRailGame.description,
|
||||||
|
gameBuilder: (_) => SpaceshipRailGame(),
|
||||||
|
)
|
||||||
|
..addGame(
|
||||||
|
title: 'Spaceship Ramp',
|
||||||
|
description: SpaceshipRampGame.description,
|
||||||
|
gameBuilder: (_) => SpaceshipRampGame(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,11 @@
|
|||||||
import 'package:dashbook/dashbook.dart';
|
import 'package:dashbook/dashbook.dart';
|
||||||
import 'package:flame/game.dart';
|
|
||||||
import 'package:sandbox/common/common.dart';
|
import 'package:sandbox/common/common.dart';
|
||||||
import 'package:sandbox/stories/baseboard/baseboard_game.dart';
|
import 'package:sandbox/stories/baseboard/baseboard_game.dart';
|
||||||
|
|
||||||
void addBaseboardStories(Dashbook dashbook) {
|
void addBaseboardStories(Dashbook dashbook) {
|
||||||
dashbook.storiesOf('Baseboard').add(
|
dashbook.storiesOf('Baseboard').addGame(
|
||||||
'Basic',
|
title: 'Traced',
|
||||||
(context) => GameWidget(
|
description: BaseboardGame.description,
|
||||||
game: BaseboardGame()..trace = context.boolProperty('Trace', true),
|
gameBuilder: (_) => BaseboardGame(),
|
||||||
),
|
|
||||||
codeLink: buildSourceLink('baseboard_game/basic.dart'),
|
|
||||||
info: BaseboardGame.info,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,11 @@
|
|||||||
import 'package:dashbook/dashbook.dart';
|
import 'package:dashbook/dashbook.dart';
|
||||||
import 'package:flame/game.dart';
|
|
||||||
import 'package:sandbox/common/common.dart';
|
import 'package:sandbox/common/common.dart';
|
||||||
import 'package:sandbox/stories/boundaries/boundaries_game.dart';
|
import 'package:sandbox/stories/boundaries/boundaries_game.dart';
|
||||||
|
|
||||||
void addBoundariesStories(Dashbook dashbook) {
|
void addBoundariesStories(Dashbook dashbook) {
|
||||||
dashbook.storiesOf('Boundaries').add(
|
dashbook.storiesOf('Boundaries').addGame(
|
||||||
'Basic',
|
title: 'Traced',
|
||||||
(context) => GameWidget(
|
description: BoundariesGame.description,
|
||||||
game: BoundariesGame()..trace = context.boolProperty('Trace', true),
|
gameBuilder: (_) => BoundariesGame(),
|
||||||
),
|
|
||||||
codeLink: buildSourceLink('boundaries_game/basic.dart'),
|
|
||||||
info: BoundariesGame.info,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,11 @@
|
|||||||
import 'package:dashbook/dashbook.dart';
|
import 'package:dashbook/dashbook.dart';
|
||||||
import 'package:flame/game.dart';
|
|
||||||
import 'package:sandbox/common/common.dart';
|
import 'package:sandbox/common/common.dart';
|
||||||
import 'package:sandbox/stories/chrome_dino/chrome_dino_game.dart';
|
import 'package:sandbox/stories/chrome_dino/chrome_dino_game.dart';
|
||||||
|
|
||||||
void addChromeDinoStories(Dashbook dashbook) {
|
void addChromeDinoStories(Dashbook dashbook) {
|
||||||
dashbook.storiesOf('Chrome Dino').add(
|
dashbook.storiesOf('Chrome Dino').addGame(
|
||||||
'Basic',
|
title: 'Trace',
|
||||||
(context) => GameWidget(
|
description: ChromeDinoGame.description,
|
||||||
game: ChromeDinoGame(),
|
gameBuilder: (_) => ChromeDinoGame(),
|
||||||
),
|
|
||||||
codeLink: buildSourceLink('chrome_dino/basic.dart'),
|
|
||||||
info: ChromeDinoGame.info,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flame/input.dart';
|
||||||
|
import 'package:pinball_components/pinball_components.dart';
|
||||||
|
import 'package:pinball_flame/pinball_flame.dart';
|
||||||
|
import 'package:sandbox/stories/ball/basic_ball_game.dart';
|
||||||
|
|
||||||
|
class DinoWallGame extends BallGame {
|
||||||
|
DinoWallGame() : super();
|
||||||
|
|
||||||
|
static const description = '''
|
||||||
|
Shows how DinoWalls are rendered.
|
||||||
|
|
||||||
|
- Activate the "trace" parameter to overlay the body.
|
||||||
|
- Tap anywhere on the screen to spawn a ball into the game.
|
||||||
|
''';
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> onLoad() async {
|
||||||
|
await super.onLoad();
|
||||||
|
|
||||||
|
await images.loadAll([
|
||||||
|
Assets.images.dino.dinoLandTop.keyName,
|
||||||
|
Assets.images.dino.dinoLandBottom.keyName,
|
||||||
|
]);
|
||||||
|
|
||||||
|
await addFromBlueprint(DinoWalls());
|
||||||
|
camera.followVector2(Vector2.zero());
|
||||||
|
await traceAllBodies();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
import 'package:dashbook/dashbook.dart';
|
||||||
|
import 'package:sandbox/common/common.dart';
|
||||||
|
import 'package:sandbox/stories/dino_wall/dino_wall_game.dart';
|
||||||
|
|
||||||
|
void addDinoWallStories(Dashbook dashbook) {
|
||||||
|
dashbook.storiesOf('DinoWall').addGame(
|
||||||
|
title: 'Traced',
|
||||||
|
description: DinoWallGame.description,
|
||||||
|
gameBuilder: (_) => DinoWallGame(),
|
||||||
|
);
|
||||||
|
}
|
@ -1,13 +1,18 @@
|
|||||||
import 'package:dashbook/dashbook.dart';
|
import 'package:dashbook/dashbook.dart';
|
||||||
import 'package:flame/game.dart';
|
|
||||||
import 'package:sandbox/common/common.dart';
|
import 'package:sandbox/common/common.dart';
|
||||||
|
import 'package:sandbox/stories/effects/camera_zoom_game.dart';
|
||||||
import 'package:sandbox/stories/effects/fire_effect_game.dart';
|
import 'package:sandbox/stories/effects/fire_effect_game.dart';
|
||||||
|
|
||||||
void addEffectsStories(Dashbook dashbook) {
|
void addEffectsStories(Dashbook dashbook) {
|
||||||
dashbook.storiesOf('Effects').add(
|
dashbook.storiesOf('Effects')
|
||||||
'Fire Effect',
|
..addGame(
|
||||||
(context) => GameWidget(game: FireEffectGame()),
|
title: 'Fire',
|
||||||
codeLink: buildSourceLink('effects/fire_effect.dart'),
|
description: FireEffectGame.description,
|
||||||
info: FireEffectGame.info,
|
gameBuilder: (_) => FireEffectGame(),
|
||||||
|
)
|
||||||
|
..addGame(
|
||||||
|
title: 'CameraZoom',
|
||||||
|
description: CameraZoomGame.description,
|
||||||
|
gameBuilder: (_) => CameraZoomGame(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,11 @@
|
|||||||
import 'package:dashbook/dashbook.dart';
|
import 'package:dashbook/dashbook.dart';
|
||||||
import 'package:flame/game.dart';
|
|
||||||
import 'package:sandbox/common/common.dart';
|
import 'package:sandbox/common/common.dart';
|
||||||
import 'package:sandbox/stories/flipper/flipper_game.dart';
|
import 'package:sandbox/stories/flipper/flipper_game.dart';
|
||||||
|
|
||||||
void addFlipperStories(Dashbook dashbook) {
|
void addFlipperStories(Dashbook dashbook) {
|
||||||
dashbook.storiesOf('Flipper').add(
|
dashbook.storiesOf('Flipper').addGame(
|
||||||
'Basic',
|
title: 'Traced',
|
||||||
(context) => GameWidget(
|
description: FlipperGame.description,
|
||||||
game: FlipperGame()..trace = context.boolProperty('Trace', true),
|
gameBuilder: (_) => FlipperGame(),
|
||||||
),
|
|
||||||
codeLink: buildSourceLink('flipper/basic.dart'),
|
|
||||||
info: FlipperGame.info,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,11 @@
|
|||||||
import 'package:dashbook/dashbook.dart';
|
import 'package:dashbook/dashbook.dart';
|
||||||
import 'package:flame/game.dart';
|
|
||||||
import 'package:sandbox/common/common.dart';
|
import 'package:sandbox/common/common.dart';
|
||||||
import 'package:sandbox/stories/google_word/google_letter_game.dart';
|
import 'package:sandbox/stories/google_word/google_letter_game.dart';
|
||||||
|
|
||||||
void addGoogleWordStories(Dashbook dashbook) {
|
void addGoogleWordStories(Dashbook dashbook) {
|
||||||
dashbook.storiesOf('Google Word').add(
|
dashbook.storiesOf('Google Word').addGame(
|
||||||
'Letter',
|
title: 'Letter 0',
|
||||||
(context) => GameWidget(
|
description: GoogleLetterGame.description,
|
||||||
game: GoogleLetterGame()..trace = context.boolProperty('Trace', true),
|
gameBuilder: (_) => GoogleLetterGame(),
|
||||||
),
|
|
||||||
codeLink: buildSourceLink('google_word/letter.dart'),
|
|
||||||
info: GoogleLetterGame.info,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,11 @@
|
|||||||
import 'package:dashbook/dashbook.dart';
|
import 'package:dashbook/dashbook.dart';
|
||||||
import 'package:flame/game.dart';
|
|
||||||
import 'package:sandbox/common/common.dart';
|
import 'package:sandbox/common/common.dart';
|
||||||
import 'package:sandbox/stories/kicker/kicker_game.dart';
|
import 'package:sandbox/stories/kicker/kicker_game.dart';
|
||||||
|
|
||||||
void addKickerStories(Dashbook dashbook) {
|
void addKickerStories(Dashbook dashbook) {
|
||||||
dashbook.storiesOf('Kickers').add(
|
dashbook.storiesOf('Kickers').addGame(
|
||||||
'Basic',
|
title: 'Traced',
|
||||||
(context) => GameWidget(
|
description: KickerGame.description,
|
||||||
game: KickerGame()..trace = context.boolProperty('Trace', true),
|
gameBuilder: (_) => KickerGame(),
|
||||||
),
|
|
||||||
codeLink: buildSourceLink('kicker_game/basic.dart'),
|
|
||||||
info: KickerGame.info,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,11 @@
|
|||||||
import 'package:dashbook/dashbook.dart';
|
import 'package:dashbook/dashbook.dart';
|
||||||
import 'package:flame/game.dart';
|
|
||||||
import 'package:sandbox/common/common.dart';
|
import 'package:sandbox/common/common.dart';
|
||||||
import 'package:sandbox/stories/launch_ramp/launch_ramp_game.dart';
|
import 'package:sandbox/stories/launch_ramp/launch_ramp_game.dart';
|
||||||
|
|
||||||
void addLaunchRampStories(Dashbook dashbook) {
|
void addLaunchRampStories(Dashbook dashbook) {
|
||||||
dashbook.storiesOf('LaunchRamp').add(
|
dashbook.storiesOf('LaunchRamp').addGame(
|
||||||
'Basic',
|
title: 'Traced',
|
||||||
(context) => GameWidget(
|
description: LaunchRampGame.description,
|
||||||
game: LaunchRampGame()..trace = context.boolProperty('Trace', true),
|
gameBuilder: (_) => LaunchRampGame(),
|
||||||
),
|
|
||||||
codeLink: buildSourceLink('launch_ramp/basic.dart'),
|
|
||||||
info: LaunchRampGame.info,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,11 @@
|
|||||||
import 'package:dashbook/dashbook.dart';
|
import 'package:dashbook/dashbook.dart';
|
||||||
import 'package:flame/game.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:sandbox/common/common.dart';
|
import 'package:sandbox/common/common.dart';
|
||||||
import 'package:sandbox/stories/layer/basic_layer_game.dart';
|
import 'package:sandbox/stories/layer/layer_game.dart';
|
||||||
|
|
||||||
void addLayerStories(Dashbook dashbook) {
|
void addLayerStories(Dashbook dashbook) {
|
||||||
dashbook.storiesOf('Layer').add(
|
dashbook.storiesOf('Layer').addGame(
|
||||||
'Layer',
|
title: 'Example',
|
||||||
(context) => GameWidget(
|
description: LayerGame.description,
|
||||||
game: BasicLayerGame(
|
gameBuilder: (_) => LayerGame(),
|
||||||
color: context.colorProperty('color', Colors.blue),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
codeLink: buildSourceLink('layer/basic.dart'),
|
|
||||||
info: BasicLayerGame.info,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|