generated from SGDA/GodotExampleProject
feat: base
This commit is contained in:
40
template/scenes/end_credits/end_credits.gd
Normal file
40
template/scenes/end_credits/end_credits.gd
Normal file
@ -0,0 +1,40 @@
|
||||
extends ScrollingCredits
|
||||
|
||||
@export_file("*.tscn") var main_menu_scene : String
|
||||
## This option forces the mouse to be visible when the menu shows up.
|
||||
## Useful for games that capture the mouse, and don't automatically return it.
|
||||
@export var force_mouse_mode_visible : bool = false
|
||||
@onready var init_mouse_filter : MouseFilter = mouse_filter
|
||||
|
||||
func _on_scroll_container_end_reached() -> void:
|
||||
%EndMessagePanel.show()
|
||||
mouse_filter = Control.MOUSE_FILTER_STOP
|
||||
if force_mouse_mode_visible:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
super._on_scroll_container_end_reached()
|
||||
|
||||
func _on_MenuButton_pressed() -> void:
|
||||
SceneLoader.load_scene(main_menu_scene)
|
||||
|
||||
func _on_ExitButton_pressed() -> void:
|
||||
get_tree().quit()
|
||||
|
||||
func _on_visibility_changed() -> void:
|
||||
if visible:
|
||||
%EndMessagePanel.hide()
|
||||
mouse_filter = init_mouse_filter
|
||||
|
||||
func _ready() -> void:
|
||||
visibility_changed.connect(_on_visibility_changed)
|
||||
if main_menu_scene.is_empty():
|
||||
%MenuButton.hide()
|
||||
if OS.has_feature("web"):
|
||||
%ExitButton.hide()
|
||||
super._ready()
|
||||
|
||||
func _unhandled_input(event : InputEvent) -> void:
|
||||
if event.is_action_pressed("ui_cancel"):
|
||||
if not %EndMessagePanel.visible:
|
||||
_on_scroll_container_end_reached()
|
||||
else:
|
||||
get_tree().quit()
|
1
template/scenes/end_credits/end_credits.gd.uid
Normal file
1
template/scenes/end_credits/end_credits.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://din3un0r6wp1s
|
91
template/scenes/end_credits/end_credits.tscn
Normal file
91
template/scenes/end_credits/end_credits.tscn
Normal file
@ -0,0 +1,91 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://domqqvcqatme5"]
|
||||
|
||||
[ext_resource type="PackedScene" path="res://template/scenes/credits/scrolling_credits.tscn" id="1_dqbsw"]
|
||||
[ext_resource type="Script" path="res://template/scenes/end_credits/end_credits.gd" id="2_jh5yp"]
|
||||
[ext_resource type="PackedScene" path="res://addons/maaacks_menus_template/base/scenes/music_players/background_music_player.tscn" id="3_fichv"]
|
||||
[ext_resource type="Script" path="res://addons/maaacks_menus_template/base/scripts/capture_focus.gd" id="4_4bbwp"]
|
||||
|
||||
[node name="EndCredits" instance=ExtResource("1_dqbsw")]
|
||||
script = ExtResource("2_jh5yp")
|
||||
main_menu_scene = "res://template/scenes/menus/main_menu/main_menu_with_animations.tscn"
|
||||
force_mouse_mode_visible = false
|
||||
|
||||
[node name="BackgroundMusicPlayer" parent="." index="0" instance=ExtResource("3_fichv")]
|
||||
|
||||
[node name="BackgroundColor" type="ColorRect" parent="." index="1"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="BackgroundTextureRect" type="TextureRect" parent="." index="2"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="ScrollContainer" parent="." index="3"]
|
||||
scroll_vertical = 0
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="." index="4"]
|
||||
layout_mode = 0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="EndMessagePanel" type="Panel" parent="CenterContainer" index="0"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
custom_minimum_size = Vector2(360, 120)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer/EndMessagePanel" index="0"]
|
||||
layout_mode = 0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
|
||||
[node name="ThankPlayer" type="Label" parent="CenterContainer/EndMessagePanel/VBoxContainer" index="0"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Thanks for playing!"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="CenterContainer/EndMessagePanel/VBoxContainer" index="1"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="CenterContainer/EndMessagePanel/VBoxContainer/CenterContainer" index="0"]
|
||||
custom_minimum_size = Vector2(256, 0)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = 16
|
||||
script = ExtResource("4_4bbwp")
|
||||
|
||||
[node name="ExitButton" type="Button" parent="CenterContainer/EndMessagePanel/VBoxContainer/CenterContainer/HBoxContainer" index="0"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Exit"
|
||||
|
||||
[node name="MenuButton" type="Button" parent="CenterContainer/EndMessagePanel/VBoxContainer/CenterContainer/HBoxContainer" index="1"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Menu"
|
||||
|
||||
[connection signal="pressed" from="CenterContainer/EndMessagePanel/VBoxContainer/CenterContainer/HBoxContainer/ExitButton" to="." method="_on_ExitButton_pressed"]
|
||||
[connection signal="pressed" from="CenterContainer/EndMessagePanel/VBoxContainer/CenterContainer/HBoxContainer/MenuButton" to="." method="_on_MenuButton_pressed"]
|
Reference in New Issue
Block a user