tiger-cleanup #1
|
|
@ -19,6 +19,7 @@ func focus_object():
|
||||||
|
|
||||||
func scene_starting(id: int, _repeat: bool):
|
func scene_starting(id: int, _repeat: bool):
|
||||||
if id == Scenes.id.YOUTH_VOICE_TRAINING:
|
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
|
await get_tree().create_timer(10).timeout
|
||||||
focus_object()
|
focus_object()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@ func _ready() -> void:
|
||||||
|
|
||||||
update_state()
|
update_state()
|
||||||
|
|
||||||
func _on_context_updated():
|
func _on_context_updated() -> void:
|
||||||
%SkipButton.visible = State.allow_skipping
|
%SkipButton.visible = State.allow_skipping
|
||||||
%SummaryButton.visible = State.provide_summaries
|
%SummaryButton.visible = State.provide_summaries
|
||||||
%ReadStory.visible = is_collected
|
%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
|
%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
|
cn_label.visible = true if State.show_content_notes else false
|
||||||
|
|
||||||
func update_state():
|
func update_state() -> void:
|
||||||
scene = scene
|
scene = scene
|
||||||
is_board = is_board
|
is_board = is_board
|
||||||
is_exit = is_exit
|
is_exit = is_exit
|
||||||
|
|
@ -216,7 +216,7 @@ func _input(event: InputEvent) -> void:
|
||||||
is_expanded = true
|
is_expanded = true
|
||||||
get_viewport().set_input_as_handled()
|
get_viewport().set_input_as_handled()
|
||||||
|
|
||||||
func vanish():
|
func vanish() -> void:
|
||||||
if not visible: return
|
if not visible: return
|
||||||
|
|
||||||
if is_expanded:
|
if is_expanded:
|
||||||
|
|
@ -224,19 +224,11 @@ func vanish():
|
||||||
else:
|
else:
|
||||||
animation_player.play("vanish")
|
animation_player.play("vanish")
|
||||||
|
|
||||||
func collect_memento():
|
func collect_memento() -> void:
|
||||||
Scenes.start_sequence(scene)
|
Scenes.start_sequence(scene)
|
||||||
State.leave_stage(self)
|
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)
|
#get_tree().call_group("scene_actors", "play_scene", scene, collected)
|
||||||
if was_skipped: scene_skipped.emit(-1)
|
if was_skipped: scene_skipped.emit(-1)
|
||||||
is_collected = true
|
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
|
alignment = 1
|
||||||
|
|
||||||
[node name="CollectPrompt" type="TextureRect" parent="VBoxContainer/HBoxContainer"]
|
[node name="CollectPrompt" type="TextureRect" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
texture = ExtResource("3_g0dpf")
|
texture = ExtResource("3_g0dpf")
|
||||||
expand_mode = 2
|
expand_mode = 2
|
||||||
|
|
|
||||||
|
|
@ -264,58 +264,43 @@ var stage_list:Array = []
|
||||||
var focus_locked: bool = false
|
var focus_locked: bool = false
|
||||||
|
|
||||||
# Intented for use when an actor wants focus for itself, can reclaim focus, thus dropping the stack that focused.
|
# 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:
|
func take_stage(actor: Object, _reclaim: bool = false) -> void:
|
||||||
print_debug("DEPRECATED: take_stage ", actor);
|
print_debug(">>> take_stage(", actor,")");
|
||||||
return false
|
assert(not focus_locked, "Focus is locked, %s cannot take focus." % actor)
|
||||||
#if focus_locked or Scenes.current_sequence != -1: return false
|
stage_list.push_front(actor)
|
||||||
#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)
|
|
||||||
|
|
||||||
# Element no longer wants focus, if Element itself is also dropped, this option can be chosen aswell.
|
# Element no longer wants focus, if Element itself is also dropped, this option can be chosen aswell.
|
||||||
func leave_stage(actor:Object) -> bool:
|
func leave_stage(actor:Object) -> void:
|
||||||
print_debug("DEPRECATED: leave_stage ", actor);
|
print_debug("<<< leave_stage(", actor,")");
|
||||||
return false
|
assert(actor in stage_list, "Actor %s not in stage list." % actor)
|
||||||
#if stage_list[0] == actor:
|
stage_list.erase(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
|
|
||||||
|
|
||||||
# Used to put a new target on top of the Focus Stack.
|
# Used to put a new target on top of the Focus Stack.
|
||||||
func pass_stage_to(target:Object, force = false, lock_focus = false) -> bool:
|
func pass_stage_to(target:Object, force = false, lock_focus = false) -> void:
|
||||||
if "pass_to_actor" in target:
|
return
|
||||||
return pass_stage_to(target.pass_to_actor)
|
|
||||||
if (focus_locked or get_tree().paused) and not force:
|
# if "pass_to_actor" in target:
|
||||||
push_error(target, " requested focus while it was locked or tree is paused.")
|
# return pass_stage_to(target.pass_to_actor)
|
||||||
elif !is_instance_valid(target):
|
# if (focus_locked or get_tree().paused) and not force:
|
||||||
push_error("Focus instance not valid")
|
# push_error(target, " requested focus while it was locked or tree is paused.")
|
||||||
elif !"has_stage" in target:
|
# elif !is_instance_valid(target):
|
||||||
push_error(target, " has no has focus method.")
|
# push_error("Focus instance not valid")
|
||||||
else:
|
# elif !"has_stage" in target:
|
||||||
if stage_list.size() > 0:
|
# push_error(target, " has no has focus method.")
|
||||||
if stage_list.front() == target:
|
# else:
|
||||||
push_warning(target, " is already target. Abort passing focus.")
|
# if stage_list.size() > 0:
|
||||||
return false
|
# if stage_list.front() == target:
|
||||||
if not stage_list.size() == 0: stage_list.front().has_stage = false
|
# push_warning(target, " is already target. Abort passing focus.")
|
||||||
target.has_stage = true
|
# return false
|
||||||
if target.has_stage:
|
# if not stage_list.size() == 0: stage_list.front().has_stage = false
|
||||||
stage_list.push_front(target)
|
# target.has_stage = true
|
||||||
assert(stage_list.size() < 100)
|
# if target.has_stage:
|
||||||
focus_locked = lock_focus
|
# stage_list.push_front(target)
|
||||||
return true
|
# assert(stage_list.size() < 100)
|
||||||
return false
|
# focus_locked = lock_focus
|
||||||
|
# return true
|
||||||
|
# return false
|
||||||
|
|
||||||
# Currently focused element loses focus, but remains in stack.
|
# Currently focused element loses focus, but remains in stack.
|
||||||
func free_focus():
|
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)
|
assert(sequence_actors[sequence_id][index] == null)
|
||||||
sequence_actors[sequence_id][index] = callable
|
sequence_actors[sequence_id][index] = callable
|
||||||
|
|
||||||
func start_sequence(index: id):
|
func start_sequence(_index: id):
|
||||||
if State.pass_stage_to(sequence_actors[index][0].get_object()):
|
pass
|
||||||
sequence_actors[index][0].call(index)
|
# if State.pass_stage_to(sequence_actors[index][0].get_object()):
|
||||||
current_sequence = index
|
# sequence_actors[index][0].call(index)
|
||||||
started_sequences = started_sequences | (1 << index)
|
# current_sequence = index
|
||||||
scene_starting.emit(current_sequence, is_sequence_repeating(index))
|
# started_sequences = started_sequences | (1 << index)
|
||||||
else:
|
# scene_starting.emit(current_sequence, is_sequence_repeating(index))
|
||||||
push_error("Sequence could not be started.")
|
# else:
|
||||||
|
# push_error("Sequence could not be started.")
|
||||||
|
|
||||||
# Leaves stage to pass it to the next element wanting to catch focus.
|
# Leaves stage to pass it to the next element wanting to catch focus.
|
||||||
func continue_sequence(former_actor: Object):
|
func continue_sequence(former_actor: Object):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue