From: pin Date: Tue, 18 May 2010 14:41:37 +0000 (+0000) Subject: Ajout du mode débutant. X-Git-Url: https://scm.cri.mines-paristech.fr/git/minwii.git/commitdiff_plain/346a9b8e1fcfe30629f0d1ee4675e9e8f89890cf?ds=sidebyside;hp=da27397af045e89d82771d70851ec7cc9d158f70 Ajout du mode débutant. git-svn-id: https://svn.cri.ensmp.fr/svn/minwii/trunk@170 fe552daf-6dbe-4428-90eb-1537e0879342 --- diff --git a/src/app/globals.py b/src/app/globals.py index 0dde5f3..2ce25eb 100755 --- a/src/app/globals.py +++ b/src/app/globals.py @@ -11,10 +11,11 @@ from math import floor BACKGROUND_LAYER = 0 FOREGROUND_LAYER = 1 CURSOR_LAYER = 2 -PLAYING_MODES = (('EASY' , u'Facile'), - ('NORMAL' , u'Normal'), - ('ADVANCED', u'Avancé'), - ('EXPERT' , u'Expert')) +PLAYING_MODES = (('BEGINNER' , u'Débutant'), + ('EASY' , u'Facile'), + ('NORMAL' , u'Normal'), + ('ADVANCED' , u'Avancé'), + ('EXPERT' , u'Expert')) diff --git a/src/app/widgets/playingscreen.py b/src/app/widgets/playingscreen.py index 77a17a7..0735825 100755 --- a/src/app/widgets/playingscreen.py +++ b/src/app/widgets/playingscreen.py @@ -191,7 +191,11 @@ class SongPlayingScreen(PlayingScreenBase) : def _plugListeners(self, mode) : "initialisation des gestionnaires d'événements en fonction du mode" - if mode == PLAYING_MODES_DICT['EASY'] : + if mode == PLAYING_MODES_DICT['BEGINNER'] : + EventDispatcher.addEventListener(events.COLOVER, self.handleBeginnerColumnOver) + + elif mode == PLAYING_MODES_DICT['EASY'] : + EventDispatcher.addEventListener(events.COLDOWN, self.handleEasyColumnDown) EventDispatcher.addEventListener(events.COLOVER, self.handleEasyColumnOver) elif mode == PLAYING_MODES_DICT['NORMAL'] : @@ -209,7 +213,7 @@ class SongPlayingScreen(PlayingScreenBase) : # --- HID listeners --- - def handleEasyColumnOver(self, event) : + def handleBeginnerColumnOver(self, event) : col = event.column if col.state and not self.currentNotePlayed : self.playnote(col, event.pos) @@ -218,6 +222,19 @@ class SongPlayingScreen(PlayingScreenBase) : self.quarterNoteDuration) ) self.currentNotePlayed = True + + def handleEasyColumnOver(self, event) : + col = event.column + if col.state and \ + any(event.mouseEvent.buttons) and \ + not self.currentNotePlayed : + self.playnote(col, event.pos) + SongPlayingScreen.setNoteTimeout( + int(self.currentNote.duration * \ + self.quarterNoteDuration) + ) + self.currentNotePlayed = True + def handleNormalColumnOver(self, event) : col = event.column @@ -232,6 +249,18 @@ class SongPlayingScreen(PlayingScreenBase) : if col.state: self.playnote(col, event.pos) self.currentNotePlayed = True + + def handleEasyColumnDown(self, event) : + col = event.column + if col.state and \ + not self.currentNotePlayed : + self.playnote(col, event.pos) + SongPlayingScreen.setNoteTimeout( + int(self.currentNote.duration * \ + self.quarterNoteDuration) + ) + self.currentNotePlayed = True + def handleExpertColumnDown(self, event) : col = event.column