예제 #1
0
    def __handle_goal(self, team):
        if team == '1':
            GameData.add_goal(0)
            obj = self.ids.labelHome
        else:
            GameData.add_goal(1)
            obj = self.ids.labelAway

        self.score = GameData.get_score()
        HighlightOverlay(orig_obj=obj, parent=self).animate(font_size=500, color=(1, 1, 1, 0), d=2.0)
        SoundManager.play(Trigger.GOAL)
예제 #2
0
 def __handle_goal(self, data):
     # 0 : home, 1: away
     if data in ["0", "1"]:
         team_id = int(data)
         GameData.add_goal(team_id)
         # play goal sound
         SoundManager.play(Trigger.GOAL)
         # update local match data
         self.update_match()
         # highlight score board
         HighlightOverlay(orig_obj=self.score_objects[team_id], parent=self).animate(font_size=500, color=(1, 1, 1, 0), d=2.0)
예제 #3
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
예제 #4
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