示例#1
0
    def on_tick(self):
        """
        Call back associated with each tick.
        """
        game.on_tick()
        self.admin.on_tick()

        # Send update to player scores.
        self.player_score_box.update()

        # Read incoming game button presses if they exist.
        player1, player2, player3 = game_buttons.read()
        if player1:
            game.buzz(0)
        elif player2:
            game.buzz(1)
        elif player3:
            game.buzz(2)
        game_buttons.reset_buttons()
        self.update()
        return True
示例#2
0
    def on_tick(self):
        """
        Call back associated with each tick.
        """
        game.on_tick()
        self.admin.on_tick()

        # Send update to player scores.
        self.player_score_box.update()

        # Read incoming game button presses if they exist.
        player1, player2, player3 = game_buttons.read()
        if player1:
            game.buzz(0)
        elif player2:
            game.buzz(1)
        elif player3:
            game.buzz(2)
        game_buttons.reset_buttons()
        self.update()
        return True
示例#3
0
 def on_press(self, actor, event):
     """
     """
     if event.keyval == clutter.keysyms.Escape:
         clutter.main_quit()
     elif event.keyval == clutter.keysyms.a:
         # player A rings in.
         game_buttons.player_set(0, True)
         game.buzz(0)
         self.update()
     elif event.keyval == clutter.keysyms.b:
         # player B rings in.
         game_buttons.player_set(1, True)
         game.buzz(1)
         self.update()
     elif event.keyval == clutter.keysyms.c:
         # player C rings in.
         game_buttons.player_set(2, True)
         game.buzz(2)
         self.update()
     elif event.keyval == clutter.keysyms.space:
         if not self.final_round_overlay.is_playing():
             # We do not allow for incoming space button presses when final
             # round overlay music is playing.
             # multi-purpose bar press
             game.bar()
             self.update()
     elif event.keyval == clutter.keysyms.x:
         # cancel
         game.cancel()
         self.update()
     elif event.keyval == clutter.keysyms.y:
         # correct answer
         game.correct_answer()
         self.update()
     elif event.keyval == clutter.keysyms.n:
         # incorrect answer
         game.incorrect_answer()
         self.update()
     elif event.keyval == clutter.keysyms.z:
         logging.debug('resetting player lights')
         game_buttons.reset_player_lights()
     elif event.keyval == clutter.keysyms.l:
         if self.category_overlay in self.get_children():
             self.category_overlay.animate(
                 clutter.LINEAR, 500, 'x',
                 self.category_overlay.get_x() - self.get_width())
         else:
             self.category_overlay.set_size(self.get_width(),
                                            self.get_height())
             self.category_overlay.set_x(self.get_width())
             self.add(self.category_overlay)
             self.category_overlay.animate(
                 clutter.LINEAR, 500, 'x',
                 self.category_overlay.get_x() - self.get_width())
     elif event.keyval == clutter.keysyms.p:
         # DEBUG - for testing end of round condition without clicking everything.
         # don't leave this active in production code!
         for category in game.categories:
             for clue in category.clues:
                 clue.state = 'selected'
         game.categories[0].clues[0].state = 'unanswered'
     elif event.keyval == clutter.keysyms.f:
         # Fullscreen play area.
         self.set_fullscreen(not self.get_fullscreen())
     elif event.keyval == clutter.keysyms.s:
         self.flash_scores()
示例#4
0
 def on_press(self, actor, event):
     """
     """
     if event.keyval == clutter.keysyms.Escape:
         clutter.main_quit()
     elif event.keyval == clutter.keysyms.a:
         # player A rings in.
         game_buttons.player_set(0, True)
         game.buzz(0)
         self.update()
     elif event.keyval == clutter.keysyms.b:
         # player B rings in.
         game_buttons.player_set(1, True)
         game.buzz(1)
         self.update()
     elif event.keyval == clutter.keysyms.c:
         # player C rings in.
         game_buttons.player_set(2, True)
         game.buzz(2)
         self.update()
     elif event.keyval == clutter.keysyms.space:
         if not self.final_round_overlay.is_playing():
             # We do not allow for incoming space button presses when final
             # round overlay music is playing.
             # multi-purpose bar press
             game.bar()
             self.update()
     elif event.keyval == clutter.keysyms.x:
         # cancel
         game.cancel()
         self.update()
     elif event.keyval == clutter.keysyms.y:
         # correct answer
         game.correct_answer()
         self.update()
     elif event.keyval == clutter.keysyms.n:
         # incorrect answer
         game.incorrect_answer()
         self.update()
     elif event.keyval == clutter.keysyms.z:
         logging.debug('resetting player lights')
         game_buttons.reset_player_lights()
     elif event.keyval == clutter.keysyms.l:
         if self.category_overlay in self.get_children():
             self.category_overlay.animate(clutter.LINEAR,
                                           500,
                                           'x', self.category_overlay.get_x() - self.get_width())
         else:
             self.category_overlay.set_size(self.get_width(),
                                            self.get_height())
             self.category_overlay.set_x(self.get_width())
             self.add(self.category_overlay)
             self.category_overlay.animate(clutter.LINEAR,
                                           500,
                                           'x', self.category_overlay.get_x() - self.get_width())
     elif event.keyval == clutter.keysyms.p:
         # DEBUG - for testing end of round condition without clicking everything.
         # don't leave this active in production code!
         for category in game.categories:
             for clue in category.clues:
                 clue.state = 'selected'
         game.categories[0].clues[0].state = 'unanswered'
     elif event.keyval == clutter.keysyms.f:
         # Fullscreen play area.
         self.set_fullscreen(not self.get_fullscreen())
     elif event.keyval == clutter.keysyms.s:
         self.flash_scores()