extends Control class_name BaseUI onready var hover_effect = preload("res://ui/text_hover_effect.tscn").instance() onready var buttons_sound = AudioStreamPlayer.new() func connect_children(elem, event: String, method: String): for control in elem.get_children(): if control is Button: control.connect(event, self, method, [control]) connect_children(control, event, method) func _ready(): add_child(hover_effect) move_child(hover_effect, 1) add_child(buttons_sound) connect_children(self, "mouse_entered", "button_hover") connect_children(self, "pressed", "button_click_sound") Input.set_mouse_mode(Input.MOUSE_MODE_CONFINED) Input.set_custom_mouse_cursor(preload("res://assets/all_gbs/textures/cursor.tga")) func button_hover(elem: Button): buttons_sound.stream = preload("res://assets/audio/Sounds/MM_MINOR.xx_permanentaliens.gzp.wav") buttons_sound.play() var position = elem.rect_global_position hover_effect.global_position = position + Vector2(elem.rect_size.x /2 - 10, elem.rect_size.y /2) hover_effect.visible = true var material: ParticlesMaterial material = hover_effect.process_material material.emission_box_extents = Vector3(elem.rect_size.x/2, 0, 0) hover_effect.amount = pow(elem.rect_size.x/40, 2) + 10 func button_click_sound(_elem: Button): buttons_sound.stream = preload("res://assets/audio/Sounds/MM_MAJOR.xx_permanentaliens.gzp.wav") buttons_sound.play()