diff --git a/assets/audio/explosion.ogg b/assets/audio/explosion.ogg new file mode 100644 index 0000000..73966a2 Binary files /dev/null and b/assets/audio/explosion.ogg differ diff --git a/assets/audio/four_elements.ogg b/assets/audio/four_elements.ogg new file mode 100644 index 0000000..27350d0 Binary files /dev/null and b/assets/audio/four_elements.ogg differ diff --git a/assets/audio/select.ogg b/assets/audio/select.ogg new file mode 100644 index 0000000..6832b7f Binary files /dev/null and b/assets/audio/select.ogg differ diff --git a/assets/images/magic_cube.png b/assets/images/magic_cube.png new file mode 100644 index 0000000..cae94b8 Binary files /dev/null and b/assets/images/magic_cube.png differ diff --git a/lib/game/board.dart b/lib/game/board.dart index 56c84e1..0f499be 100644 --- a/lib/game/board.dart +++ b/lib/game/board.dart @@ -3,6 +3,7 @@ import 'package:flame/components.dart'; import 'package:flame/effects.dart'; import 'package:flame/game.dart'; import 'package:flutter/material.dart'; +import 'package:match_magic/utilities/audio_manager.dart'; import 'tile.dart'; import 'package:flame/sprite.dart'; import 'swap_notifier.dart'; @@ -10,6 +11,7 @@ import 'swap_notifier.dart'; class Board extends FlameGame { final List sprites; final SwapNotifier swapNotifier; + final Sprite magicCubeSprite; static const int rows = 8; static const int cols = 8; late double tileSize; @@ -22,7 +24,11 @@ class Board extends FlameGame { bool isFirstLaunch = true; - Board({required this.sprites, required this.swapNotifier}); + Board({ + required this.sprites, + required this.swapNotifier, + required this.magicCubeSprite, + }); @override Future onLoad() async { @@ -43,8 +49,8 @@ class Board extends FlameGame { void restartGame() { isFirstLaunch = true; - _resetGame(); swapNotifier.resetScore(); + _resetGame(); } void _initializeGrid(bool animate) { @@ -109,27 +115,59 @@ class Board extends FlameGame { } while (hasMatches); } + // Future handleTileSwipe(Tile tile, Vector2 delta) async { + // if (animating) return; + + // int row = tile.row; + // int col = tile.col; + // Tile? targetTile; + + // if (delta.x.abs() > delta.y.abs()) { + // if (delta.x > 0 && col < cols - 1) { + // targetTile = tiles[row][col + 1]; + // } else if (delta.x < 0 && col > 0) { + // targetTile = tiles[row][col - 1]; + // } + // } else { + // if (delta.y > 0 && row < rows - 1) { + // targetTile = tiles[row + 1][col]; + // } else if (delta.y < 0 && row > 0) { + // targetTile = tiles[row - 1][col]; + // } + // } + + // if (targetTile != null) { + // animating = true; + // lastMovedTile = tile; + // swapTiles(tile, targetTile, true); + + // await Future.delayed(const Duration(milliseconds: 300)); + + // if (!checkMatches()) { + // swapTiles(tile, targetTile, true); + // } else { + // swapNotifier.incrementMoveCount(); + // } + // selectedRow = null; + // selectedCol = null; + // animating = false; + // } + // } + Future handleTileSwipe(Tile tile, Vector2 delta) async { if (animating) return; - - int row = tile.row; - int col = tile.col; Tile? targetTile; - if (delta.x.abs() > delta.y.abs()) { - if (delta.x > 0 && col < cols - 1) { - targetTile = tiles[row][col + 1]; - } else if (delta.x < 0 && col > 0) { - targetTile = tiles[row][col - 1]; - } - } else { - if (delta.y > 0 && row < rows - 1) { - targetTile = tiles[row + 1][col]; - } else if (delta.y < 0 && row > 0) { - targetTile = tiles[row - 1][col]; + if (tile.isMagicCube) { + targetTile = _getTileBySwipeDirection(tile, delta); + if (targetTile != null) { + _removeAllOfType(targetTile.spriteIndex); } + return; } + targetTile = _getTileBySwipeDirection(tile, delta); + if (targetTile != null) { animating = true; lastMovedTile = tile; @@ -148,6 +186,41 @@ class Board extends FlameGame { } } + Tile? _getTileBySwipeDirection(Tile tile, Vector2 delta) { + int row = tile.row; + int col = tile.col; + Tile? targetTile; + + if (delta.x.abs() > delta.y.abs()) { + if (delta.x > 0 && col < cols - 1) { + targetTile = tiles[row][col + 1]; + } else if (delta.x < 0 && col > 0) { + targetTile = tiles[row][col - 1]; + } + } else { + if (delta.y > 0 && row < rows - 1) { + targetTile = tiles[row + 1][col]; + } else if (delta.y < 0 && row > 0) { + targetTile = tiles[row - 1][col]; + } + } + return targetTile; + } + + void _removeAllOfType(int spriteIndex) { + for (int row = 0; row < rows; row++) { + for (int col = 0; col < cols; col++) { + if (tiles[row][col]?.spriteIndex == spriteIndex) { + _animateRemoveTile(tiles[row][col]!); + tiles[row][col] = null; + } + } + } + + _applyGravity(); + _fillEmptySpaces(); + } + bool _isAdjacent(int row1, int col1, int row2, int col2) { return (row1 == row2 && (col1 - col2).abs() == 1) || (col1 == col2 && (row1 - row2).abs() == 1); @@ -206,6 +279,7 @@ class Board extends FlameGame { for (final match in matches) { points += _removeMatchedElements(match[0], match[1]); } + AudioManager.playSelectSound(); Future.delayed(const Duration(milliseconds: 300), () { _applyGravity(); Future.delayed(const Duration(milliseconds: 300), () { @@ -308,6 +382,7 @@ class Board extends FlameGame { if (tileToTransformIntoBomb != null) { _createBomb(tileToTransformIntoBomb.row, tileToTransformIntoBomb.col); + AudioManager.playFourElementsSound(); } return score; @@ -337,6 +412,7 @@ class Board extends FlameGame { _animateRemoveTile(tile); tiles[row][col] = null; + AudioManager.playExplosionSound(); } void _animateBombExplosion(Vector2 position) { @@ -368,10 +444,21 @@ class Board extends FlameGame { return 0; } + // void _animateRemoveTile(Tile tile) { + // tile.add(RemoveEffect( + // delay: 0.5, + // onComplete: () => remove(tile), + // )); + // } + void _animateRemoveTile(Tile tile) { - tile.add(RemoveEffect( - delay: 0.5, - onComplete: () => remove(tile), + tile.add(ScaleEffect.to( + Vector2.zero(), + EffectController( + duration: 0.2, + curve: Curves.easeInBack, + ), + onComplete: () => tile.removeFromParent(), )); } @@ -407,32 +494,9 @@ class Board extends FlameGame { } void _createMagicCube(int row, int col) { - final tile = tiles[row][col]!; - tile.isMagicCube = true; - - tile.add( - OpacityEffect.to( - 0.5, - EffectController( - duration: 0.5, - infinite: true, - reverseDuration: 0.5, - ), - ), - ); - - tile.add( - ColorEffect( - Colors.purple, - EffectController( - duration: 0.5, - infinite: true, - reverseDuration: 0.5, - ), - opacityFrom: 0.5, - opacityTo: 1.0, - ), - ); + var tile = tiles[row][col]; + tile?.sprite = magicCubeSprite; + tile?.isMagicCube = true; } void explodeBomb(Tile bombTile) { diff --git a/lib/game/match_magic_game.dart b/lib/game/match_magic_game.dart index 8e8a96a..27fdfc9 100644 --- a/lib/game/match_magic_game.dart +++ b/lib/game/match_magic_game.dart @@ -2,6 +2,7 @@ import 'package:flame/components.dart'; import 'package:flame/game.dart'; import 'package:flutter/material.dart'; import 'package:match_magic/game/sprite_loader.dart'; +import 'package:match_magic/utilities/audio_manager.dart'; import 'package:provider/provider.dart'; import 'board.dart'; import 'swap_notifier.dart'; @@ -14,20 +15,24 @@ class MatchMagicGameScreen extends StatefulWidget { } class _MatchMagicGameScreenState extends State { - late Future> _spritesFuture; + late Future> _crystalsFuture; + late Future _magicCubeFuture; Board? board; @override void initState() { super.initState(); - _spritesFuture = SpriteLoader.loadSprites(); + _crystalsFuture = SpriteLoader.loadCrystalSprites(); + _magicCubeFuture = SpriteLoader.loadMagicCubeSprite(); + AudioManager.load(); } void _restartGame() { context.read().resetScore(); setState(() { board = null; - _spritesFuture = SpriteLoader.loadSprites(); + _crystalsFuture = SpriteLoader.loadCrystalSprites(); + _magicCubeFuture = SpriteLoader.loadMagicCubeSprite(); }); } @@ -71,6 +76,7 @@ class _MatchMagicGameScreenState extends State { onPressed: () { Navigator.of(context).pop(); Navigator.of(context).popUntil((route) => route.isFirst); + context.read().resetScore(); }, child: const Text('Yes'), ), @@ -91,66 +97,92 @@ class _MatchMagicGameScreenState extends State { return Scaffold( backgroundColor: Colors.black, body: FutureBuilder>( - future: _spritesFuture, - builder: (context, snapshot) { - if (snapshot.connectionState == ConnectionState.done) { - if (snapshot.hasError) { - return Center(child: Text('Error: ${snapshot.error}')); - } else if (!snapshot.hasData || snapshot.data == null) { - return const Center(child: Text('No sprites found')); + future: _crystalsFuture, + builder: (context, crystalSnapshot) { + if (crystalSnapshot.connectionState == ConnectionState.done) { + if (crystalSnapshot.hasError) { + return Center(child: Text('Error: ${crystalSnapshot.error}')); + } else if (!crystalSnapshot.hasData || + crystalSnapshot.data == null) { + return const Center(child: Text('No crystal sprites found')); } else { - final sprites = snapshot.data!; - board ??= Board( - sprites: sprites, swapNotifier: context.read()); + final crystals = crystalSnapshot.data!; - return Stack( - children: [ - Column( - children: [ - const SizedBox(height: 50), - const ScoreDisplay(), - Expanded( - child: Center( - child: AspectRatio( - aspectRatio: 1, - child: GameWidget(game: board!), - ), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, + return FutureBuilder( + future: _magicCubeFuture, + builder: (context, cubeSnapshot) { + if (cubeSnapshot.connectionState == ConnectionState.done) { + if (cubeSnapshot.hasError) { + return Center( + child: Text('Error: ${cubeSnapshot.error}')); + } else if (!cubeSnapshot.hasData || + cubeSnapshot.data == null) { + return const Center( + child: Text('No magic cube sprite found')); + } else { + final magicCube = cubeSnapshot.data!; + + board ??= Board( + sprites: crystals, + magicCubeSprite: magicCube, + swapNotifier: context.read(), + ); + + return Stack( children: [ - ElevatedButton( - onPressed: _restartGame, - child: const Text( - 'Restart', - style: TextStyle(color: Colors.black), - ), + Column( + children: [ + const SizedBox(height: 50), + const ScoreDisplay(), + Expanded( + child: Center( + child: AspectRatio( + aspectRatio: 1, + child: GameWidget(game: board!), + ), + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + ElevatedButton( + onPressed: _restartGame, + child: const Text( + 'Restart', + style: TextStyle(color: Colors.black), + ), + ), + const SizedBox(width: 20), + ElevatedButton( + onPressed: () { + board?.showHint(); + }, + child: const Text( + 'Hint', + style: TextStyle(color: Colors.black), + ), + ), + ], + ), + const SizedBox(height: 50), + ], ), - const SizedBox(width: 20), - ElevatedButton( - onPressed: () { - board?.showHint(); - }, - child: const Text( - 'Hint', - style: TextStyle(color: Colors.black), + Positioned( + top: 16, + left: 16, + child: IconButton( + icon: const Icon(Icons.settings, + color: Colors.white), + onPressed: _showSettingsDialog, ), ), ], - ), - const SizedBox(height: 50), - ], - ), - Positioned( - top: 16, - left: 16, - child: IconButton( - icon: const Icon(Icons.settings, color: Colors.white), - onPressed: _showSettingsDialog, - ), - ), - ], + ); + } + } else { + return const Center(child: CircularProgressIndicator()); + } + }, ); } } else { diff --git a/lib/game/sprite_loader.dart b/lib/game/sprite_loader.dart index 7907be9..d1cb4ac 100644 --- a/lib/game/sprite_loader.dart +++ b/lib/game/sprite_loader.dart @@ -1,11 +1,15 @@ import 'package:flame/components.dart'; class SpriteLoader { - static Future> loadSprites() async { + static Future> loadCrystalSprites() async { List sprites = []; for (int i = 1; i <= 7; i++) { sprites.add(await Sprite.load('crystal$i.png')); } return sprites; } + + static Future loadMagicCubeSprite() async { + return Sprite.load('magic_cube.png'); + } } diff --git a/lib/game/swap_notifier.dart b/lib/game/swap_notifier.dart index 0c81db0..ad9c754 100644 --- a/lib/game/swap_notifier.dart +++ b/lib/game/swap_notifier.dart @@ -31,7 +31,7 @@ class SwapNotifier extends ChangeNotifier { selectedTile = tile; tile.select(); } else { - if (_isNeighbor(selectedTile!, tile)) { + if (_isNeighbor(selectedTile!, tile) || selectedTile!.isMagicCube) { notifyListeners(); } else { selectedTile?.deselect(); diff --git a/lib/game/tile.dart b/lib/game/tile.dart index 337f5c2..e607029 100644 --- a/lib/game/tile.dart +++ b/lib/game/tile.dart @@ -102,12 +102,10 @@ class Tile extends SpriteComponent with TapCallbacks, DragCallbacks { void animateMoveTo(Vector2 newPosition, VoidCallback onComplete) { isAnimating = true; - print('animation start'); add(MoveEffect.to( newPosition, EffectController(duration: 0.3), onComplete: () { - print('animation complete'); isAnimating = false; onComplete(); }, diff --git a/lib/utilities/audio_manager.dart b/lib/utilities/audio_manager.dart new file mode 100644 index 0000000..f495c3c --- /dev/null +++ b/lib/utilities/audio_manager.dart @@ -0,0 +1,23 @@ +import 'package:flame_audio/flame_audio.dart'; + +class AudioManager { + static Future load() async { + await FlameAudio.audioCache.loadAll([ + 'select.ogg', + 'four_elements.ogg', + 'explosion.ogg', + ]); + } + + static void playSelectSound() { + FlameAudio.play('select.ogg'); + } + + static void playFourElementsSound() { + FlameAudio.play('four_elements.ogg'); + } + + static void playExplosionSound() { + FlameAudio.play('explosion.ogg'); + } +} diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index e71a16d..1830e5c 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -6,6 +6,10 @@ #include "generated_plugin_registrant.h" +#include void fl_register_plugins(FlPluginRegistry* registry) { + g_autoptr(FlPluginRegistrar) audioplayers_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "AudioplayersLinuxPlugin"); + audioplayers_linux_plugin_register_with_registrar(audioplayers_linux_registrar); } diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 2e1de87..e9abb91 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + audioplayers_linux ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index cccf817..a9f2f23 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,6 +5,10 @@ import FlutterMacOS import Foundation +import audioplayers_darwin +import path_provider_foundation func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + AudioplayersDarwinPlugin.register(with: registry.registrar(forPlugin: "AudioplayersDarwinPlugin")) + PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) } diff --git a/pubspec.lock b/pubspec.lock index 80c8014..284de48 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -9,6 +9,62 @@ packages: url: "https://pub.dev" source: hosted version: "2.11.0" + audioplayers: + dependency: "direct main" + description: + name: audioplayers + sha256: c346ba5a39dc208f1bab55fc239855f573d69b0e832402114bf0b793622adc4d + url: "https://pub.dev" + source: hosted + version: "6.1.0" + audioplayers_android: + dependency: transitive + description: + name: audioplayers_android + sha256: de576b890befe27175c2f511ba8b742bec83765fa97c3ce4282bba46212f58e4 + url: "https://pub.dev" + source: hosted + version: "5.0.0" + audioplayers_darwin: + dependency: transitive + description: + name: audioplayers_darwin + sha256: e507887f3ff18d8e5a10a668d7bedc28206b12e10b98347797257c6ae1019c3b + url: "https://pub.dev" + source: hosted + version: "6.0.0" + audioplayers_linux: + dependency: transitive + description: + name: audioplayers_linux + sha256: "3d3d244c90436115417f170426ce768856d8fe4dfc5ed66a049d2890acfa82f9" + url: "https://pub.dev" + source: hosted + version: "4.0.0" + audioplayers_platform_interface: + dependency: transitive + description: + name: audioplayers_platform_interface + sha256: "6834dd48dfb7bc6c2404998ebdd161f79cd3774a7e6779e1348d54a3bfdcfaa5" + url: "https://pub.dev" + source: hosted + version: "7.0.0" + audioplayers_web: + dependency: transitive + description: + name: audioplayers_web + sha256: "3609bdf0e05e66a3d9750ee40b1e37f2a622c4edb796cc600b53a90a30a2ace4" + url: "https://pub.dev" + source: hosted + version: "5.0.1" + audioplayers_windows: + dependency: transitive + description: + name: audioplayers_windows + sha256: "8605762dddba992138d476f6a0c3afd9df30ac5b96039929063eceed416795c2" + url: "https://pub.dev" + source: hosted + version: "4.0.0" boolean_selector: dependency: transitive description: @@ -41,6 +97,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.18.0" + crypto: + dependency: transitive + description: + name: crypto + sha256: ec30d999af904f33454ba22ed9a86162b35e52b44ac4807d1d93c288041d7d27 + url: "https://pub.dev" + source: hosted + version: "3.0.5" cupertino_icons: dependency: "direct main" description: @@ -57,14 +121,46 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" + url: "https://pub.dev" + source: hosted + version: "2.1.3" + file: + dependency: transitive + description: + name: file + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + url: "https://pub.dev" + source: hosted + version: "7.0.0" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" flame: dependency: "direct main" description: name: flame - sha256: "79133dc46a3ff870950f41d0dc1598414e7bd7ae2c29bd9f0a9de208d9a70cb7" + sha256: e6873a8540a197a9bfe251e10c9e1f200329041d6e6d70df2cf38aa681cf2ef7 url: "https://pub.dev" source: hosted - version: "1.18.0" + version: "1.19.0" + flame_audio: + dependency: "direct main" + description: + name: flame_audio + sha256: a86839f1448bbf9e2cd9c5d396be8dfc745428a9d27db6dfcdd9680466d8370e + url: "https://pub.dev" + source: hosted + version: "2.10.3" flutter: dependency: "direct main" description: flutter @@ -83,6 +179,27 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + http: + dependency: transitive + description: + name: http + sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 + url: "https://pub.dev" + source: hosted + version: "1.2.2" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" leak_tracker: dependency: transitive description: @@ -151,10 +268,10 @@ packages: dependency: transitive description: name: ordered_set - sha256: "1bfaaaee0419e43ecc9eaebd410eb4bd5039657b72011de75ff3e2915c9aac60" + sha256: "984658d0c28c69516ed22f780db7511932a223339463a16c0cc48b3055e926c4" url: "https://pub.dev" source: hosted - version: "5.0.3" + version: "6.0.1" path: dependency: transitive description: @@ -163,6 +280,70 @@ packages: url: "https://pub.dev" source: hosted version: "1.9.0" + path_provider: + dependency: transitive + description: + name: path_provider + sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378 + url: "https://pub.dev" + source: hosted + version: "2.1.4" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "6f01f8e37ec30b07bc424b4deabac37cacb1bc7e2e515ad74486039918a37eb7" + url: "https://pub.dev" + source: hosted + version: "2.2.10" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16 + url: "https://pub.dev" + source: hosted + version: "2.4.0" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + platform: + dependency: transitive + description: + name: platform + sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" + url: "https://pub.dev" + source: hosted + version: "3.1.5" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" provider: dependency: "direct main" description: @@ -184,6 +365,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.10.0" + sprintf: + dependency: transitive + description: + name: sprintf + sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" + url: "https://pub.dev" + source: hosted + version: "7.0.0" stack_trace: dependency: transitive description: @@ -208,6 +397,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" + synchronized: + dependency: transitive + description: + name: synchronized + sha256: "539ef412b170d65ecdafd780f924e5be3f60032a1128df156adad6c5b373d558" + url: "https://pub.dev" + source: hosted + version: "3.1.0+1" term_glyph: dependency: transitive description: @@ -224,6 +421,22 @@ packages: url: "https://pub.dev" source: hosted version: "0.7.0" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" + uuid: + dependency: transitive + description: + name: uuid + sha256: f33d6bb662f0e4f79dcd7ada2e6170f3b3a2530c28fc41f49a411ddedd576a77 + url: "https://pub.dev" + source: hosted + version: "4.5.0" vector_math: dependency: transitive description: @@ -240,6 +453,22 @@ packages: url: "https://pub.dev" source: hosted version: "14.2.1" + web: + dependency: transitive + description: + name: web + sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062 + url: "https://pub.dev" + source: hosted + version: "1.0.0" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d + url: "https://pub.dev" + source: hosted + version: "1.0.4" sdks: dart: ">=3.4.3 <4.0.0" flutter: ">=3.22.0" diff --git a/pubspec.yaml b/pubspec.yaml index 8c02ca0..c992ecf 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -37,6 +37,8 @@ dependencies: # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.6 flame: ^1.18.0 + audioplayers: ^6.1.0 + flame_audio: ^2.10.3 dev_dependencies: flutter_test: @@ -69,6 +71,11 @@ flutter: - assets/images/crystal5.png - assets/images/crystal6.png - assets/images/crystal7.png + - assets/images/magic_cube.png + - assets/audio/explosion.ogg + - assets/audio/four_elements.ogg + - assets/audio/select.ogg + # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 8b6d468..09e8e2c 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -6,6 +6,9 @@ #include "generated_plugin_registrant.h" +#include void RegisterPlugins(flutter::PluginRegistry* registry) { + AudioplayersWindowsPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("AudioplayersWindowsPlugin")); } diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index b93c4c3..375535c 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + audioplayers_windows ) list(APPEND FLUTTER_FFI_PLUGIN_LIST