示例#1
0
    def __init__(self):

        self.hit_sounds = {
            InputActionTypes.WEAK_PUNCH: [pygame.mixer.Sound("sounds/hit-sound.ogg")],
            InputActionTypes.MEDIUM_PUNCH: [pygame.mixer.Sound("sounds/medium-hit-sound.ogg")],
            InputActionTypes.STRONG_PUNCH: [pygame.mixer.Sound("sounds/strong-hit-sound.ogg")],
            InputActionTypes.WEAK_KICK: [pygame.mixer.Sound("sounds/hit-sound.ogg")],
            InputActionTypes.MEDIUM_KICK: [pygame.mixer.Sound("sounds/medium-hit-sound.ogg")],
            InputActionTypes.STRONG_KICK: [pygame.mixer.Sound("sounds/strong-hit-sound.ogg")],
        }
        self.set_sound_volumes(self.hit_sounds)

        self.clash_sound = pygame.mixer.Sound("./sounds/clash-sound.ogg")
        self.clash_sound.set_volume(settingsdata.get_sound_volume())
示例#2
0
def load():
    global exit_button
    global exit_indicator
    global loaded
    global sound_label
    global sound_control
    global music_label
    global music_control
    
    exit_button = ExitButton()
    exit_indicator = False
    loaded = True
    
    #Create control labels and controls
    sound_label_position = (20,20)
    sound_label = Label(
        sound_label_position,
        'Effects Volume',
        (255,255,255),
        40
    )
    sound_control = VolumeControl()
    sound_control_position = (
        sound_label_position[0],
        sound_label_position[1] + sound_label.height + 20
    )
    sound_control.create_children()
    sound_control.set_layout_data(sound_control_position, 300)
    sound_control.set_scroll_percent(settingsdata.get_sound_volume())
    
    music_label_position = sound_control_position = (
        sound_control.position[0],
        sound_control.position[1] + sound_control.height + 40
    )
    music_label = Label(
        music_label_position, 
        'Music Volume',
        (255,255,255),
        40
    )
    music_control = VolumeControl()
    music_control.create_children()
    music_control_position = (
        music_label_position[0],
        music_label_position[1] + music_label.height + 20
    )
    music_control.set_layout_data(music_control_position, 300)
    music_control.set_scroll_percent(settingsdata.get_music_volume())
示例#3
0
 def set_sound_volumes(self, sound_dict):
     for sound_list in sound_dict.values():
         for sound in sound_list:
             sound.set_volume(settingsdata.get_sound_volume())