Compare commits

...

2 Commits

3 changed files with 85 additions and 1 deletions

View File

@ -155,7 +155,6 @@ func _ready() -> void:
update_state()
func _on_context_updated() -> void:
%SkipButton.visible = State.allow_skipping
%SummaryButton.visible = State.provide_summaries
@ -217,6 +216,15 @@ func vanish() -> void:
animation_player.play("vanish")
func collect_memento() -> void:
<<<<<<< HEAD
Scenes.start_sequence(scene)
State.leave_stage(self)
if scene == Scenes.id.TRANSITION:
vanish()
#get_tree().call_group("scene_actors", "play_scene", scene, collected)
if was_skipped: scene_skipped.emit(-1)
is_collected = true
=======
print_debug("CollectableUi.collect_memento() - scene: %s" % Scenes.id.keys()[scene])
# Hide the collectable UI

View File

@ -253,6 +253,72 @@ func _ready():
music_volume = music_volume
#region focus handling (called staging to avoid name colisions)
# CAUTION: scene_reference directly accesses stage list to play sequences.
var stage_list:Array = []
var focus_locked: bool = false
# Intented for use when an actor wants focus for itself, can reclaim focus, thus dropping the stack that focused.
func take_stage(actor: Object, _reclaim: bool = false) -> void:
print_debug(">>> take_stage(", actor,")");
assert(not focus_locked, "Focus is locked, %s cannot take focus." % actor)
stage_list.push_front(actor)
# Element no longer wants focus, if Element itself is also dropped, this option can be chosen aswell.
func leave_stage(actor:Object) -> void:
print_debug("<<< leave_stage(", actor,")");
assert(actor in stage_list, "Actor %s not in stage list." % actor)
stage_list.erase(actor)
# Used to put a new target on top of the Focus Stack.
func pass_stage_to(target:Object, force = false, lock_focus = false) -> void:
return
# if "pass_to_actor" in target:
# return pass_stage_to(target.pass_to_actor)
# if (focus_locked or get_tree().paused) and not force:
# push_error(target, " requested focus while it was locked or tree is paused.")
# elif !is_instance_valid(target):
# push_error("Focus instance not valid")
# elif !"has_stage" in target:
# push_error(target, " has no has focus method.")
# else:
# if stage_list.size() > 0:
# if stage_list.front() == target:
# push_warning(target, " is already target. Abort passing focus.")
# return false
# if not stage_list.size() == 0: stage_list.front().has_stage = false
# target.has_stage = true
# if target.has_stage:
# stage_list.push_front(target)
# assert(stage_list.size() < 100)
# focus_locked = lock_focus
# return true
# return false
# Currently focused element loses focus, but remains in stack.
func free_focus():
if focus_locked: return false
if stage_list.size() > 0: stage_list.front().has_stage = false
func reset_focus():
stage_list = [stage_list[-1]]
func transition_stage_to(thief: Object, lock_focus = false):
focus_locked = lock_focus
if stage_list.size() > 0:
if stage_list.front().has_stage:
stage_list.pop_front().has_stage = false
return pass_stage_to(thief, true)
func queue_for_stage(target: Object, index: int = 1):
stage_list.insert(index, target)
#endregion
#region play state
enum rooms {

View File

@ -43,6 +43,16 @@ func begin_sequence(scene_id: id) -> void:
# Emit signal for other systems (music, animations, etc.)
scene_starting.emit(scene_id, is_sequence_repeating(scene_id))
func start_sequence(_index: id):
pass
# if State.pass_stage_to(sequence_actors[index][0].get_object()):
# sequence_actors[index][0].call(index)
# current_sequence = index
# started_sequences = started_sequences | (1 << index)
# scene_starting.emit(current_sequence, is_sequence_repeating(index))
# else:
# push_error("Sequence could not be started.")
# Called by CollectableUi when it finishes playing a scene
func end_sequence(scene_id: id) -> void:
print_debug(">>> Scenes.end_sequence(%s)" % id.keys()[scene_id])