| Index: samples/dartcombat/state.dart
|
| diff --git a/samples/dartcombat/state.dart b/samples/dartcombat/state.dart
|
| index c215cc0117fbbf2550c7d47ef1e2155bc20fab2d..0d0186c8ce76c0fd3df551a1f4b430c3a3cd766c 100644
|
| --- a/samples/dartcombat/state.dart
|
| +++ b/samples/dartcombat/state.dart
|
| @@ -1,7 +1,12 @@
|
| -// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
|
| +// Copyright (c) 2012, 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.
|
|
|
| +void spawnPlayer() {
|
| + PlayerState state = new PlayerState();
|
| + port.receive(state.dispatch);
|
| +}
|
| +
|
| /**
|
| * Stores the actual data on a player's boat grid, the UI representation for its
|
| * grid and the status of each shot. Acts as a controller handling isolate
|
| @@ -9,7 +14,7 @@
|
| * events.
|
| */
|
| // TODO(sigmund): move UI setup out of here, e.g. into a controller class.
|
| -class PlayerState extends Isolate {
|
| +class PlayerState {
|
|
|
| /** internal id for this player. */
|
| int _id;
|
| @@ -47,15 +52,6 @@ class PlayerState extends Isolate {
|
| /** Port used for testing purposes. */
|
| SendPort _portForTest;
|
|
|
| - // This can take no arguments for now (wait for isolate redesign).
|
| - PlayerState() : super.light() {}
|
| -
|
| - void main() {
|
| - this.port.receive((message, SendPort replyTo) {
|
| - dispatch(message, replyTo);
|
| - });
|
| - }
|
| -
|
| /** dispatches all messages that are expected in this isolate. */
|
| void dispatch(var message, SendPort replyTo) {
|
| int action = message['action'];
|
|
|