imported main menu scene addon
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
@tool
|
||||
extends ListOptionControl
|
||||
|
||||
func _set_input_device() -> void:
|
||||
var current_setting : Variant = _get_setting(default_value)
|
||||
if current_setting is bool:
|
||||
current_setting = &"Default"
|
||||
AudioServer.input_device = _get_setting(default_value)
|
||||
|
||||
func _add_microphone_audio_stream() -> void:
|
||||
var instance := AudioStreamPlayer.new()
|
||||
instance.stream = AudioStreamMicrophone.new()
|
||||
instance.autoplay = true
|
||||
add_child.call_deferred(instance)
|
||||
instance.ready.connect(_set_input_device)
|
||||
|
||||
func _ready() -> void:
|
||||
if ProjectSettings.get_setting("audio/driver/enable_input", false):
|
||||
show()
|
||||
if AudioServer.input_device.is_empty():
|
||||
_add_microphone_audio_stream()
|
||||
else:
|
||||
_set_input_device()
|
||||
if not Engine.is_editor_hint():
|
||||
option_values = AudioServer.get_input_device_list()
|
||||
else:
|
||||
hide()
|
||||
super._ready()
|
||||
|
||||
func _on_setting_changed(value : Variant) -> void:
|
||||
if value >= option_values.size(): return
|
||||
AudioServer.input_device = option_values[value]
|
||||
super._on_setting_changed(value)
|
||||
|
||||
func _value_title_map(value : Variant) -> String:
|
||||
if value is String:
|
||||
return value
|
||||
else:
|
||||
return super._value_title_map(value)
|
||||
@@ -0,0 +1 @@
|
||||
uid://h71jrpe7r1cx
|
||||
@@ -0,0 +1,21 @@
|
||||
[gd_scene format=3 uid="uid://7hqbc80e06sy"]
|
||||
|
||||
[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/nodes/menus/options_menu/option_control/list_option_control.tscn" id="1_lfo7w"]
|
||||
[ext_resource type="Script" path="res://scenes/menus/options_menu/audio/audio_input_option_control.gd" id="2_m6bxx"]
|
||||
|
||||
[node name="AudioInputOptionControl" unique_id=1866818783 instance=ExtResource("1_lfo7w")]
|
||||
visible = false
|
||||
script = ExtResource("2_m6bxx")
|
||||
option_name = "Input Device"
|
||||
option_section = 2
|
||||
key = "InputDevice"
|
||||
section = "AudioSettings"
|
||||
property_type = 4
|
||||
|
||||
[node name="OptionLabel" parent="." index="0" unique_id=1854788461]
|
||||
text = "Input Device :"
|
||||
|
||||
[node name="OptionButton" parent="." index="1" unique_id=264509485]
|
||||
size_flags_horizontal = 3
|
||||
text_overrun_behavior = 1
|
||||
clip_text = true
|
||||
@@ -0,0 +1,9 @@
|
||||
[gd_scene format=3 uid="uid://b5sx6r7ohjrj"]
|
||||
|
||||
[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/nodes/menus/options_menu/audio/audio_options_menu.tscn" id="1_33wdu"]
|
||||
[ext_resource type="PackedScene" path="res://scenes/menus/options_menu/audio/audio_input_option_control.tscn" id="2_vnecy"]
|
||||
|
||||
[node name="Audio" unique_id=651805888 instance=ExtResource("1_33wdu")]
|
||||
|
||||
[node name="AudioInputOptionControl" parent="VBoxContainer" parent_id_path=PackedInt32Array(1265848630) index="2" unique_id=774781052 instance=ExtResource("2_vnecy")]
|
||||
layout_mode = 2
|
||||
Reference in New Issue
Block a user