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 /** 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 = new Element.tag("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'> |
25 Player 2 board: | 25 Player 2 board: |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 _target.send(message, reply); | 85 _target.send(message, reply); |
86 } | 86 } |
87 }, 200); | 87 }, 200); |
88 }); | 88 }); |
89 } | 89 } |
90 | 90 |
91 // TODO(sigmund): introduce UI to control flakiness, then do: | 91 // TODO(sigmund): introduce UI to control flakiness, then do: |
92 // => Math.random() > 0.9; | 92 // => Math.random() > 0.9; |
93 bool randomlyFail() => false; | 93 bool randomlyFail() => false; |
94 } | 94 } |
OLD | NEW |