Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Side by Side Diff: samples/dartcombat/state.dart

Issue 11865005: Remove Futures class, move methods to Future. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/intl/test/date_time_format_local_test_stub.dart ('k') | samples/solar3d/web/solar.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dartcombatlib; 5 part of dartcombatlib;
6 6
7 void spawnPlayer() { 7 void spawnPlayer() {
8 PlayerState state = new PlayerState(); 8 PlayerState state = new PlayerState();
9 port.receive(state.dispatch); 9 port.receive(state.dispatch);
10 } 10 }
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 static const DOWN_DIR = const [0, 1]; 181 static const DOWN_DIR = const [0, 1];
182 182
183 Future<bool> _exploreAllDirections(int x, int y, bool parallel) { 183 Future<bool> _exploreAllDirections(int x, int y, bool parallel) {
184 Completer<bool> superShot_ = new Completer<bool>(); 184 Completer<bool> superShot_ = new Completer<bool>();
185 if (parallel) { 185 if (parallel) {
186 final arr = new List<Future<bool>>(); 186 final arr = new List<Future<bool>>();
187 arr.add(_exploreDirectionHelper(LEFT_DIR, x, y)); 187 arr.add(_exploreDirectionHelper(LEFT_DIR, x, y));
188 arr.add(_exploreDirectionHelper(RIGHT_DIR, x, y)); 188 arr.add(_exploreDirectionHelper(RIGHT_DIR, x, y));
189 arr.add(_exploreDirectionHelper(UP_DIR, x, y)); 189 arr.add(_exploreDirectionHelper(UP_DIR, x, y));
190 arr.add(_exploreDirectionHelper(DOWN_DIR, x, y)); 190 arr.add(_exploreDirectionHelper(DOWN_DIR, x, y));
191 Futures.wait(arr).then((arrValues) { 191 Future.wait(arr).then((arrValues) {
192 superShot_.complete(true); 192 superShot_.complete(true);
193 }); 193 });
194 } else { 194 } else {
195 _seqExploreDirectionHelper(LEFT_DIR, x, y, superShot_, 195 _seqExploreDirectionHelper(LEFT_DIR, x, y, superShot_,
196 _seqExploreDirectionHelper(RIGHT_DIR, x, y, superShot_, 196 _seqExploreDirectionHelper(RIGHT_DIR, x, y, superShot_,
197 _seqExploreDirectionHelper(UP_DIR, x, y, superShot_, 197 _seqExploreDirectionHelper(UP_DIR, x, y, superShot_,
198 _seqExploreDirectionHelper(DOWN_DIR, x, y, superShot_, null))))(fa lse); 198 _seqExploreDirectionHelper(DOWN_DIR, x, y, superShot_, null))))(fa lse);
199 } 199 }
200 return superShot_.future; 200 return superShot_.future;
201 } 201 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 case Constants.SUNK: 296 case Constants.SUNK:
297 totalHits++; 297 totalHits++;
298 boatsSunk++; 298 boatsSunk++;
299 _enemyView.addHit(x, y); 299 _enemyView.addHit(x, y);
300 enemyGrid.hit(x, y); 300 enemyGrid.hit(x, y);
301 break; 301 break;
302 } 302 }
303 _enemyView.statusBar.updateStatus(); 303 _enemyView.statusBar.updateStatus();
304 } 304 }
305 } 305 }
OLDNEW
« no previous file with comments | « pkg/intl/test/date_time_format_local_test_stub.dart ('k') | samples/solar3d/web/solar.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698