comparison gamelib/scenes/bridge.py @ 844:6a345dcbb209 pyntnclick

Complete textification of the bridge computer
author Neil Muller <neil@dip.sun.ac.za>
date Wed, 30 Jan 2013 17:33:23 +0200
parents 985e5fbb61f1
children
comparison
equal deleted inserted replaced
843:b7e19b97d5e1 844:6a345dcbb209
574 LOGS = [_("<Error: Log corrupted. Unable to open Log>")] 574 LOGS = [_("<Error: Log corrupted. Unable to open Log>")]
575 575
576 NAVIGATION = 'bridge_nav_base.png' 576 NAVIGATION = 'bridge_nav_base.png'
577 577
578 NAV_MESSAGES = { 578 NAV_MESSAGES = {
579 'engine offline': 'bridge_nav_engine.png', 579 'engine offline': [
580 'life support': 'bridge_nav_life_support.png', 580 _("Engine Offline: Navigation Disabled")],
581 'life support': [
582 _("Life Support Marginal."),
583 _("Emergency Navigation Protocol Engaged."),
584 '',
585 _("Destination locked to:"),
586 _("Bounty Penal Colony Space Port, New South Australia")],
581 } 587 }
582 588
583 BACKGROUND = ALERT_BASE 589 BACKGROUND = ALERT_BASE
584 590
585 INITIAL_DATA = { 591 INITIAL_DATA = {
651 if thing.name in self.things.keys(): 657 if thing.name in self.things.keys():
652 # Much fiddling to do the right thing when we reinsert it 658 # Much fiddling to do the right thing when we reinsert it
653 del self.things[thing.name] 659 del self.things[thing.name]
654 thing.scene = None 660 thing.scene = None
655 661
662 def _draw_nav_text(self, key):
663 surface = self._nav_background.copy()
664 xpos, ypos = self.ALERT_OFFSET
665 for line in self.NAV_MESSAGES[key]:
666 text = render_text(line, 'DejaVuSans-Bold.ttf', 18,
667 'darkblue', (0, 0, 0, 0), self.resource, (600, 25), False)
668 surface.blit(text, (xpos, ypos))
669 ypos = ypos + text.get_height() + self.ALERT_SPACING
670 return surface
671
656 def _get_nav_page(self): 672 def _get_nav_page(self):
657 if not self.game.scenes['engine'].get_data('engine online'): 673 if not self.game.scenes['engine'].get_data('engine online'):
658 return self._nav_background.copy() 674 return self._draw_nav_text('engine offline')
659 elif (not self.game.scenes['mess'].get_data('life support status') 675 elif (not self.game.scenes['mess'].get_data('life support status')
660 == 'fixed'): 676 == 'fixed'):
661 return self._nav_background.copy() 677 return self._draw_nav_text('life support')
662 else: 678 else:
663 for thing in self._nav_lines: 679 for thing in self._nav_lines:
664 if thing.name not in self.things: 680 if thing.name not in self.things:
665 self.add_thing(thing) 681 self.add_thing(thing)
666 return self._nav_background.copy() 682 return self._nav_background.copy()