changeset 562:80725d647569

Neaten up gameover screen.
author Simon Cross <hodgestar@gmail.com>
date Sat, 28 Nov 2009 18:42:39 +0000
parents 7f037ee2a6c8
children 06f2f965ea4f
files gamelib/gameover.py
diffstat 1 files changed, 26 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/gamelib/gameover.py	Sat Nov 28 18:40:04 2009 +0000
+++ b/gamelib/gameover.py	Sat Nov 28 18:42:39 2009 +0000
@@ -96,7 +96,6 @@
                 level.sell_price_chicken * len(gameboard.chickens) + \
                 level.sell_price_egg * gameboard.eggs
 
-        self.tr()
         made_list = scoreboard.check(score) is not None
         if level.is_game_over(gameboard):
             if len(gameboard.chickens) > 0:
@@ -109,20 +108,38 @@
         else:
             self.survived = LEFT
             message = random.choice(LEFT_MESSAGES)
+
+        self.tr()
         self.td(gui.Label(message, color=constants.FG_COLOR),
                 colspan=3)
         self.add_spacer()
+
+        # heading options
+        head_kwargs = {
+            'color': constants.FG_COLOR,
+            'style': {
+                'padding_top': 10,
+                'padding_bottom': 5,
+            },
+        }
+
         # show the scoreboard
 
         self.tr()
-        self.td(gui.Label('Level: %s' % level.level_name, color=constants.FG_COLOR),
-                colspan=3)
+        self.td(html.HTML('<b>High Scores for Level<i>%s:</i></b>'
+            % level.level_name, **head_kwargs),
+            colspan=3)
 
         for highscore in scoreboard:
             self.tr()
             self.td(gui.Label(highscore.name, color=constants.FG_COLOR), colspan=2)
             self.td(gui.Label('%d' % highscore.score, color=constants.FG_COLOR))
 
+        # show player score
+
+        self.tr()
+        self.td(html.HTML('<b>Your Score:</b>', **head_kwargs), colspan=3)
+
         self.tr()
         self.td(gui.Label("Groats : %d" % gameboard.cash,
             color=constants.FG_COLOR))
@@ -138,15 +155,16 @@
         self.tr()
         self.td(gui.Label("Final score : %d" % score,
             color=constants.FG_COLOR), colspan=3)
+
         if made_list:
-            scoreboard.save()
             self.tr()
             if self.survived == WON:
-                self.td(gui.Label("You made the high scores",
-                    color=constants.FG_COLOR), colspan=3)
+                msg = "You made the high scores!"
+                scoreboard.save()
             else:
-                self.td(gui.Label("Pity, you could have made the high scores",
-                    color=constants.FG_COLOR), colspan=3)
+                msg = "Pity, you could have made the high scores."
+            self.td(html.HTML("<b>%s</b>" % msg, **head_kwargs)
+                , colspan=3)
 
         self.add_spacer(50)