diff --git a/lib/deathmatch_state.dart b/lib/deathmatch_state.dart index 1944066..8727489 100644 --- a/lib/deathmatch_state.dart +++ b/lib/deathmatch_state.dart @@ -91,15 +91,7 @@ abstract class _DeathmatchState with Store { stopwatch.reset(); score += 1; matchTimer.cancel(); - matchTimer = Timer.periodic(Duration(seconds: 1), (Timer _timeout) { - timerTick(); - if (mainTimer == 0) { - _timeout.cancel(); - audioPlayer.play('round_start_timer_timeout.wav', - mode: PlayerMode.LOW_LATENCY); - setState('score'); - } - }); + resetMatchTimer(); if (score % 5 == 0) { bool decreaseAdditionalTime; if (additionalTime == 0) { @@ -175,24 +167,7 @@ abstract class _DeathmatchState with Store { mode: PlayerMode.LOW_LATENCY); setState('main'); word = dictionary.getWords(1, difficulty, 5)[0]; - matchTimer = Timer.periodic(Duration(seconds: 1), (Timer _timeout) { - timerTick(); - if (mainTimer == 0) { - _timeout.cancel(); - audioPlayer.play('round_start_timer_timeout.wav', - mode: PlayerMode.LOW_LATENCY); - gameLog['end_timestamp'] = DateTime.now().millisecondsSinceEpoch; - gameLog['attempts'].add({ - 'from': 0, - 'to': 1, - 'word': word, - 'time': stopwatch.elapsedMilliseconds, - 'extra_time': 0 - }); - stopwatch.stop(); - setState('score'); - } - }); + resetMatchTimer(); } @observable @@ -223,4 +198,28 @@ abstract class _DeathmatchState with Store { } }); } + + @action + void resetMatchTimer() { + matchTimer = Timer.periodic(Duration(seconds: 1), (Timer _timeout) { + timerTick(); + if (mainTimer == 0) { + _timeout.cancel(); + audioPlayer.play('round_start_timer_timeout.wav', + mode: PlayerMode.LOW_LATENCY); + gameLog['end_timestamp'] = DateTime + .now() + .millisecondsSinceEpoch; + gameLog['attempts'].add({ + 'from': 0, + 'to': 1, + 'word': word, + 'time': stopwatch.elapsedMilliseconds, + 'extra_time': 0 + }); + stopwatch.stop(); + setState('score'); + } + }); + } } diff --git a/pubspec.lock b/pubspec.lock index 395b168..bb48e2e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,49 +7,49 @@ packages: name: _fe_analyzer_shared url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "3.0.0" analyzer: dependency: transitive description: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "0.39.2+1" + version: "0.39.8" archive: dependency: transitive description: name: archive url: "https://pub.dartlang.org" source: hosted - version: "2.0.11" + version: "2.0.13" args: dependency: transitive description: name: args url: "https://pub.dartlang.org" source: hosted - version: "1.5.2" + version: "1.6.0" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.0" + version: "2.4.1" audioplayers: dependency: "direct main" description: name: audioplayers url: "https://pub.dartlang.org" source: hosted - version: "0.13.6" + version: "0.13.7" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "2.0.0" build: dependency: transitive description: @@ -63,35 +63,35 @@ packages: name: build_config url: "https://pub.dartlang.org" source: hosted - version: "0.4.1+1" + version: "0.4.2" build_daemon: dependency: transitive description: name: build_daemon url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.4" build_resolvers: dependency: transitive description: name: build_resolvers url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.3.7" build_runner: dependency: "direct dev" description: name: build_runner url: "https://pub.dartlang.org" source: hosted - version: "1.7.2" + version: "1.9.0" build_runner_core: dependency: transitive description: name: build_runner_core url: "https://pub.dartlang.org" source: hosted - version: "4.3.0" + version: "5.1.0" built_collection: dependency: transitive description: @@ -105,14 +105,14 @@ packages: name: built_value url: "https://pub.dartlang.org" source: hosted - version: "7.0.4" + version: "7.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.1.3" checked_yaml: dependency: transitive description: @@ -120,6 +120,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.2" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" code_builder: dependency: transitive description: @@ -133,7 +140,7 @@ packages: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.11" + version: "1.14.12" convert: dependency: transitive description: @@ -147,7 +154,7 @@ packages: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "2.1.3" + version: "2.1.4" csslib: dependency: transitive description: @@ -168,7 +175,14 @@ packages: name: dart_style url: "https://pub.dartlang.org" source: hosted - version: "1.3.3" + version: "1.3.6" + file: + dependency: transitive + description: + name: file + url: "https://pub.dartlang.org" + source: hosted + version: "5.1.0" fixnum: dependency: transitive description: @@ -187,21 +201,21 @@ packages: name: flutter_cache_manager url: "https://pub.dartlang.org" source: hosted - version: "1.1.3" + version: "1.2.2" flutter_launcher_icons: dependency: "direct dev" description: name: flutter_launcher_icons url: "https://pub.dartlang.org" source: hosted - version: "0.7.4" + version: "0.7.5" flutter_mobx: dependency: "direct main" description: name: flutter_mobx url: "https://pub.dartlang.org" source: hosted - version: "0.3.6" + version: "0.3.7" flutter_test: dependency: "direct dev" description: flutter @@ -239,42 +253,42 @@ packages: name: http url: "https://pub.dartlang.org" source: hosted - version: "0.12.0+3" + version: "0.12.1" http_multi_server: dependency: transitive description: name: http_multi_server url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.2.0" http_parser: dependency: transitive description: name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "3.1.3" + version: "3.1.4" image: dependency: transitive description: name: image url: "https://pub.dartlang.org" source: hosted - version: "2.1.4" + version: "2.1.12" intl: dependency: "direct main" description: name: intl url: "https://pub.dartlang.org" source: hosted - version: "0.16.0" + version: "0.16.1" io: dependency: transitive description: name: io url: "https://pub.dartlang.org" source: hosted - version: "0.3.3" + version: "0.3.4" js: dependency: transitive description: @@ -302,7 +316,7 @@ packages: name: logging url: "https://pub.dartlang.org" source: hosted - version: "0.11.3+2" + version: "0.11.4" marquee: dependency: "direct main" description: @@ -337,7 +351,7 @@ packages: name: mobx url: "https://pub.dartlang.org" source: hosted - version: "0.4.0+1" + version: "0.4.0+4" mobx_codegen: dependency: "direct main" description: @@ -379,14 +393,7 @@ packages: name: package_config url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" - package_resolver: - dependency: transitive - description: - name: package_resolver - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.10" + version: "1.9.3" path: dependency: transitive description: @@ -414,14 +421,28 @@ packages: name: path_provider url: "https://pub.dartlang.org" source: hosted - version: "1.5.1" + version: "1.6.7" + path_provider_macos: + dependency: transitive + description: + name: path_provider_macos + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.4+2" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" pedantic: dependency: transitive description: name: pedantic url: "https://pub.dartlang.org" source: hosted - version: "1.8.0+1" + version: "1.9.0" petitparser: dependency: transitive description: @@ -442,7 +463,7 @@ packages: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.0.2" pool: dependency: transitive description: @@ -456,14 +477,14 @@ packages: name: provider url: "https://pub.dartlang.org" source: hosted - version: "4.0.1" + version: "4.1.0" pub_semver: dependency: transitive description: name: pub_semver url: "https://pub.dartlang.org" source: hosted - version: "1.4.2" + version: "1.4.4" pubspec_parse: dependency: transitive description: @@ -477,49 +498,56 @@ packages: name: quiver url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.1.3" + rxdart: + dependency: transitive + description: + name: rxdart + url: "https://pub.dartlang.org" + source: hosted + version: "0.24.0" sentry: dependency: "direct main" description: name: sentry url: "https://pub.dartlang.org" source: hosted - version: "3.0.0+1" + version: "3.0.1" share: dependency: "direct main" description: name: share url: "https://pub.dartlang.org" source: hosted - version: "0.6.3+5" + version: "0.6.4+1" shared_preferences: dependency: "direct main" description: name: shared_preferences url: "https://pub.dartlang.org" source: hosted - version: "0.5.6" + version: "0.5.7+1" shared_preferences_macos: dependency: transitive description: name: shared_preferences_macos url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+3" + version: "0.0.1+8" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.0.3" shared_preferences_web: dependency: transitive description: name: shared_preferences_web url: "https://pub.dartlang.org" source: hosted - version: "0.1.2+2" + version: "0.1.2+5" shelf: dependency: transitive description: @@ -545,21 +573,28 @@ packages: name: source_gen url: "https://pub.dartlang.org" source: hosted - version: "0.9.4+7" + version: "0.9.5" source_span: dependency: transitive description: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.7.0" sqflite: dependency: transitive description: name: sqflite url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0+1" + sqflite_common: + dependency: transitive + description: + name: sqflite_common + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" stack_trace: dependency: transitive description: @@ -580,7 +615,7 @@ packages: name: stream_transform url: "https://pub.dartlang.org" source: hosted - version: "0.0.20" + version: "1.2.0" string_scanner: dependency: transitive description: @@ -594,7 +629,7 @@ packages: name: synchronized url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "2.2.0" term_glyph: dependency: transitive description: @@ -608,7 +643,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.11" + version: "0.2.15" timing: dependency: transitive description: @@ -629,28 +664,28 @@ packages: name: url_launcher url: "https://pub.dartlang.org" source: hosted - version: "5.4.1" + version: "5.4.5" url_launcher_macos: dependency: transitive description: name: url_launcher_macos url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+2" + version: "0.0.1+5" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.0.6" url_launcher_web: dependency: transitive description: name: url_launcher_web url: "https://pub.dartlang.org" source: hosted - version: "0.1.0+2" + version: "0.1.1+4" usage: dependency: transitive description: @@ -678,7 +713,7 @@ packages: name: watcher url: "https://pub.dartlang.org" source: hosted - version: "0.9.7+13" + version: "0.9.7+15" web_socket_channel: dependency: transitive description: @@ -692,14 +727,14 @@ packages: name: xml url: "https://pub.dartlang.org" source: hosted - version: "3.5.0" + version: "3.6.1" yaml: dependency: transitive description: name: yaml url: "https://pub.dartlang.org" source: hosted - version: "2.2.0" + version: "2.2.1" sdks: dart: ">=2.7.0 <3.0.0" - flutter: ">=1.12.13+hotfix.4 <2.0.0" + flutter: ">=1.17.0 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index a00d068..6868071 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: beret -description: A new Flutter project. +description: The Hat game. # The following defines the version and build number for your application. # A version number is three numbers separated by dots, like 1.2.43