Mercurial > rinkhals
comparison gamelib/gameboard.py @ 68:6b8ac424da83
Add button for finishing day. Remove debugging print.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Mon, 31 Aug 2009 21:41:34 +0000 |
parents | 9171d9b9ab35 |
children | 18db99fda6bd |
comparison
equal
deleted
inserted
replaced
67:9171d9b9ab35 | 68:6b8ac424da83 |
---|---|
31 self.add_tool_button("Sell building", constants.TOOL_SELL_BUILDING) | 31 self.add_tool_button("Sell building", constants.TOOL_SELL_BUILDING) |
32 self.add_tool_button("Buy fence", constants.TOOL_BUY_FENCE) | 32 self.add_tool_button("Buy fence", constants.TOOL_BUY_FENCE) |
33 for building_cls in buildings.BUILDINGS: | 33 for building_cls in buildings.BUILDINGS: |
34 self.add_tool_button("Buy %s" % (building_cls.NAME,), building_cls) | 34 self.add_tool_button("Buy %s" % (building_cls.NAME,), building_cls) |
35 | 35 |
36 day_done_button = gui.Button("Finished Day") | |
37 day_done_button.connect(gui.CLICK, self.day_done) | |
38 self.tr() | |
39 self.td(day_done_button, style={"padding_top": 30}) | |
40 | |
41 def day_done(self): | |
42 import engine | |
43 pygame.event.post(engine.START_NIGHT) | |
44 | |
36 def update_cash_counter(self, amount): | 45 def update_cash_counter(self, amount): |
37 self.cash_counter.update_value("Groats: %s" % amount) | 46 self.cash_counter.update_value("Groats: %s" % amount) |
38 self.repaint() | 47 self.repaint() |
39 | 48 |
40 def add_tool_button(self, text, tool): | 49 def add_tool_button(self, text, tool): |
244 to the top left corner. | 253 to the top left corner. |
245 | 254 |
246 Could be a lot faster. | 255 Could be a lot faster. |
247 """ | 256 """ |
248 tile_to_building = dict((b.TILE_NO, b) for b in buildings.BUILDINGS) | 257 tile_to_building = dict((b.TILE_NO, b) for b in buildings.BUILDINGS) |
249 print tile_to_building | |
250 | 258 |
251 w, h = self.tv.size | 259 w, h = self.tv.size |
252 for x in xrange(w): | 260 for x in xrange(w): |
253 for y in xrange(h): | 261 for y in xrange(h): |
254 tile_pos = (x, y) | 262 tile_pos = (x, y) |