Browse Source

autoplay and settings compatibility

shuvit 5 years ago
parent
commit
c29dde6497
1 changed files with 12 additions and 1 deletions
  1. 12
    1
      MusicPlayer.py

+ 12
- 1
MusicPlayer.py View File

74
         last_y = up_dict['last_yBut']
74
         last_y = up_dict['last_yBut']
75
         JUST_ACTIVATED = bge.logic.KX_INPUT_JUST_ACTIVATED
75
         JUST_ACTIVATED = bge.logic.KX_INPUT_JUST_ACTIVATED
76
         
76
         
77
+
78
+        #Run player on startup
79
+        if up_dict['music_start'] == True:
80
+            if self.isPlaying:
81
+                self.stopMusic()
82
+            else:
83
+                self.playMusic()                 
84
+            up_dict['music_start'] = False               
85
+
77
         # Music controls only during pause/replay
86
         # Music controls only during pause/replay
78
-        if up_dict['npause'] == True or up_dict['playback'] == True:
87
+        if (up_dict['npause'] == True or up_dict['playback'] == True) or up_dict['music_start'] == True:
79
             #stop/play
88
             #stop/play
80
             if (y == False and last_y == True) or pKey == JUST_ACTIVATED:
89
             if (y == False and last_y == True) or pKey == JUST_ACTIVATED:
81
                 if self.isPlaying:
90
                 if self.isPlaying:
82
                     self.stopMusic()
91
                     self.stopMusic()
92
+                    up_dict['music_player'] = 0
83
                 else:
93
                 else:
84
                     self.playMusic()
94
                     self.playMusic()
95
+                    up_dict['music_player'] = 1
85
             # Prev/Next
96
             # Prev/Next
86
             if self.isPlaying and self.handle.status:
97
             if self.isPlaying and self.handle.status:
87
                 if pMinus == JUST_ACTIVATED or (lb == False and last_lb == True):
98
                 if pMinus == JUST_ACTIVATED or (lb == False and last_lb == True):

Loading…
Cancel
Save