diff gamelib/state.py @ 443:3dab4984cbd7

Redo way of reaching end screen
author Neil Muller <neil@dip.sun.ac.za>
date Sun, 29 Aug 2010 00:24:40 +0200
parents 19aff54b2e73
children af2a23b9787d
line wrap: on
line diff
--- a/gamelib/state.py	Sun Aug 29 00:01:14 2010 +0200
+++ b/gamelib/state.py	Sun Aug 29 00:24:40 2010 +0200
@@ -18,7 +18,7 @@
 class Result(object):
     """Result of interacting with a thing"""
 
-    def __init__(self, message=None, soundfile=None, detail_view=None, style=None, close_detail=False):
+    def __init__(self, message=None, soundfile=None, detail_view=None, style=None, close_detail=False, end_game=False):
         self.message = message
         self.sound = None
         if soundfile:
@@ -26,6 +26,7 @@
         self.detail_view = detail_view
         self.style = style
         self.close_detail = close_detail
+        self.end_game = end_game
 
     def process(self, scene_widget):
         """Helper function to do the right thing with a result object"""
@@ -37,6 +38,8 @@
             scene_widget.show_detail(self.detail_view)
         if self.close_detail and hasattr(scene_widget, 'parent') and hasattr(scene_widget.parent, 'clear_detail'):
             scene_widget.parent.clear_detail()
+        if self.end_game:
+            scene_widget.end_game()
 
 
 def handle_result(result, scene_widget):