Ignore:
Timestamp:
Sep 5, 2009, 7:26:01 PM (11 years ago)
Author:
Neil Muller <drnlmuller@…>
Branch:
default
Convert:
svn:b4e93282-eac8-4b8b-b765-0f5d36de2b68@321
Message:

Switch between 'Finished Day' and 'Fast Forward' modes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gamelib/gameboard.py

    r316 r320  
    1717import sprite_cursor
    1818import misc
     19import engine
    1920
    2021class OpaqueLabel(gui.Label):
     
    116117        self.add_spacer(20)
    117118
    118         self.add_tool("Finished Day", self.day_done)
     119        self.fin_tool = self.add_tool("Finished Day", self.day_done)
    119120
    120121        self.anim_clear_tool = False # Flag to clear the tool on an anim loop
     
    124125
    125126    def day_done(self):
    126         import engine
    127         pygame.event.post(engine.START_NIGHT)
     127        if self.gameboard.day:
     128            pygame.event.post(engine.START_NIGHT)
     129        else:
     130            self.anim_clear_tool = True
     131            pygame.event.post(engine.FAST_FORWARD)
     132
     133    def update_fin_tool(self, day):
     134        if day:
     135            self.fin_tool.widget = gui.basic.Label('Finished Day')
     136            self.fin_tool.resize()
     137        else:
     138            self.fin_tool.widget = gui.basic.Label('Fast Forward')
     139            self.fin_tool.resize()
    128140
    129141    def show_prices(self):
     
    211223        self.tr()
    212224        self.td(tool, align=-1, colspan=2)
     225        return tool
    213226
    214227    def clear_tool(self):
     
    387400        self.tv.sun(False)
    388401        self.reset_states()
     402        self.toolbar.update_fin_tool(self.day)
    389403
    390404    def start_day(self):
     
    392406        self.tv.sun(True)
    393407        self.reset_states()
     408        self.toolbar.update_fin_tool(self.day)
    394409
    395410    def in_bounds(self, pos):
Note: See TracChangeset for help on using the changeset viewer.