Mercurial > sypikslang
diff gamelib/gamegui.py @ 228:3955d126ca26
merge
author | Rizmari Versfeld <rizziepit@gmail.com> |
---|---|
date | Sat, 12 May 2012 23:09:33 +0200 |
parents | f8c05e6dc0e2 |
children | 0478c8b44acf |
line wrap: on
line diff
--- a/gamelib/gamegui.py Sat May 12 23:09:16 2012 +0200 +++ b/gamelib/gamegui.py Sat May 12 23:09:33 2012 +0200 @@ -57,7 +57,7 @@ class EndTurnButton(BigButton): def __init__(self, parent): - super(EndTurnButton, self).__init__(((WIDTH - 128), 10), 'End Turn') + super(EndTurnButton, self).__init__(((WIDTH - 128), 0), 'End Turn') self.parent = parent def on_click(self): @@ -66,12 +66,12 @@ class NextTurnButton(PopWindowButton): def __init__(self): - super(NextTurnButton, self).__init__(((WIDTH - 128), 10), 'Next Turn') + super(NextTurnButton, self).__init__(((WIDTH - 128), 0), 'Next Turn') class AssignButton(PopWindowButton): def __init__(self, parent): - super(AssignButton, self).__init__(((WIDTH - 128), 10), + super(AssignButton, self).__init__(((WIDTH - 128), 0), 'Assign Scheme') self.parent = parent @@ -82,7 +82,7 @@ class CancelButton(PopWindowButton): def __init__(self, parent): - super(CancelButton, self).__init__(((WIDTH - 256), 10), + super(CancelButton, self).__init__(((WIDTH - 256), 0), 'Cancel Scheme') self.parent = parent @@ -94,7 +94,7 @@ class ResetButton(BigButton): def __init__(self, parent, text='Clear calendars'): - super(ResetButton, self).__init__((10, 10), text) + super(ResetButton, self).__init__((10, 0), text) self.parent = parent def on_click(self): @@ -167,6 +167,7 @@ class MissionWidget(BigButton): WIDTH = 260 + HEIGHT = 48 BG_IMAGE_NORMAL = image.load(filepath('images/science_normal.png')) BG_IMAGE_DOWN = image.load(filepath('images/science_down.png')) @@ -235,6 +236,7 @@ class EquipWidget(BigButton): WIDTH = 260 + HEIGHT = 48 BG_IMAGE_NORMAL = image.load(filepath('images/science_normal.png')) BG_IMAGE_DOWN = image.load(filepath('images/science_down.png')) @@ -289,23 +291,23 @@ self.add_child(cancel) reset = ResetButton(self, 'Clear inventory') self.add_child(reset) - title = TextBox((170, 20, 370, 50), "Choose equipment for %s" + title = TextBox((170, 10, 370, 50), "Choose equipment for %s" % mission.NAME, font_medium, (255, 255, 255)) self.add_child(title) - self.description = TextBox((10, 70, 790, 20), + self.description = TextBox((10, 60, 790, 20), mission.get_description(), font_medium, (255, 255, 255)) self.add_child(self.description) self.parent = parent self.game = game - self.money = ValueLabel((10, self.description.rect.height + 75), + self.money = ValueLabel((10, self.description.rect.height + 58), 'Money') self.money.set_value(self.game.money) - self.minions = ValueLabel((310, self.description.rect.height + 75), + self.minions = ValueLabel((310, self.description.rect.height + 58), 'Minions Assigned') self.minions.set_value(self.parent.minions) self.add_child(self.money) self.add_child(self.minions) - inventory = TextLabel((10, self.description.rect.height + 90, 400, 20), + inventory = TextLabel((10, self.description.rect.height + 75, 400, 20), 'Current Inventory', font_medium, (255, 255, 255)) self.add_child(inventory) self._equip = [] @@ -348,7 +350,7 @@ self._equip = [] x = 0 y = max(250, 130 + self.description.rect.height + - 20 * len(self._inventory) // 3) + 18 * len(self._inventory) // 3) available = self.game.get_available_equipment() for equip in sorted(self.game.get_all_equipment(), key=lambda x: x.NAME): @@ -360,7 +362,7 @@ x += widget.WIDTH + 10 if x >= WIDTH: x = 0 - y += 65 + y += 45 def buy(self, equip): self.game.money -= equip.COST @@ -401,13 +403,15 @@ self.add_child(results) else: y = 200 - for msg_type, msg, loot in messages: + for mission, msg_type, msg, loot in messages: # FIXME: Better widgets if msg_type == GAME_WIN: self._make_win_screen(turn, msg) self.is_game_over = True break colour = self.message_colours.get(msg_type, (255, 255, 255)) + if mission: + msg = '%s: %s' % (mission, msg) y = self.display_message(y, msg, loot, colour) def display_message(self, y, msg, loot, colour, font=font_medium): @@ -457,19 +461,19 @@ reset = ResetButton(self) self.add_child(reset) - self.points = ValueLabel((10, 75), 'Blue-Sky Research Projects') + self.points = ValueLabel((10, 60), 'Blue-Sky Research Projects') self.add_child(self.points) - self.minions = ValueLabel((310, 75), 'Minions available') + self.minions = ValueLabel((310, 60), 'Minions available') self.add_child(self.minions) - self.money = ValueLabel((510, 75), 'Money') + self.money = ValueLabel((510, 60), 'Money') self.add_child(self.money) - self.milestone = ValueLabel((10, 95), 'Currently taken over') + self.milestone = ValueLabel((10, 80), 'Currently taken over') self.add_child(self.milestone) - self.reputation = ValueLabel((310, 95), 'Reputation') + self.reputation = ValueLabel((310, 80), 'Reputation') self.add_child(self.reputation) - self.advice = ValueLabel((10, 115), 'Research advice', width=780) + self.advice = ValueLabel((10, 100), 'Research advice', width=780) self.add_child(self.advice) def update_labels(self): @@ -488,9 +492,9 @@ self.lab = lab self.develop = develop - labbut = SwitchWinButton((150, 10), 'SCIENCE!!', lab) + labbut = SwitchWinButton((150, 0), 'SCIENCE!!', lab) self.add_child(labbut) - devbut = SwitchWinButton((300, 10), 'Engineering', develop) + devbut = SwitchWinButton((300, 0), 'Engineering', develop) self.add_child(devbut) self.update_labels() @@ -502,7 +506,7 @@ self.remove_child(widget) self._missions = [] x = 0 - y = 150 + y = 130 for mission in sorted(self.game.get_available_missions(), key=lambda x: x.NAME): widget = MissionWidget(mission, (x, y), self) @@ -554,7 +558,7 @@ super(DevelopmentWindow, self).__init__(screen, lab.game) self.lab = lab - labbut = SwitchWinButton((150, 10), 'SCIENCE!!', lab) + labbut = SwitchWinButton((150, 0), 'SCIENCE!!', lab) self.add_child(labbut) self.activity = None @@ -566,7 +570,7 @@ # Oh, what tangled webs we weave if not self.activity: self.activity = activity - actbut = SwitchWinButton((300, 10), 'Schemes', activity) + actbut = SwitchWinButton((300, 0), 'Schemes', activity) self.add_child(actbut) def _make_science_widgets(self): @@ -574,7 +578,7 @@ self.remove_child(widget) self._sciences = [] x = 0 - y = 150 + y = 130 for science in sorted(self.game.lab.science, key=lambda x: x.NAME): if science.SCIENCE_TYPE == 'schematic': widget = ScienceWidget(science, (x, y), self) @@ -583,7 +587,7 @@ x += widget.WIDTH + 10 if x >= WIDTH: x = 0 - y += widget.HEIGHT + 5 + y += widget.HEIGHT def end_turn(self): # Drop back to the research screen @@ -628,9 +632,9 @@ self.activity = ActivityWindow(screen, self, self.develop) self.develop.set_activity_window(self.activity) - devbut = SwitchWinButton((150, 10), 'Engineering', self.develop) + devbut = SwitchWinButton((150, 0), 'Engineering', self.develop) self.add_child(devbut) - actbut = SwitchWinButton((300, 10), 'Schemes', self.activity) + actbut = SwitchWinButton((300, 0), 'Schemes', self.activity) self.add_child(actbut) self._sciences = [] @@ -644,7 +648,7 @@ self.remove_child(widget) self._sciences = [] x = 0 - y = 150 + y = 130 for science in sorted(self.game.lab.science, key=lambda x: x.NAME): if science.SCIENCE_TYPE == 'research': widget = ScienceWidget(science, (x, y), self)