| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 /** Entrypoint to set up the dartcombat sample. */ | 5 /** Entrypoint to set up the dartcombat sample. */ |
| 6 void setUpGame() { | 6 void setUpGame() { |
| 7 setupUI(); | 7 setupUI(); |
| 8 createPlayers(); | 8 createPlayers(); |
| 9 } | 9 } |
| 10 | 10 |
| 11 /** Sets up the UI creating the board for each player. */ | 11 /** Sets up the UI creating the board for each player. */ |
| 12 void setupUI() { | 12 void setupUI() { |
| 13 // Note: we set up the UI programatically to make testing easier. | 13 // Note: we set up the UI programatically to make testing easier. |
| 14 var div = document.createElement("div"); | 14 var div = new Element.tag("div"); |
| 15 div.innerHTML = """ | 15 div.innerHTML = """ |
| 16 <div class='hbox'> | 16 <div class='hbox'> |
| 17 <div class='vbox'> | 17 <div class='vbox'> |
| 18 Player 1 board: | 18 Player 1 board: |
| 19 <div class='own' id='p1own'></div> | 19 <div class='own' id='p1own'></div> |
| 20 Known of enemy's board: | 20 Known of enemy's board: |
| 21 <div class='enemy' id='p1enemy'></div> | 21 <div class='enemy' id='p1enemy'></div> |
| 22 </div> | 22 </div> |
| 23 <div style='width:20%'></div> | 23 <div style='width:20%'></div> |
| 24 <div class='vbox'> | 24 <div class='vbox'> |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 _target.send(message, reply); | 89 _target.send(message, reply); |
| 90 } | 90 } |
| 91 }, 200); | 91 }, 200); |
| 92 }); | 92 }); |
| 93 } | 93 } |
| 94 | 94 |
| 95 // TODO(sigmund): introduce UI to control flakiness, then do: | 95 // TODO(sigmund): introduce UI to control flakiness, then do: |
| 96 // => Math.random() > 0.9; | 96 // => Math.random() > 0.9; |
| 97 bool randomlyFail() => false; | 97 bool randomlyFail() => false; |
| 98 } | 98 } |
| OLD | NEW |