Ejemplo n.º 1
0
 def handle_score_touch_up(self, event):
     if self.state not in ['running', 'finished']:
         return
     if self.score_touch:
         score_id = self.score_touch['id']
         dist = event.pos[1] - self.score_touch['startPos']
         if abs(dist) > self.MIN_SCORE_MOVE_PX:
             goal_up = dist > 0
             if goal_up:
                 swipe_allowed = GameData.add_goal(score_id)
             else:
                 swipe_allowed = GameData.revoke_goal(score_id)
             if swipe_allowed:
                 self.score = GameData.get_score()
                 HighlightOverlay(orig_obj=self.score_objects[score_id], parent=self).animate(font_size=500, color=(1, 1, 1, 0))
                 if goal_up:
                     SoundManager.play(Trigger.GOAL)
                 else:
                     SoundManager.play(Trigger.OFFSIDE)
             else:
                 # TODO: "Rote Karte"
                 pass
         self.score_objects[score_id].color = (1, 1, 1, 1)
     self.score_touch = None
Ejemplo n.º 2
0
    def handle_score_touch_up(self, event):
        if self.state not in ['running', 'finished']:
            return
        if self.score_touch:
            score_id = self.score_touch['id']
            dist = event.pos[1] - self.score_touch['startPos']
            if abs(dist) > settings.SCORE_SWIPE_DISTANCE:
                goal_up = dist > 0
                if goal_up:
                    swipe_allowed = GameData.add_goal(score_id)
                else:
                    swipe_allowed = GameData.revoke_goal(score_id)
                if swipe_allowed:
                    self.update_match()
                    HighlightOverlay(orig_obj=self.score_objects[score_id], parent=self).animate(font_size=500, color=(1, 1, 1, 0))
                    if goal_up:
                        SoundManager.play(Trigger.GOAL)
                    else:
                        SoundManager.play(Trigger.OFFSIDE)
                else:
                    self.denied()

            self.score_objects[score_id].color = (1, 1, 1, 1)
        self.score_touch = None