adding menu_option

This commit is contained in:
AleaJactaEst 2021-09-23 21:00:59 +02:00
parent 11b0eb46c1
commit a6b6bb36c7
2 changed files with 214 additions and 0 deletions

View file

@ -0,0 +1,56 @@
extends Control
signal quit_pressed
signal mute_pressed
func _ready():
#get_node("option_settings").connect("mute_pressed", self, "_on_control_mute_pressed")
MusicManager.connect("mute_pressed", self, "_on_signal_mute_pressed")
MusicManager.connect_ext_func( "mute_pressed", self , "_on_signal_mute_pressed")
$option_settings.connect( "mute_pressed", self, "_on_signal_mute_pressed" )
$option_settings.connect_ext_func( "mute_pressed", self, "_on_signal_mute_pressed" )
update_sound_button()
func _on_signal_mute_pressed():
Config.msg_debug("<Option> Received Signal mute")
update_sound_button()
func update_sound_button():
Config.msg_debug("<Option> update_sound_button")
if Config.mute:
$g/g/font/menu/sound_button.texture_normal = load ( "res://assets/interfaces/Login-Khanat-sound-muted-button.png")
$g/g/font/menu/sound_button.texture_hover = load ( "res://assets/interfaces/Login-Khanat-sound-muted-button-hover.png")
else:
$g/g/font/menu/sound_button.texture_normal = load ( "res://assets/interfaces/Login-Khanat-sound-button.png")
$g/g/font/menu/sound_button.texture_hover = load ( "res://assets/interfaces/Login-Khanat-sound-button-hover.png")
func _on_language_button_pressed():
$option_language/window_dialog.show()
func _on_sound_button_pressed():
Config.msg_debug("Option mute")
MusicManager.set_sound_mute(not Config.mute)
emit_signal( "mute_pressed" )
update_sound_button()
func _on_jukebox_button_pressed():
MusicManager.open()
func _on_settings_button_pressed():
$option_settings/window_dialog.show()
func _on_help_button_pressed():
$option_info/window_dialog.show()
func _on_quit_button_pressed():
get_tree().quit()

View file

@ -0,0 +1,158 @@
[gd_scene load_steps=18 format=2]
[ext_resource path="res://assets/interfaces/background-menu-options.png" type="Texture" id=1]
[ext_resource path="res://assets/interfaces/Login-Khanat-sound-button.png" type="Texture" id=2]
[ext_resource path="res://assets/interfaces/Login-Khanat-language-button.png" type="Texture" id=3]
[ext_resource path="res://assets/interfaces/Login-Khanat-help-button-hover.png" type="Texture" id=4]
[ext_resource path="res://assets/interfaces/Login-Khanat-quit-button.png" type="Texture" id=5]
[ext_resource path="res://assets/interfaces/Login-Khanat-settings-button.png" type="Texture" id=6]
[ext_resource path="res://assets/interfaces/Login-Khanat-help-button.png" type="Texture" id=7]
[ext_resource path="res://assets/interfaces/Login-Khanat-quit-button-hover.png" type="Texture" id=8]
[ext_resource path="res://assets/interfaces/Login-Khanat-settings-button-hover.png" type="Texture" id=9]
[ext_resource path="res://assets/interfaces/Login-Khanat-language-button-hover.png" type="Texture" id=10]
[ext_resource path="res://assets/interfaces/Login-Khanat-sound-button-hover.png" type="Texture" id=11]
[ext_resource path="res://assets/interfaces/Login-Khanat-jukebox-button-hover.png" type="Texture" id=12]
[ext_resource path="res://assets/interfaces/Login-Khanat-jukebox-button.png" type="Texture" id=13]
[ext_resource path="res://scenes/interfaces/menu_options/menu_options.gd" type="Script" id=14]
[ext_resource path="res://scenes/interfaces/options/option_language.tscn" type="PackedScene" id=15]
[ext_resource path="res://scenes/interfaces/options/option_info.tscn" type="PackedScene" id=16]
[ext_resource path="res://scenes/interfaces/options/option_settings.tscn" type="PackedScene" id=17]
[node name="control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource( 14 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="g" type="VBoxContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="g" type="HBoxContainer" parent="g"]
margin_right = 1280.0
margin_bottom = 720.0
size_flags_horizontal = 3
size_flags_vertical = 3
alignment = 2
[node name="font" type="TextureRect" parent="g/g"]
margin_left = 290.0
margin_top = 325.0
margin_right = 990.0
margin_bottom = 394.0
size_flags_horizontal = 6
size_flags_vertical = 6
texture = ExtResource( 1 )
[node name="menu" type="HBoxContainer" parent="g/g/font"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_bottom = -1.0
size_flags_horizontal = 7
size_flags_vertical = 7
alignment = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="language_button" type="TextureButton" parent="g/g/font/menu"]
margin_left = 29.0
margin_top = 3.0
margin_right = 83.0
margin_bottom = 64.0
size_flags_horizontal = 6
size_flags_vertical = 6
texture_normal = ExtResource( 3 )
texture_hover = ExtResource( 10 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="sound_button" type="TextureButton" parent="g/g/font/menu"]
margin_left = 146.0
margin_top = 3.0
margin_right = 200.0
margin_bottom = 64.0
size_flags_horizontal = 6
size_flags_vertical = 6
texture_normal = ExtResource( 2 )
texture_hover = ExtResource( 11 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="jukebox_button" type="TextureButton" parent="g/g/font/menu"]
margin_left = 264.0
margin_top = 3.0
margin_right = 318.0
margin_bottom = 64.0
size_flags_horizontal = 6
size_flags_vertical = 6
texture_normal = ExtResource( 13 )
texture_hover = ExtResource( 12 )
[node name="settings_button" type="TextureButton" parent="g/g/font/menu"]
margin_left = 381.0
margin_top = 3.0
margin_right = 435.0
margin_bottom = 64.0
size_flags_horizontal = 6
size_flags_vertical = 6
texture_normal = ExtResource( 6 )
texture_hover = ExtResource( 9 )
[node name="help_button" type="TextureButton" parent="g/g/font/menu"]
margin_left = 498.0
margin_top = 3.0
margin_right = 552.0
margin_bottom = 64.0
size_flags_horizontal = 6
size_flags_vertical = 6
texture_normal = ExtResource( 7 )
texture_hover = ExtResource( 4 )
[node name="quit_button" type="TextureButton" parent="g/g/font/menu"]
margin_left = 616.0
margin_top = 3.0
margin_right = 670.0
margin_bottom = 64.0
size_flags_horizontal = 6
size_flags_vertical = 6
texture_normal = ExtResource( 5 )
texture_hover = ExtResource( 8 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="option_language" parent="." instance=ExtResource( 15 )]
visible = false
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -640.0
margin_top = -34.5
margin_right = 640.0
margin_bottom = 34.5
[node name="option_info" parent="." instance=ExtResource( 16 )]
visible = false
[node name="option_settings" parent="." instance=ExtResource( 17 )]
visible = false
[connection signal="pressed" from="g/g/font/menu/language_button" to="." method="_on_language_button_pressed"]
[connection signal="pressed" from="g/g/font/menu/sound_button" to="." method="_on_sound_button_pressed"]
[connection signal="pressed" from="g/g/font/menu/jukebox_button" to="." method="_on_jukebox_button_pressed"]
[connection signal="pressed" from="g/g/font/menu/settings_button" to="." method="_on_settings_button_pressed"]
[connection signal="pressed" from="g/g/font/menu/help_button" to="." method="_on_help_button_pressed"]
[connection signal="pressed" from="g/g/font/menu/quit_button" to="." method="_on_quit_button_pressed"]