tiger-cleanup #1
|
|
@ -19,6 +19,7 @@ func focus_object():
|
|||
|
||||
func scene_starting(id: int, _repeat: bool):
|
||||
if id == Scenes.id.YOUTH_VOICE_TRAINING:
|
||||
#BUG: This await is dangerous and can lead to focus when the user has already moved on
|
||||
await get_tree().create_timer(10).timeout
|
||||
focus_object()
|
||||
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ func _ready() -> void:
|
|||
|
||||
update_state()
|
||||
|
||||
func _on_context_updated():
|
||||
func _on_context_updated() -> void:
|
||||
%SkipButton.visible = State.allow_skipping
|
||||
%SummaryButton.visible = State.provide_summaries
|
||||
%ReadStory.visible = is_collected
|
||||
|
|
@ -172,7 +172,7 @@ func _on_context_updated():
|
|||
%OptionsLabel.visible = State.allow_skipping or State.provide_summaries or is_collected and not is_board
|
||||
cn_label.visible = true if State.show_content_notes else false
|
||||
|
||||
func update_state():
|
||||
func update_state() -> void:
|
||||
scene = scene
|
||||
is_board = is_board
|
||||
is_exit = is_exit
|
||||
|
|
@ -216,7 +216,7 @@ func _input(event: InputEvent) -> void:
|
|||
is_expanded = true
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
func vanish():
|
||||
func vanish() -> void:
|
||||
if not visible: return
|
||||
|
||||
if is_expanded:
|
||||
|
|
@ -224,19 +224,11 @@ func vanish():
|
|||
else:
|
||||
animation_player.play("vanish")
|
||||
|
||||
func collect_memento():
|
||||
func collect_memento() -> void:
|
||||
Scenes.start_sequence(scene)
|
||||
State.leave_stage(self)
|
||||
if scene == Scenes.id.TRANSITION: vanish()
|
||||
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
|
||||
|
||||
func _on_skip_pressed():
|
||||
print_debug("Scene skipped!")
|
||||
if scene != null:
|
||||
scene_skipped.emit(1)
|
||||
was_skipped = true
|
||||
$Panel/Content/Buttons/VBoxContainer/collect_or_listen.text = "collect (un-skip)"
|
||||
|
||||
State.leave_stage(self)
|
||||
|
|
|
|||
|
|
@ -887,6 +887,7 @@ layout_mode = 2
|
|||
alignment = 1
|
||||
|
||||
[node name="CollectPrompt" type="TextureRect" parent="VBoxContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
texture = ExtResource("3_g0dpf")
|
||||
expand_mode = 2
|
||||
|
|
|
|||
|
|
@ -264,58 +264,43 @@ 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) -> bool:
|
||||
print_debug("DEPRECATED: take_stage ", actor);
|
||||
return false
|
||||
#if focus_locked or Scenes.current_sequence != -1: return false
|
||||
#if reclaim:
|
||||
# stage_list.front().has_stage = false
|
||||
# if stage_list.has(actor):
|
||||
# while stage_list.pop_front() != actor: break
|
||||
# actor.has_stage = true
|
||||
# stage_list.push_front(actor)
|
||||
# return actor.has_stage
|
||||
# push_warning(actor, " wanted to reclaim focus, but was not on list.")
|
||||
#return pass_stage_to(actor)
|
||||
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) -> bool:
|
||||
print_debug("DEPRECATED: leave_stage ", actor);
|
||||
return false
|
||||
#if stage_list[0] == actor:
|
||||
# actor.has_stage = false
|
||||
# focus_locked = false
|
||||
#stage_list.erase(actor)
|
||||
|
||||
#if stage_list != []:
|
||||
# stage_list.front().has_stage = true
|
||||
#else:
|
||||
# get_tree().quit()
|
||||
#return false
|
||||
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) -> bool:
|
||||
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
|
||||
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():
|
||||
|
|
|
|||
|
|
@ -39,14 +39,15 @@ func sign_up_for_sequence(callable: Callable, sequence_id: id, index: int):
|
|||
assert(sequence_actors[sequence_id][index] == null)
|
||||
sequence_actors[sequence_id][index] = callable
|
||||
|
||||
func start_sequence(index: id):
|
||||
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.")
|
||||
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.")
|
||||
|
||||
# Leaves stage to pass it to the next element wanting to catch focus.
|
||||
func continue_sequence(former_actor: Object):
|
||||
|
|
|
|||
Loading…
Reference in New Issue