| OLD | NEW |
| 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 /** A local player (API known to the main isolate when creating players). */ | 5 /** A local player (API known to the main isolate when creating players). */ |
| 6 interface Player default PlayerImpl { | 6 abstract class Player { |
| 7 | 7 |
| 8 Player(); | 8 factory Player() = PlayerImpl; |
| 9 | 9 |
| 10 final Future<SendPort> portToPlayer; | 10 final Future<SendPort> portToPlayer; |
| 11 | 11 |
| 12 void setup(Window window, int player); | 12 void setup(Window window, int player); |
| 13 | 13 |
| 14 void set enemy(SendPort portToEnemy); | 14 void set enemy(SendPort portToEnemy); |
| 15 | 15 |
| 16 void set _portForTest(SendPort testPort); | 16 void set _portForTest(SendPort testPort); |
| 17 } | 17 } |
| 18 | 18 |
| 19 /** A remote enemy (API visible to a player to communicate with the enemy). */ | 19 /** A remote enemy (API visible to a player to communicate with the enemy). */ |
| 20 interface Enemy default EnemyImpl { | 20 abstract class Enemy { |
| 21 Enemy(SendPort port); | 21 factory Enemy(SendPort port) = EnemyImpl; |
| 22 | 22 |
| 23 /** tell the enemy that we are ready, receive confirmation asynchronously. */ | 23 /** tell the enemy that we are ready, receive confirmation asynchronously. */ |
| 24 Future<int> ready(); | 24 Future<int> ready(); |
| 25 | 25 |
| 26 /** shoot asynchronously. */ | 26 /** shoot asynchronously. */ |
| 27 Future<int> shoot(int x, int y); | 27 Future<int> shoot(int x, int y); |
| 28 } | 28 } |
| 29 | 29 |
| 30 | 30 |
| 31 /** | 31 /** |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 /** message indicating that the enemy is ready to play. */ | 99 /** message indicating that the enemy is ready to play. */ |
| 100 static const ENEMY_IS_READY = 3; | 100 static const ENEMY_IS_READY = 3; |
| 101 | 101 |
| 102 /** message describing a shoot action. */ | 102 /** message describing a shoot action. */ |
| 103 static const SHOOT = 4; | 103 static const SHOOT = 4; |
| 104 | 104 |
| 105 /** message to set up a test port, used to make tests non-flaky. */ | 105 /** message to set up a test port, used to make tests non-flaky. */ |
| 106 static const SET_PORT_FOR_TEST = 5; | 106 static const SET_PORT_FOR_TEST = 5; |
| 107 } | 107 } |
| OLD | NEW |