Before Width: | Height: | Size: 306 KiB After Width: | Height: | Size: 207 KiB |
Before Width: | Height: | Size: 422 KiB After Width: | Height: | Size: 209 KiB |
Before Width: | Height: | Size: 171 KiB After Width: | Height: | Size: 124 KiB |
Before Width: | Height: | Size: 200 KiB After Width: | Height: | Size: 105 KiB |
Before Width: | Height: | Size: 298 KiB After Width: | Height: | Size: 169 KiB |
Before Width: | Height: | Size: 6.2 KiB |
@ -0,0 +1,13 @@
|
||||
// ignore_for_file: public_member_api_docs
|
||||
|
||||
import 'package:flame_forge2d/flame_forge2d.dart';
|
||||
import 'package:pinball_audio/pinball_audio.dart';
|
||||
import 'package:pinball_flame/pinball_flame.dart';
|
||||
|
||||
class CowBumperNoiseBehavior extends ContactBehavior {
|
||||
@override
|
||||
void beginContact(Object other, Contact contact) {
|
||||
super.beginContact(other, contact);
|
||||
readProvider<PinballAudioPlayer>().play(PinballAudio.cowMoo);
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
import 'package:flame_forge2d/flame_forge2d.dart';
|
||||
import 'package:pinball_audio/pinball_audio.dart';
|
||||
import 'package:pinball_flame/pinball_flame.dart';
|
||||
|
||||
class KickerNoiseBehavior extends ContactBehavior {
|
||||
@override
|
||||
void beginContact(Object other, Contact contact) {
|
||||
super.beginContact(other, contact);
|
||||
readProvider<PinballAudioPlayer>().play(PinballAudio.kicker);
|
||||
}
|
||||
}
|
@ -0,0 +1,189 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flame/components.dart';
|
||||
import 'package:flame/input.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:pinball/l10n/l10n.dart';
|
||||
import 'package:pinball_components/pinball_components.dart';
|
||||
import 'package:pinball_flame/pinball_flame.dart';
|
||||
import 'package:pinball_ui/pinball_ui.dart';
|
||||
import 'package:share_repository/share_repository.dart';
|
||||
|
||||
/// Signature for the callback called when the user tries to share their score
|
||||
/// on the [ShareDisplay].
|
||||
typedef OnSocialShareTap = void Function(SharePlatform);
|
||||
|
||||
final _descriptionTextPaint = TextPaint(
|
||||
style: const TextStyle(
|
||||
fontSize: 1.6,
|
||||
color: PinballColors.white,
|
||||
fontFamily: PinballFonts.pixeloidSans,
|
||||
),
|
||||
);
|
||||
|
||||
/// {@template share_display}
|
||||
/// Display that allows users to share their score to social networks.
|
||||
/// {@endtemplate}
|
||||
class ShareDisplay extends Component with HasGameRef {
|
||||
/// {@macro share_display}
|
||||
ShareDisplay({
|
||||
OnSocialShareTap? onShare,
|
||||
}) : super(
|
||||
children: [
|
||||
_ShareInstructionsComponent(
|
||||
onShare: onShare,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
class _ShareInstructionsComponent extends PositionComponent with HasGameRef {
|
||||
_ShareInstructionsComponent({
|
||||
OnSocialShareTap? onShare,
|
||||
}) : super(
|
||||
anchor: Anchor.center,
|
||||
position: Vector2(0, -25),
|
||||
children: [
|
||||
_DescriptionComponent(),
|
||||
_SocialNetworksComponent(
|
||||
onShare: onShare,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
class _DescriptionComponent extends PositionComponent with HasGameRef {
|
||||
_DescriptionComponent()
|
||||
: super(
|
||||
anchor: Anchor.center,
|
||||
position: Vector2.zero(),
|
||||
children: [
|
||||
_LetEveryoneTextComponent(),
|
||||
_SharingYourScoreTextComponent(),
|
||||
_SocialMediaTextComponent(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
class _LetEveryoneTextComponent extends TextComponent with HasGameRef {
|
||||
_LetEveryoneTextComponent()
|
||||
: super(
|
||||
anchor: Anchor.center,
|
||||
position: Vector2.zero(),
|
||||
textRenderer: _descriptionTextPaint,
|
||||
);
|
||||
|
||||
@override
|
||||
Future<void> onLoad() async {
|
||||
await super.onLoad();
|
||||
text = readProvider<AppLocalizations>().letEveryone;
|
||||
}
|
||||
}
|
||||
|
||||
class _SharingYourScoreTextComponent extends TextComponent with HasGameRef {
|
||||
_SharingYourScoreTextComponent()
|
||||
: super(
|
||||
anchor: Anchor.center,
|
||||
position: Vector2(0, 2.5),
|
||||
textRenderer: _descriptionTextPaint,
|
||||
);
|
||||
|
||||
@override
|
||||
Future<void> onLoad() async {
|
||||
await super.onLoad();
|
||||
text = readProvider<AppLocalizations>().bySharingYourScore;
|
||||
}
|
||||
}
|
||||
|
||||
class _SocialMediaTextComponent extends TextComponent with HasGameRef {
|
||||
_SocialMediaTextComponent()
|
||||
: super(
|
||||
anchor: Anchor.center,
|
||||
position: Vector2(0, 5),
|
||||
textRenderer: _descriptionTextPaint,
|
||||
);
|
||||
|
||||
@override
|
||||
Future<void> onLoad() async {
|
||||
await super.onLoad();
|
||||
text = readProvider<AppLocalizations>().socialMediaAccount;
|
||||
}
|
||||
}
|
||||
|
||||
class _SocialNetworksComponent extends PositionComponent with HasGameRef {
|
||||
_SocialNetworksComponent({
|
||||
OnSocialShareTap? onShare,
|
||||
}) : super(
|
||||
anchor: Anchor.center,
|
||||
position: Vector2(0, 12),
|
||||
children: [
|
||||
FacebookButtonComponent(onTap: onShare),
|
||||
TwitterButtonComponent(onTap: onShare),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/// {@template facebook_button_component}
|
||||
/// Button for sharing on Facebook.
|
||||
/// {@endtemplate}
|
||||
class FacebookButtonComponent extends SpriteComponent
|
||||
with HasGameRef, Tappable {
|
||||
/// {@macro facebook_button_component}
|
||||
FacebookButtonComponent({
|
||||
OnSocialShareTap? onTap,
|
||||
}) : _onTap = onTap,
|
||||
super(
|
||||
anchor: Anchor.center,
|
||||
position: Vector2(-5, 0),
|
||||
);
|
||||
|
||||
final OnSocialShareTap? _onTap;
|
||||
|
||||
@override
|
||||
bool onTapDown(TapDownInfo info) {
|
||||
_onTap?.call(SharePlatform.facebook);
|
||||
return true;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> onLoad() async {
|
||||
await super.onLoad();
|
||||
final sprite = Sprite(
|
||||
gameRef.images.fromCache(Assets.images.backbox.button.facebook.keyName),
|
||||
);
|
||||
this.sprite = sprite;
|
||||
size = sprite.originalSize / 25;
|
||||
}
|
||||
}
|
||||
|
||||
/// {@template twitter_button_component}
|
||||
/// Button for sharing on Twitter.
|
||||
/// {@endtemplate}
|
||||
class TwitterButtonComponent extends SpriteComponent with HasGameRef, Tappable {
|
||||
/// {@macro twitter_button_component}
|
||||
TwitterButtonComponent({
|
||||
OnSocialShareTap? onTap,
|
||||
}) : _onTap = onTap,
|
||||
super(
|
||||
anchor: Anchor.center,
|
||||
position: Vector2(5, 0),
|
||||
);
|
||||
|
||||
final OnSocialShareTap? _onTap;
|
||||
|
||||
@override
|
||||
bool onTapDown(TapDownInfo info) {
|
||||
_onTap?.call(SharePlatform.twitter);
|
||||
return true;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> onLoad() async {
|
||||
await super.onLoad();
|
||||
final sprite = Sprite(
|
||||
gameRef.images.fromCache(Assets.images.backbox.button.twitter.keyName),
|
||||
);
|
||||
this.sprite = sprite;
|
||||
size = sprite.originalSize / 25;
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 637 KiB After Width: | Height: | Size: 544 KiB |
Before Width: | Height: | Size: 390 KiB After Width: | Height: | Size: 334 KiB |
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 257 KiB |
Before Width: | Height: | Size: 266 KiB After Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 1012 KiB After Width: | Height: | Size: 245 KiB |
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 180 KiB |
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 471 KiB |
Before Width: | Height: | Size: 481 KiB After Width: | Height: | Size: 139 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 968 B |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 128 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 290 KiB After Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 6.4 KiB |
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 6.4 KiB |
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 8.3 KiB |
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 365 KiB After Width: | Height: | Size: 100 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 374 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 154 KiB After Width: | Height: | Size: 119 KiB |
Before Width: | Height: | Size: 126 KiB After Width: | Height: | Size: 94 KiB |
Before Width: | Height: | Size: 95 KiB After Width: | Height: | Size: 72 KiB |
Before Width: | Height: | Size: 277 KiB After Width: | Height: | Size: 212 KiB |
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 915 KiB |
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 850 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 218 KiB After Width: | Height: | Size: 174 KiB |
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 254 KiB After Width: | Height: | Size: 192 KiB |
Before Width: | Height: | Size: 127 KiB After Width: | Height: | Size: 47 KiB |
Before Width: | Height: | Size: 638 KiB After Width: | Height: | Size: 326 KiB |
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 1.6 KiB |