comparison gamelib/scenes/bridge.py @ 389:eef2fca1aa11

Hook up updated alert screens
author Neil Muller <neil@dip.sun.ac.za>
date Sat, 28 Aug 2010 19:55:30 +0200
parents 8936c043d7a1
children 21faf5c8804c
comparison
equal deleted inserted replaced
388:1a768b72521f 389:eef2fca1aa11
428 FOLDER = 'bridge' 428 FOLDER = 'bridge'
429 NAME = 'bridge_comp_detail' 429 NAME = 'bridge_comp_detail'
430 430
431 SIZE = (640, 400) 431 SIZE = (640, 400)
432 432
433 ALERT = 'comp_detail_1.png' 433 ALERT_BASE = 'comp_alert_base.png'
434 434 ALERTS = {
435 LOGS = ['comp_log_1.png', 'comp_log_2.png', 435 'ai looping' : 'comp_alert_ai_looping.png',
436 'ai offline' : 'comp_alert_ai_offline.png',
437 'engine offline' : 'comp_alert_engine_offline.png',
438 'life support' : 'comp_alert_life_support.png',
439 }
440
441 # Point to start drawing changeable alerts
442 ALERT_OFFSET = (16, 140)
443 ALERT_SPACING = 4
444
445 LOGS = ['comp_log_start.png', 'comp_log_1.png',
436 'comp_log_end.png'] 446 'comp_log_end.png']
437 447
438 BACKGROUND = ALERT 448 NAVIGATION = {
449 'engine offline' : 'bridge_nav_engine.png',
450 'life support' : 'bridge_nav_life_support.png',
451 'final' : 'bridge_nav_dest.png'
452 }
453
454 BACKGROUND = ALERT_BASE
439 455
440 456
441 INITIAL_DATA = { 457 INITIAL_DATA = {
442 'tab' : 'alert', 458 'tab' : 'alert',
443 'log page' : 0, 459 'log page' : 0,
450 self.add_thing(LogTab()) 466 self.add_thing(LogTab())
451 self.add_thing(AlertTab()) 467 self.add_thing(AlertTab())
452 self.add_thing(CompUpButton()) 468 self.add_thing(CompUpButton())
453 self.add_thing(CompDownButton()) 469 self.add_thing(CompDownButton())
454 self._scene_playlist = None 470 self._scene_playlist = None
455 self._alert = get_image(self.FOLDER, self.ALERT) 471 self._alert = get_image(self.FOLDER, self.ALERT_BASE)
472 self._alert_messages = {}
473 self._nav_message = {}
474 for key, name in self.ALERTS.iteritems():
475 self._alert_messages[key] = get_image(self.FOLDER, name)
476 for key, name in self.NAVIGATION.iteritems():
477 self._nav_message[key] = get_image(self.FOLDER, name)
456 self._logs = [get_image(self.FOLDER, x) for x in self.LOGS] 478 self._logs = [get_image(self.FOLDER, x) for x in self.LOGS]
457 479
458 def enter(self): 480 def enter(self):
459 self._scene_playlist = get_current_playlist() 481 self._scene_playlist = get_current_playlist()
460 change_playlist(None) 482 change_playlist(None)
467 self._background = self._alert 489 self._background = self._alert
468 else: 490 else:
469 self._background = self._logs[self.get_data('log page')] 491 self._background = self._logs[self.get_data('log page')]
470 super(BridgeCompDetail, self).draw_background(surface) 492 super(BridgeCompDetail, self).draw_background(surface)
471 493
494 def draw_things(self, surface):
495 if self.get_data('tab') == 'alert':
496 xpos, ypos = self.ALERT_OFFSET
497 if self.state.scenes['bridge'].get_data('ai status') == 'looping':
498 surface.blit(self._alert_messages['ai looping'], (xpos, ypos))
499 ypos += self._alert_messages['ai looping'].get_size()[1] + self.ALERT_SPACING
500 if self.state.scenes['bridge'].get_data('ai status') == 'broken':
501 surface.blit(self._alert_messages['ai offline'], (xpos, ypos))
502 ypos += self._alert_messages['ai offline'].get_size()[1] + self.ALERT_SPACING
503 if not self.state.scenes['engine'].get_data('engine online'):
504 surface.blit(self._alert_messages['engine offline'], (xpos, ypos))
505 ypos += self._alert_messages['engine offline'].get_size()[1] + self.ALERT_SPACING
506 if not self.state.scenes['mess'].get_data('life support online'):
507 surface.blit(self._alert_messages['life support'], (xpos, ypos))
508 ypos += self._alert_messages['life support'].get_size()[1] + self.ALERT_SPACING
509 super(BridgeCompDetail, self).draw_things(surface)
510
472 511
473 SCENES = [Bridge] 512 SCENES = [Bridge]
474 DETAIL_VIEWS = [ChairDetail, BridgeCompDetail] 513 DETAIL_VIEWS = [ChairDetail, BridgeCompDetail]