menu logic
This commit is contained in:
parent
9f838a64f5
commit
f3ef07486f
2 changed files with 85 additions and 14 deletions
25
menu/menu.gd
25
menu/menu.gd
|
|
@ -1,14 +1,25 @@
|
||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
|
enum Page{
|
||||||
|
Menu,
|
||||||
|
Credits
|
||||||
|
}
|
||||||
|
var menu_page : Page = Page.Menu
|
||||||
|
@export var menu_container : Control
|
||||||
|
@export var credits_container : Control
|
||||||
|
@export var exit_button : Button
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
pass # Replace with function body.
|
pass # Replace with function body.
|
||||||
|
if OS.get_name() == "Web":
|
||||||
|
exit_button.hide()
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
pass
|
menu_container.visible = menu_page == Page.Menu
|
||||||
|
credits_container.visible = menu_page == Page.Credits
|
||||||
|
|
||||||
|
|
||||||
func _on_intro_button_pressed() -> void:
|
func _on_intro_button_pressed() -> void:
|
||||||
|
|
@ -19,3 +30,15 @@ func _on_intro_button_pressed() -> void:
|
||||||
func _on_skip_button_pressed() -> void:
|
func _on_skip_button_pressed() -> void:
|
||||||
GameManager.are_we_skipping_intro = true
|
GameManager.are_we_skipping_intro = true
|
||||||
get_tree().change_scene_to_file("res://game_scene.tscn")
|
get_tree().change_scene_to_file("res://game_scene.tscn")
|
||||||
|
|
||||||
|
|
||||||
|
func _on_credits_meta_clicked(meta: Variant) -> void:
|
||||||
|
OS.shell_open(str(meta))
|
||||||
|
|
||||||
|
|
||||||
|
func _on_credits_button_pressed() -> void:
|
||||||
|
menu_page = Page.Credits
|
||||||
|
|
||||||
|
|
||||||
|
func _on_back_button_pressed() -> void:
|
||||||
|
menu_page = Page.Menu
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ fill_from = Vector2(0.825082, 0.657132)
|
||||||
fill_to = Vector2(0.610561, 0.569124)
|
fill_to = Vector2(0.610561, 0.569124)
|
||||||
repeat = 2
|
repeat = 2
|
||||||
|
|
||||||
[node name="Menu" type="Control"]
|
[node name="Menu" type="Control" node_paths=PackedStringArray("menu_container", "credits_container", "exit_button")]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
|
|
@ -24,6 +24,9 @@ anchor_bottom = 1.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
script = ExtResource("1_j0t7f")
|
script = ExtResource("1_j0t7f")
|
||||||
|
menu_container = NodePath("MenuContainer")
|
||||||
|
credits_container = NodePath("CreditsContainer")
|
||||||
|
exit_button = NodePath("MenuContainer/PanelContainer/MarginContainer/VBoxContainer/ExitButton")
|
||||||
|
|
||||||
[node name="TextureRect" type="TextureRect" parent="."]
|
[node name="TextureRect" type="TextureRect" parent="."]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
|
|
@ -31,7 +34,8 @@ offset_right = 40.0
|
||||||
offset_bottom = 40.0
|
offset_bottom = 40.0
|
||||||
texture = SubResource("GradientTexture2D_j0t7f")
|
texture = SubResource("GradientTexture2D_j0t7f")
|
||||||
|
|
||||||
[node name="CenterContainer" type="CenterContainer" parent="."]
|
[node name="MenuContainer" type="CenterContainer" parent="."]
|
||||||
|
visible = false
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
|
|
@ -39,20 +43,20 @@ anchor_bottom = 1.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
|
||||||
[node name="PanelContainer" type="PanelContainer" parent="CenterContainer"]
|
[node name="PanelContainer" type="PanelContainer" parent="MenuContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="MarginContainer" type="MarginContainer" parent="CenterContainer/PanelContainer"]
|
[node name="MarginContainer" type="MarginContainer" parent="MenuContainer/PanelContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_constants/margin_left = 10
|
theme_override_constants/margin_left = 10
|
||||||
theme_override_constants/margin_top = 10
|
theme_override_constants/margin_top = 10
|
||||||
theme_override_constants/margin_right = 10
|
theme_override_constants/margin_right = 10
|
||||||
theme_override_constants/margin_bottom = 10
|
theme_override_constants/margin_bottom = 10
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="MenuContainer/PanelContainer/MarginContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="RichTextLabel" type="RichTextLabel" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer"]
|
[node name="RichTextLabel" type="RichTextLabel" parent="MenuContainer/PanelContainer/MarginContainer/VBoxContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_font_sizes/normal_font_size = 31
|
theme_override_font_sizes/normal_font_size = 31
|
||||||
bbcode_enabled = true
|
bbcode_enabled = true
|
||||||
|
|
@ -60,7 +64,7 @@ text = "[wave]Alternate (Name Pending)"
|
||||||
fit_content = true
|
fit_content = true
|
||||||
autowrap_mode = 0
|
autowrap_mode = 0
|
||||||
|
|
||||||
[node name="RichTextLabel2" type="RichTextLabel" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer"]
|
[node name="RichTextLabel2" type="RichTextLabel" parent="MenuContainer/PanelContainer/MarginContainer/VBoxContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
bbcode_enabled = true
|
bbcode_enabled = true
|
||||||
text = "by Tabby :3"
|
text = "by Tabby :3"
|
||||||
|
|
@ -68,25 +72,69 @@ fit_content = true
|
||||||
autowrap_mode = 0
|
autowrap_mode = 0
|
||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
|
|
||||||
[node name="IntroButton" type="Button" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer"]
|
[node name="IntroButton" type="Button" parent="MenuContainer/PanelContainer/MarginContainer/VBoxContainer"]
|
||||||
modulate = Color(1, 0.403922, 1, 1)
|
modulate = Color(1, 0.403922, 1, 1)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "Play Intro"
|
text = "Play Intro"
|
||||||
|
|
||||||
[node name="SkipButton" type="Button" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer"]
|
[node name="SkipButton" type="Button" parent="MenuContainer/PanelContainer/MarginContainer/VBoxContainer"]
|
||||||
modulate = Color(1, 0.403922, 1, 1)
|
modulate = Color(1, 0.403922, 1, 1)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "Skip Intro"
|
text = "Skip Intro"
|
||||||
|
|
||||||
[node name="CreditsButton" type="Button" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer"]
|
[node name="CreditsButton" type="Button" parent="MenuContainer/PanelContainer/MarginContainer/VBoxContainer"]
|
||||||
modulate = Color(0.388235, 1, 1, 1)
|
modulate = Color(0.388235, 1, 1, 1)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "Credits"
|
text = "Credits"
|
||||||
|
|
||||||
[node name="ExitButton" type="Button" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer"]
|
[node name="ExitButton" type="Button" parent="MenuContainer/PanelContainer/MarginContainer/VBoxContainer"]
|
||||||
modulate = Color(1, 0.346577, 0.280009, 1)
|
modulate = Color(1, 0.346577, 0.280009, 1)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "Exit Game"
|
text = "Exit Game"
|
||||||
|
|
||||||
[connection signal="pressed" from="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/IntroButton" to="." method="_on_intro_button_pressed"]
|
[node name="CreditsContainer" type="CenterContainer" parent="."]
|
||||||
[connection signal="pressed" from="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/SkipButton" to="." method="_on_skip_button_pressed"]
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="PanelContainer" type="PanelContainer" parent="CreditsContainer"]
|
||||||
|
custom_minimum_size = Vector2(400, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="CreditsContainer/PanelContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/margin_left = 10
|
||||||
|
theme_override_constants/margin_top = 10
|
||||||
|
theme_override_constants/margin_right = 10
|
||||||
|
theme_override_constants/margin_bottom = 10
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="CreditsContainer/PanelContainer/MarginContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="RichTextLabel" type="RichTextLabel" parent="CreditsContainer/PanelContainer/MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_font_sizes/normal_font_size = 31
|
||||||
|
bbcode_enabled = true
|
||||||
|
text = "[wave]Credits"
|
||||||
|
fit_content = true
|
||||||
|
autowrap_mode = 0
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="Credits" type="RichTextLabel" parent="CreditsContainer/PanelContainer/MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
bbcode_enabled = true
|
||||||
|
text = "[ul] "
|
||||||
|
fit_content = true
|
||||||
|
|
||||||
|
[node name="BackButton" type="Button" parent="CreditsContainer/PanelContainer/MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Go Back"
|
||||||
|
|
||||||
|
[connection signal="pressed" from="MenuContainer/PanelContainer/MarginContainer/VBoxContainer/IntroButton" to="." method="_on_intro_button_pressed"]
|
||||||
|
[connection signal="pressed" from="MenuContainer/PanelContainer/MarginContainer/VBoxContainer/SkipButton" to="." method="_on_skip_button_pressed"]
|
||||||
|
[connection signal="pressed" from="MenuContainer/PanelContainer/MarginContainer/VBoxContainer/CreditsButton" to="." method="_on_credits_button_pressed"]
|
||||||
|
[connection signal="meta_clicked" from="CreditsContainer/PanelContainer/MarginContainer/VBoxContainer/Credits" to="." method="_on_credits_meta_clicked"]
|
||||||
|
[connection signal="pressed" from="CreditsContainer/PanelContainer/MarginContainer/VBoxContainer/BackButton" to="." method="_on_back_button_pressed"]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue