|
| 1 | +@icon("res://assets/editor-icons/icon-park-outline--sound-wave.svg") |
| 2 | +extends Resource |
| 3 | +class_name AudioTheme |
| 4 | + |
| 5 | +## Resource for customizing the UI audio sounds |
| 6 | + |
| 7 | +@export_category("General") |
| 8 | +## Unique name of the audio theme |
| 9 | +@export var name: String |
| 10 | + |
| 11 | +@export_category("Global") |
| 12 | +## Sounds to play when OpenGamepadUI first launches |
| 13 | +@export_file("*.ogg") var intro := "" |
| 14 | +## Sound to play when volume is increased |
| 15 | +@export_file("*.ogg") var audio_volume_up := "" |
| 16 | +## Sound to play when volume is decreased |
| 17 | +@export_file("*.ogg") var audio_volume_down := "" |
| 18 | +## Ambient background music to play in menus |
| 19 | +@export_file("*.ogg") var ambient_music := "" |
| 20 | +## Sound to play when a notification is displayed |
| 21 | +@export_file("*.ogg") var notification_display := "" |
| 22 | + |
| 23 | +@export_category("Side Menus") |
| 24 | +## Sound to play when side menus (Main menu and QB menu) open |
| 25 | +@export_file("*.ogg") var side_menu_open := "" |
| 26 | +## Sound to play when side menus (Main menu and QB menu) close |
| 27 | +@export_file("*.ogg") var side_menu_close := "" |
| 28 | + |
| 29 | +@export_category("Button") |
| 30 | +## Sound to play when button is focused |
| 31 | +@export_file("*.ogg") var button_focus := "res://assets/audio/interface/536764__egomassive__toss.ogg" |
| 32 | +## Sound to play when button is selected |
| 33 | +@export_file("*.ogg") var button_select := "res://assets/audio/interface/96127__bmaczero__contact1.ogg" |
| 34 | + |
| 35 | +@export_category("Slider") |
| 36 | +## Sound to play when slider is focused |
| 37 | +@export_file("*.ogg") var slider_focus := "res://assets/audio/interface/536764__egomassive__toss.ogg" |
| 38 | +## Sound to play when slider value changes |
| 39 | +@export_file("*.ogg") var slider_change := "" |
| 40 | + |
| 41 | +@export_category("Toggle") |
| 42 | +## Sound to play when toggle is focused |
| 43 | +@export_file("*.ogg") var toggle_focus := "res://assets/audio/interface/536764__egomassive__toss.ogg" |
| 44 | +## Sound to play when toggle value changes |
| 45 | +@export_file("*.ogg") var toggle_change := "" |
| 46 | + |
| 47 | +## Enumeration of all different components of an audio theme |
| 48 | +enum TYPE { |
| 49 | + INTRO, |
| 50 | + AUDIO_VOLUME_UP, |
| 51 | + AUDIO_VOLUME_DOWN, |
| 52 | + AMBIENT_MUSIC, |
| 53 | + NOTIFICATION_DISPLAY, |
| 54 | + SIDE_MENU_OPEN, |
| 55 | + SIDE_MENU_CLOSE, |
| 56 | + BUTTON_FOCUS, |
| 57 | + BUTTON_SELECT, |
| 58 | + SLIDER_FOCUS, |
| 59 | + SLIDER_CHANGE, |
| 60 | + TOGGLE_FOCUS, |
| 61 | + TOGGLE_CHANGE, |
| 62 | +} |
| 63 | + |
| 64 | +## Returns the loaded audio stream for the given audio theme component type |
| 65 | +func get_stream(type: TYPE) -> AudioStream: |
| 66 | + var path := "" |
| 67 | + match type: |
| 68 | + TYPE.INTRO: |
| 69 | + path = intro |
| 70 | + TYPE.AUDIO_VOLUME_UP: |
| 71 | + path = audio_volume_up |
| 72 | + TYPE.AUDIO_VOLUME_DOWN: |
| 73 | + path = audio_volume_down |
| 74 | + |
| 75 | + return null |
0 commit comments