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

Unified Diff: samples/pop_pop_win/lib/src/stage/score_element.dart

Issue 242443008: samples/pop_pop_win: now based on StageXL (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: added Alex to authors Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: samples/pop_pop_win/lib/src/stage/score_element.dart
diff --git a/samples/pop_pop_win/lib/src/stage/score_element.dart b/samples/pop_pop_win/lib/src/stage/score_element.dart
new file mode 100644
index 0000000000000000000000000000000000000000..5ea9eb9602abe674f1b2945c73c41b51ff320fd3
--- /dev/null
+++ b/samples/pop_pop_win/lib/src/stage/score_element.dart
@@ -0,0 +1,30 @@
+library pop_pop_win.stage.score_element;
+
+import 'package:stagexl/stagexl.dart';
+
+import '../game.dart';
Siggi Cherem (dart-lang) 2014/04/21 22:00:56 ..
kevmoo 2014/04/21 22:22:54 Done.
+import 'game_element.dart';
+
+class ScoreElement extends TextField implements Animatable {
+
+ int bestTime;
+
+ ScoreElement(this.bestTime) {
+ defaultTextFormat = new TextFormat('Slackey, cursive', 28, Color.Black, leading: 1);
Siggi Cherem (dart-lang) 2014/04/21 22:00:56 80
kevmoo 2014/04/21 22:22:54 Done.
+ autoSize = TextFieldAutoSize.LEFT;
+ x = 1400;
+ y = 20;
+ }
+
+ bool advanceTime(num time) {
+ var time = (game.duration == null) ?
Siggi Cherem (dart-lang) 2014/04/21 22:00:56 << (indent -2)
kevmoo 2014/04/21 22:22:54 Done.
+ '0' : (game.duration.inMilliseconds / 1000) .toStringAsFixed(1);
+ text = 'Bombs Left: ${game.bombsLeft}\nTime: $time';
+ if (bestTime > 0) {
+ text = text + '\nRecord: ${(bestTime/1000).toStringAsFixed(1)}';
+ }
+ return true;
+ }
+
+ Game get game => (parent as GameElement).manager.game;
+}

Powered by Google App Engine
This is Rietveld 408576698