| Index: samples/pop_pop_win/lib/src/audio.dart
|
| diff --git a/samples/pop_pop_win/lib/src/audio.dart b/samples/pop_pop_win/lib/src/audio.dart
|
| deleted file mode 100644
|
| index 8c52e1b0d876590014c6245efd286baaf63e535d..0000000000000000000000000000000000000000
|
| --- a/samples/pop_pop_win/lib/src/audio.dart
|
| +++ /dev/null
|
| @@ -1,56 +0,0 @@
|
| -// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
|
| -// for details. All rights reserved. Use of this source code is governed by a
|
| -// BSD-style license that can be found in the LICENSE file.
|
| -library pop_pop_win.audio;
|
| -
|
| -import 'dart:math';
|
| -
|
| -import 'package:stagexl/stagexl.dart';
|
| -
|
| -class GameAudio {
|
| - static final Random _rnd = new Random();
|
| -
|
| - static ResourceManager _resourceManager;
|
| -
|
| - static const String _WIN = 'win',
|
| - _CLICK = 'click',
|
| - _POP = 'Pop',
|
| - _FLAG = 'flag',
|
| - _UNFLAG = 'unflag',
|
| - _BOMB = 'Bomb',
|
| - _THROW_DART = 'throw';
|
| -
|
| - static void initialize(ResourceManager resourceManager) {
|
| - if (_resourceManager != null) throw new StateError('already initialized');
|
| - _resourceManager = resourceManager;
|
| - }
|
| -
|
| - static void win() => _playAudio(_WIN);
|
| -
|
| - static void click() => _playAudio(_CLICK);
|
| -
|
| - static void pop() => _playAudio(_POP);
|
| -
|
| - static void flag() => _playAudio(_FLAG);
|
| -
|
| - static void unflag() => _playAudio(_UNFLAG);
|
| -
|
| - static void bomb() => _playAudio(_BOMB);
|
| -
|
| - static void throwDart() => _playAudio(_THROW_DART);
|
| -
|
| - static void _playAudio(String name) {
|
| - if (_resourceManager == null) throw new StateError('Not initialized');
|
| - switch (name) {
|
| - case GameAudio._POP:
|
| - var i = _rnd.nextInt(8);
|
| - name = '${GameAudio._POP}$i';
|
| - break;
|
| - case GameAudio._BOMB:
|
| - var i = _rnd.nextInt(4);
|
| - name = '${GameAudio._BOMB}$i';
|
| - break;
|
| - }
|
| - _resourceManager.getSoundSprite('audio').play(name);
|
| - }
|
| -}
|
|
|