Mercurial > rinkhals
comparison gamelib/gameboard.py @ 270:31f5033eac70
Add prices to all tools where is makes sense to do so.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Sat, 05 Sep 2009 14:09:44 +0000 |
parents | 812bd4cda8b8 |
children | cade64404997 |
comparison
equal
deleted
inserted
replaced
269:445f746449fa | 270:31f5033eac70 |
---|---|
77 self.add_counter(icons.CHKN_ICON, self.chicken_counter) | 77 self.add_counter(icons.CHKN_ICON, self.chicken_counter) |
78 self.add_counter(icons.KILLED_FOX, self.killed_foxes) | 78 self.add_counter(icons.KILLED_FOX, self.killed_foxes) |
79 self.add_spacer(20) | 79 self.add_spacer(20) |
80 | 80 |
81 self.add_tool_button("Move Hen", constants.TOOL_PLACE_ANIMALS, | 81 self.add_tool_button("Move Hen", constants.TOOL_PLACE_ANIMALS, |
82 cursors.cursors['select']) | 82 None, cursors.cursors['select']) |
83 self.add_tool_button("Cut Trees", constants.TOOL_LOGGING) | 83 self.add_tool_button("Cut Trees", constants.TOOL_LOGGING, |
84 constants.LOGGING_PRICE) | |
84 self.add_spacer(20) | 85 self.add_spacer(20) |
85 | 86 |
86 self.add_heading("Sell ...") | 87 self.add_heading("Sell ...") |
87 self.add_tool_button("Chicken", constants.TOOL_SELL_CHICKEN, | 88 self.add_tool_button("Chicken", constants.TOOL_SELL_CHICKEN, |
88 cursors.cursors['sell']) | 89 constants.SELL_PRICE_CHICKEN, cursors.cursors['sell']) |
89 self.add_tool_button("Egg", constants.TOOL_SELL_EGG, | 90 self.add_tool_button("Egg", constants.TOOL_SELL_EGG, |
90 cursors.cursors['sell']) | 91 constants.SELL_PRICE_EGG, cursors.cursors['sell']) |
91 self.add_tool_button("Building", constants.TOOL_SELL_BUILDING, | 92 self.add_tool_button("Building", constants.TOOL_SELL_BUILDING, |
92 cursors.cursors['sell']) | 93 None, cursors.cursors['sell']) |
93 self.add_tool_button("Equipment", constants.TOOL_SELL_EQUIPMENT, | 94 self.add_tool_button("Equipment", constants.TOOL_SELL_EQUIPMENT, |
94 cursors.cursors['sell']) | 95 None, cursors.cursors['sell']) |
95 self.add_spacer(20) | 96 self.add_spacer(20) |
96 | 97 |
98 | |
97 self.add_heading("Buy ...") | 99 self.add_heading("Buy ...") |
98 self.add_tool_button("Fence", constants.TOOL_BUY_FENCE) | 100 |
101 self.add_tool_button("Fence", constants.TOOL_BUY_FENCE, | |
102 "%s/%s" % (constants.BUY_PRICE_FENCE, | |
103 constants.REPAIR_PRICE_FENCE)) | |
104 | |
99 for building_cls in buildings.BUILDINGS: | 105 for building_cls in buildings.BUILDINGS: |
100 self.add_tool_button(building_cls.NAME.title(), building_cls, | 106 self.add_tool_button(building_cls.NAME.title(), building_cls, |
101 cursors.cursors.get('build', None)) | 107 None, cursors.cursors.get('build', None)) |
108 | |
102 for equipment_cls in equipment.EQUIPMENT: | 109 for equipment_cls in equipment.EQUIPMENT: |
103 self.add_tool_button(equipment_cls.NAME.title(), equipment_cls, | 110 self.add_tool_button(equipment_cls.NAME.title(), |
111 equipment_cls, | |
112 equipment_cls.BUY_PRICE, | |
104 cursors.cursors.get('buy', None)) | 113 cursors.cursors.get('buy', None)) |
114 | |
105 self.add_spacer(30) | 115 self.add_spacer(30) |
106 | 116 |
107 self.add_tool("Finished Day", self.day_done) | 117 self.add_tool("Finished Day", self.day_done) |
108 | 118 |
109 def day_done(self): | 119 def day_done(self): |
122 | 132 |
123 def add_heading(self, text): | 133 def add_heading(self, text): |
124 self.tr() | 134 self.tr() |
125 self.td(mklabel(text), colspan=2) | 135 self.td(mklabel(text), colspan=2) |
126 | 136 |
127 def add_tool_button(self, text, tool, cursor=None): | 137 def add_tool_button(self, text, tool, price=None, cursor=None): |
138 if price is not None: | |
139 text = "%s (%s)" % (text, price) | |
128 self.add_tool(text, lambda: self.gameboard.set_selected_tool(tool, | 140 self.add_tool(text, lambda: self.gameboard.set_selected_tool(tool, |
129 cursor)) | 141 cursor)) |
130 | 142 |
131 def add_tool(self, text, func): | 143 def add_tool(self, text, func): |
132 label = gui.basic.Label(text) | 144 label = gui.basic.Label(text) |