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:
Julian Murgia
2021-11-11 22:20:36 +01:00
parent 59c03dd9e2
commit c86b802cbb
56 changed files with 998 additions and 317 deletions

View File

@@ -3,8 +3,11 @@ extends ColorRect
class_name ESCTransitionPlayer
# Emitted when the transition was played
signal transition_done
signal transition_done(transition_id)
# Id of the transition. Allows keeping track of the actual transition
# being played or finished
var transition_id: int = 0
# The valid transition modes
enum TRANSITION_MODE {
@@ -47,26 +50,28 @@ func transition(
transition_name: String = "",
mode: int = TRANSITION_MODE.IN,
duration: float = 1.0
) -> void:
) -> int:
if not has_transition(transition_name):
escoria.logger.report_errors(
"transition: Transition %s not found" % transition_name,
[]
)
material = ResourceLoader.load(get_transition(transition_name))
var start = 0
var end = 1
material = ResourceLoader.load(get_transition(transition_name))
transition_id += 1
var start = 0.0
var end = 1.0
if mode == TRANSITION_MODE.OUT:
start = 1
end = 0
start = 1.0
end = 0.0
if _tween.is_active():
_was_canceled = true
_tween.stop_all()
_tween.remove_all()
emit_signal("transition_done", transition_id-1)
_tween.interpolate_property(
$".",
@@ -77,7 +82,7 @@ func transition(
)
_was_canceled = false
_tween.start()
return transition_id
# Returns the full path for a transition shader based on its name
@@ -112,6 +117,6 @@ func has_transition(name: String) -> bool:
func _on_tween_completed():
if not _was_canceled:
emit_signal("transition_done")
_tween.stop_all()
_tween.remove_all()
emit_signal("transition_done", transition_id)

View File

@@ -12,5 +12,3 @@ script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Tween" type="Tween" parent="."]