Savegame disable buttons setting
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/game.gd" type="Script" id=5]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/icons/music-double-note.svg" type="Texture" id=6]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/menus/main_menu/main_menu.tscn" type="PackedScene" id=7]
|
||||
[ext_resource path="res://addons/escoria-core/ui_library/menus/pause_menu/pause_menu.tscn" type="PackedScene" id=8]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/menus/pause_menu/pause_menu.tscn" type="PackedScene" id=8]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/theme.tres" type="Theme" id=9]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/icons/cog-64-hover.svg" type="Texture" id=10]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/icons/cog-64.svg" type="Texture" id=11]
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# A simple main menu
|
||||
extends Control
|
||||
|
||||
|
||||
# Start the game
|
||||
func _on_new_game_pressed():
|
||||
escoria.new_game()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/menus/main_menu/main_menu.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/menus/savegame_feature_button.gd" type="Script" id=2]
|
||||
[ext_resource path="res://gymkhana/logo-small.png" type="Texture" id=3]
|
||||
[ext_resource path="res://addons/escoria-core/ui_library/menus/options/options.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://addons/escoria-core/ui_library/menus/load_save/load/load_game.tscn" type="PackedScene" id=5]
|
||||
@@ -41,18 +42,18 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="main/main"]
|
||||
margin_top = 40.0
|
||||
margin_top = 55.0
|
||||
margin_right = 616.0
|
||||
margin_bottom = 340.0
|
||||
margin_bottom = 355.0
|
||||
texture = ExtResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="buttons" type="VBoxContainer" parent="main/main"]
|
||||
margin_top = 440.0
|
||||
margin_top = 455.0
|
||||
margin_right = 616.0
|
||||
margin_bottom = 710.0
|
||||
margin_bottom = 695.0
|
||||
custom_constants/separation = 10
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
@@ -73,6 +74,7 @@ margin_top = 160.0
|
||||
margin_right = 616.0
|
||||
margin_bottom = 180.0
|
||||
text = "LOAD_GAME"
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
@@ -84,9 +86,9 @@ margin_bottom = 210.0
|
||||
text = "OPTIONS"
|
||||
|
||||
[node name="quit" type="Button" parent="main/main/buttons"]
|
||||
margin_top = 250.0
|
||||
margin_top = 220.0
|
||||
margin_right = 616.0
|
||||
margin_bottom = 270.0
|
||||
margin_bottom = 240.0
|
||||
text = "QUIT"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
# A menu shown in game
|
||||
extends Control
|
||||
|
||||
|
||||
# Make the pause menu process in pause mode and hide it just to be sure
|
||||
func _ready():
|
||||
self.pause_mode = Node.PAUSE_MODE_PROCESS
|
||||
hide()
|
||||
|
||||
|
||||
# Continue the game
|
||||
func _on_continue_pressed():
|
||||
escoria.main.current_scene.game.unpause_game()
|
||||
|
||||
|
||||
# Show the save slots
|
||||
func _on_save_game_pressed():
|
||||
$VBoxContainer.hide()
|
||||
$save_game.refresh_savegames()
|
||||
$save_game.show()
|
||||
|
||||
|
||||
# Show the load slots
|
||||
func _on_load_game_pressed():
|
||||
$VBoxContainer.hide()
|
||||
$load_game.refresh_savegames()
|
||||
$load_game.show()
|
||||
|
||||
|
||||
# Show the options menu
|
||||
func _on_options_pressed():
|
||||
$VBoxContainer.hide()
|
||||
$options.show()
|
||||
|
||||
|
||||
# Quit the game
|
||||
func _on_quit_pressed():
|
||||
escoria.quit()
|
||||
|
||||
|
||||
# Hide the save slots after clicking back button
|
||||
func _on_save_game_back_button_pressed():
|
||||
reset()
|
||||
|
||||
|
||||
# Hide the load slots after clicking back button
|
||||
func _on_load_game_back_button_pressed():
|
||||
reset()
|
||||
|
||||
|
||||
# Hide options menu after clicking back button
|
||||
func _on_options_back_button_pressed():
|
||||
reset()
|
||||
|
||||
|
||||
# Set whether saving is enabled currently
|
||||
#
|
||||
# #### Parameters
|
||||
# - p_enabled: Enable or disable saving
|
||||
func set_save_enabled(p_enabled: bool):
|
||||
$VBoxContainer/menuitems/save_game.disabled = !p_enabled
|
||||
|
||||
|
||||
# Resets the UI to initial state
|
||||
func reset():
|
||||
$save_game.hide()
|
||||
$load_game.hide()
|
||||
$options.hide()
|
||||
$VBoxContainer.show()
|
||||
|
||||
|
||||
func _on_new_game_pressed():
|
||||
#yield(escoria.new_game(), "completed")
|
||||
escoria.new_game()
|
||||
escoria.main.current_scene.game.unpause_game()
|
||||
@@ -0,0 +1,124 @@
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/menus/pause_menu/pause_menu.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/escoria-core/ui_library/menus/options/options.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://gymkhana/logo-small.png" type="Texture" id=3]
|
||||
[ext_resource path="res://addons/escoria-core/ui_library/menus/load_save/save/save_game.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://addons/escoria-core/ui_library/menus/load_save/load/load_game.tscn" type="PackedScene" id=5]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/menus/savegame_feature_button.gd" type="Script" id=6]
|
||||
|
||||
[node name="pause_menu" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Panel" type="Panel" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="save_game" parent="." instance=ExtResource( 4 )]
|
||||
visible = false
|
||||
|
||||
[node name="load_game" parent="." instance=ExtResource( 5 )]
|
||||
visible = false
|
||||
|
||||
[node name="options" parent="." instance=ExtResource( 2 )]
|
||||
visible = false
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -308.0
|
||||
margin_right = 308.0
|
||||
custom_constants/separation = 100
|
||||
alignment = 1
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="VBoxContainer"]
|
||||
margin_top = 25.0
|
||||
margin_right = 616.0
|
||||
margin_bottom = 325.0
|
||||
texture = ExtResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="menuitems" type="VBoxContainer" parent="VBoxContainer"]
|
||||
margin_top = 425.0
|
||||
margin_right = 616.0
|
||||
margin_bottom = 725.0
|
||||
custom_constants/separation = 10
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="continue" type="Button" parent="VBoxContainer/menuitems"]
|
||||
margin_right = 616.0
|
||||
margin_bottom = 150.0
|
||||
rect_min_size = Vector2( 0, 150 )
|
||||
size_flags_vertical = 3
|
||||
text = "CONTINUE_GAME"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="new_game" type="Button" parent="VBoxContainer/menuitems"]
|
||||
margin_top = 160.0
|
||||
margin_right = 616.0
|
||||
margin_bottom = 180.0
|
||||
size_flags_vertical = 3
|
||||
text = "NEW_GAME"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="save_game" type="Button" parent="VBoxContainer/menuitems"]
|
||||
margin_top = 190.0
|
||||
margin_right = 616.0
|
||||
margin_bottom = 210.0
|
||||
size_flags_vertical = 3
|
||||
text = "SAVE_GAME"
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="load_game" type="Button" parent="VBoxContainer/menuitems"]
|
||||
margin_top = 220.0
|
||||
margin_right = 616.0
|
||||
margin_bottom = 240.0
|
||||
size_flags_vertical = 3
|
||||
text = "LOAD_GAME"
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="options" type="Button" parent="VBoxContainer/menuitems"]
|
||||
margin_top = 250.0
|
||||
margin_right = 616.0
|
||||
margin_bottom = 270.0
|
||||
text = "OPTIONS"
|
||||
|
||||
[node name="quit" type="Button" parent="VBoxContainer/menuitems"]
|
||||
margin_top = 280.0
|
||||
margin_right = 616.0
|
||||
margin_bottom = 300.0
|
||||
size_flags_vertical = 3
|
||||
text = "QUIT"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[connection signal="back_button_pressed" from="save_game" to="." method="_on_save_game_back_button_pressed"]
|
||||
[connection signal="back_button_pressed" from="load_game" to="." method="_on_load_game_back_button_pressed"]
|
||||
[connection signal="back_button_pressed" from="options" to="." method="_on_options_back_button_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/menuitems/continue" to="." method="_on_continue_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/menuitems/new_game" to="." method="_on_new_game_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/menuitems/save_game" to="." method="_on_save_game_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/menuitems/load_game" to="." method="_on_load_game_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/menuitems/options" to="." method="_on_options_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/menuitems/quit" to="." method="_on_quit_pressed"]
|
||||
@@ -0,0 +1,8 @@
|
||||
extends Button
|
||||
|
||||
|
||||
var save_enabled = ESCProjectSettingsManager.get_setting( RTMIUiSettings.SAVEGAME_ENABLED)
|
||||
|
||||
func _process(_delta):
|
||||
self.visible = ProjectSettings.get_setting( RTMIUiSettings.SAVEGAME_ENABLED)
|
||||
|
||||
@@ -30,6 +30,13 @@ func enable_plugin():
|
||||
"type": TYPE_STRING
|
||||
}
|
||||
)
|
||||
ESCProjectSettingsManager.register_setting(
|
||||
RTMIUiSettings.SAVEGAME_ENABLED,
|
||||
true ,
|
||||
{
|
||||
"type": TYPE_BOOL
|
||||
}
|
||||
)
|
||||
else:
|
||||
get_editor_interface().set_plugin_enabled(
|
||||
get_plugin_name(),
|
||||
|
||||
@@ -5,3 +5,6 @@ const SETTINGS_ROOT = "escoria/rtmi_ui"
|
||||
|
||||
|
||||
const SOUND_LIBRARY_FOLDER = "%s/sound_library_folder" % SETTINGS_ROOT
|
||||
const DEBUG_ENABLED = "%s/debug_enabled" % SETTINGS_ROOT
|
||||
const SAVEGAME_ENABLED = "%s/savegame_enabled" % SETTINGS_ROOT
|
||||
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
[gd_resource type="Theme" load_steps=6 format=2]
|
||||
[gd_resource type="Theme" load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/fonts/caslonantique.tres" type="DynamicFont" id=1]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=4]
|
||||
bg_color = Color( 0.168627, 0.168627, 0.168627, 0.705882 )
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=1]
|
||||
content_margin_left = 4.0
|
||||
content_margin_right = 4.0
|
||||
@@ -35,7 +32,6 @@ expand_margin_bottom = 5.0
|
||||
|
||||
[resource]
|
||||
default_font = ExtResource( 1 )
|
||||
Button/styles/normal = SubResource( 4 )
|
||||
Label/colors/font_color = Color( 1, 1, 1, 1 )
|
||||
Label/colors/font_color_shadow = Color( 0, 0, 0, 0 )
|
||||
Label/colors/font_outline_modulate = Color( 1, 0, 0, 1 )
|
||||
|
||||
Reference in New Issue
Block a user