Add show_menu and hide_menu ESC commands
Fixes godot-escoria/escoria-issues#48 Fix: tween was stopped_all before starting Fix: reload locale from settings in ESCGame Since main menu and pause menu are now loaded from ESCGame and not from escoria.gd, this must be done here. Fix: small crash in load game But save and load are broken at the moment... Fix: check save and load after main menu changes Required fixes Fix: manage the game scene better in show and hide_menu Enh: transition back in to the previous room if there was one Fix a bug occurring where change_scene awaits forever for setup to end Reworked change_scene and esc_room implementation to avoid yielding Added a controller variable to allow new event run in events_manager Don't empty the events queue if the running_event was interrupted Fixed transitions and automatic transitions in change_scene Added trace log level (for esc_compiler in particular) Fixed various bugs in ESC scripts Fix a bug where exit_scene happened multiple times where fast walking Needed to clear the event queue Fixes ready event was run because BYPASS_LAST_SCENE wrongly set Inverted parameter "disable_automatic_transitions" for change_scene, hide_menu, show_menu commands Fix broken sched_event Fixes as requested in PR
This commit is contained in:
@@ -27,6 +27,11 @@ Implement methods to react to inputs.
|
||||
- hide_ui()
|
||||
- show_ui()
|
||||
|
||||
- pause_game()
|
||||
- unpause_game()
|
||||
- show_main_menu()
|
||||
- hide_main_menu()
|
||||
|
||||
- _on_event_done(event_name: String)
|
||||
"""
|
||||
|
||||
@@ -36,7 +41,6 @@ onready var tooltip = $ui/Control/panel_down/VBoxContainer/MarginContainer\
|
||||
/tooltip
|
||||
onready var room_select = $ui/Control/panel_down/VBoxContainer/HBoxContainer\
|
||||
/MainMargin/VBoxContainer/room_select
|
||||
onready var pause_menu = $ui/pause_menu
|
||||
onready var inventory_ui = $ui/Control/panel_down/VBoxContainer/HBoxContainer\
|
||||
/InventoryMargin/inventory_ui
|
||||
|
||||
@@ -195,23 +199,31 @@ func _on_event_done(_event_name: String):
|
||||
escoria.action_manager.clear_current_action()
|
||||
verbs_menu.unselect_actions()
|
||||
|
||||
func hide_main_menu():
|
||||
if get_node(main_menu).visible:
|
||||
get_node(main_menu).hide()
|
||||
|
||||
func pause_game():
|
||||
if pause_menu.visible:
|
||||
pause_menu.hide()
|
||||
func show_main_menu():
|
||||
if not get_node(main_menu).visible:
|
||||
get_node(main_menu).show()
|
||||
|
||||
func unpause_game():
|
||||
if get_node(pause_menu).visible:
|
||||
get_node(pause_menu).hide()
|
||||
escoria.object_manager.get_object("_camera").node.current = true
|
||||
escoria.main.current_scene.game.show_ui()
|
||||
escoria.main.current_scene.show()
|
||||
escoria.set_game_paused(false)
|
||||
else:
|
||||
pause_menu.set_save_enabled(escoria.save_manager.save_enabled)
|
||||
pause_menu.show()
|
||||
|
||||
func pause_game():
|
||||
if not get_node(pause_menu).visible:
|
||||
get_node(pause_menu).set_save_enabled(escoria.save_manager.save_enabled)
|
||||
get_node(pause_menu).show()
|
||||
escoria.object_manager.get_object("_camera").node.current = false
|
||||
escoria.main.current_scene.game.hide_ui()
|
||||
escoria.main.current_scene.hide()
|
||||
escoria.set_game_paused(true)
|
||||
|
||||
|
||||
func _on_MenuButton_pressed() -> void:
|
||||
pause_game()
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=11 format=2]
|
||||
[gd_scene load_steps=12 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-ui-9verbs/tooltip/action_target_tooltip.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://addons/escoria-ui-9verbs/inventory/inventory_ui.tscn" type="PackedScene" id=2]
|
||||
@@ -6,6 +6,7 @@
|
||||
[ext_resource path="res://addons/escoria-core/game/scenes/dialogs/esc_dialog_player.gd" type="Script" id=4]
|
||||
[ext_resource path="res://addons/escoria-ui-9verbs/game.gd" type="Script" id=5]
|
||||
[ext_resource path="res://addons/escoria-core/game/scenes/camera_player/camera.tscn" type="PackedScene" id=6]
|
||||
[ext_resource path="res://addons/escoria-core/ui_library/menus/main_menu/main_menu.tscn" type="PackedScene" id=7]
|
||||
[ext_resource path="res://addons/escoria-ui-9verbs/tooltip/tooltip_action_target.gd" type="Script" id=8]
|
||||
[ext_resource path="res://addons/escoria-core/ui_library/menus/pause_menu/pause_menu.tscn" type="PackedScene" id=9]
|
||||
[ext_resource path="res://addons/escoria-ui-9verbs/theme.tres" type="Theme" id=10]
|
||||
@@ -15,6 +16,8 @@ bg_color = Color( 0.6, 0.6, 0.6, 0.5 )
|
||||
|
||||
[node name="game" type="Node2D"]
|
||||
script = ExtResource( 5 )
|
||||
main_menu = NodePath("ui/main_menu")
|
||||
pause_menu = NodePath("ui/pause_menu")
|
||||
|
||||
[node name="ui" type="CanvasLayer" parent="."]
|
||||
|
||||
@@ -153,6 +156,9 @@ __meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="main_menu" parent="ui" instance=ExtResource( 7 )]
|
||||
visible = false
|
||||
|
||||
[node name="pause_menu" parent="ui" instance=ExtResource( 9 )]
|
||||
visible = false
|
||||
theme = ExtResource( 10 )
|
||||
|
||||
Reference in New Issue
Block a user