implement skipping functionality
This commit is contained in:
parent
3423505322
commit
1c6e752237
|
|
@ -21,7 +21,11 @@ class_name Collectable_Ui
|
||||||
|
|
||||||
if collapse and has_stage: State.leave_stage(self)
|
if collapse and has_stage: State.leave_stage(self)
|
||||||
|
|
||||||
@export var is_story: bool = false
|
@export var is_story: bool = false:
|
||||||
|
set(story):
|
||||||
|
is_story = story
|
||||||
|
if not story:
|
||||||
|
$Panel/Content/Buttons/VBoxContainer/collect_or_listen.text = "Order Thoughts"
|
||||||
@export var has_stage: bool = false:
|
@export var has_stage: bool = false:
|
||||||
set(focused):
|
set(focused):
|
||||||
print("set focus of card to ", focused)
|
print("set focus of card to ", focused)
|
||||||
|
|
@ -29,14 +33,11 @@ class_name Collectable_Ui
|
||||||
if has_stage == focused: return
|
if has_stage == focused: return
|
||||||
|
|
||||||
if focused:
|
if focused:
|
||||||
|
owner.reveal()
|
||||||
has_stage = true
|
has_stage = true
|
||||||
print(visible)
|
|
||||||
if not visible: show()
|
|
||||||
collapsed = false
|
collapsed = false
|
||||||
if collected:
|
if not visible: show()
|
||||||
$Panel/Content/Buttons/VBoxContainer/put_back.grab_focus()
|
$Panel/Content/Buttons/VBoxContainer/collect_or_listen.grab_focus()
|
||||||
else:
|
|
||||||
$Panel/Content/Buttons/VBoxContainer/collect_or_listen.grab_focus()
|
|
||||||
elif has_stage:
|
elif has_stage:
|
||||||
has_stage = false
|
has_stage = false
|
||||||
get_viewport().gui_release_focus()
|
get_viewport().gui_release_focus()
|
||||||
|
|
@ -72,6 +73,8 @@ class_name Collectable_Ui
|
||||||
$Panel/Content/ContentNotes.text = new_notes
|
$Panel/Content/ContentNotes.text = new_notes
|
||||||
|
|
||||||
signal card_collected
|
signal card_collected
|
||||||
|
signal open_board
|
||||||
|
signal scene_skipped(i: int)
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
|
|
@ -82,6 +85,7 @@ func _ready():
|
||||||
|
|
||||||
item_name = item_name
|
item_name = item_name
|
||||||
content_notes = content_notes
|
content_notes = content_notes
|
||||||
|
is_story = is_story
|
||||||
|
|
||||||
func _hide_buttons():
|
func _hide_buttons():
|
||||||
if is_inside_tree():
|
if is_inside_tree():
|
||||||
|
|
@ -108,6 +112,8 @@ func hide():
|
||||||
|
|
||||||
func show():
|
func show():
|
||||||
if !visible:
|
if !visible:
|
||||||
|
$Panel/Content/ContentNotes.visible = State.show_content_notes
|
||||||
|
$Panel/Content/Buttons/VBoxContainer/skip.visible = State.allow_skipping and is_story and not skipped
|
||||||
if not collapsed:
|
if not collapsed:
|
||||||
_show_buttons()
|
_show_buttons()
|
||||||
modulate = Color()
|
modulate = Color()
|
||||||
|
|
@ -122,8 +128,22 @@ func _yoink_focus():
|
||||||
func _on_pick_button_pressed():
|
func _on_pick_button_pressed():
|
||||||
print("card collected!")
|
print("card collected!")
|
||||||
if scene != null:
|
if scene != null:
|
||||||
get_tree().call_group("animation_player", "play_scene", scene)
|
get_tree().call_group("animation_player", "play_scene", scene, collected)
|
||||||
|
if skipped: emit_signal("scene_skipped", -1)
|
||||||
|
collected = true
|
||||||
|
else:
|
||||||
|
emit_signal("open_board")
|
||||||
State.leave_stage(self)
|
State.leave_stage(self)
|
||||||
|
|
||||||
func _on_pick_button_released():
|
func _on_pick_button_released():
|
||||||
hide()
|
hide()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_skip_pressed():
|
||||||
|
print("Scene skipped!")
|
||||||
|
if scene != null:
|
||||||
|
emit_signal("scene_skipped", 1)
|
||||||
|
skipped = true
|
||||||
|
$Panel/Content/Buttons/VBoxContainer/collect_or_listen.text = "collect (un-skip)"
|
||||||
|
|
||||||
|
State.leave_stage(self)
|
||||||
|
|
|
||||||
|
|
@ -137,18 +137,21 @@ text = "Collect"
|
||||||
script = SubResource("GDScript_g0qhf")
|
script = SubResource("GDScript_g0qhf")
|
||||||
|
|
||||||
[node name="Summary" type="Button" parent="Panel/Content/Buttons/VBoxContainer"]
|
[node name="Summary" type="Button" parent="Panel/Content/Buttons/VBoxContainer"]
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
tooltip_text = "Take this with you, but get a neutral description of it's story."
|
tooltip_text = "Take this with you, but get a neutral description of it's story."
|
||||||
text = "get neutral summary"
|
text = "get neutral summary"
|
||||||
script = SubResource("GDScript_g0qhf")
|
script = SubResource("GDScript_g0qhf")
|
||||||
|
|
||||||
[node name="skip" type="Button" parent="Panel/Content/Buttons/VBoxContainer"]
|
[node name="skip" type="Button" parent="Panel/Content/Buttons/VBoxContainer"]
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
tooltip_text = "Choose this to entirely skip this Item without being unable to progress in the story. Skipped Segments can still be interacted with via the Pause Screen, if you decide to change your mind."
|
tooltip_text = "Choose this to entirely skip this Item without being unable to progress in the story. Skipped Segments can still be interacted with via the Pause Screen, if you decide to change your mind."
|
||||||
text = "skip"
|
text = "skip"
|
||||||
script = SubResource("GDScript_g0qhf")
|
script = SubResource("GDScript_g0qhf")
|
||||||
|
|
||||||
[node name="put_back" type="Button" parent="Panel/Content/Buttons/VBoxContainer"]
|
[node name="put_back" type="Button" parent="Panel/Content/Buttons/VBoxContainer"]
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "put back"
|
text = "put back"
|
||||||
script = SubResource("GDScript_g0qhf")
|
script = SubResource("GDScript_g0qhf")
|
||||||
|
|
@ -172,4 +175,5 @@ libraries = {
|
||||||
[connection signal="pressed" from="Panel/Content/Buttons/VBoxContainer/collect_or_listen" to="." method="_on_pick_button_pressed"]
|
[connection signal="pressed" from="Panel/Content/Buttons/VBoxContainer/collect_or_listen" to="." method="_on_pick_button_pressed"]
|
||||||
[connection signal="focus_entered" from="Panel/Content/Buttons/VBoxContainer/Summary" to="." method="_yoink_focus"]
|
[connection signal="focus_entered" from="Panel/Content/Buttons/VBoxContainer/Summary" to="." method="_yoink_focus"]
|
||||||
[connection signal="focus_entered" from="Panel/Content/Buttons/VBoxContainer/skip" to="." method="_yoink_focus"]
|
[connection signal="focus_entered" from="Panel/Content/Buttons/VBoxContainer/skip" to="." method="_yoink_focus"]
|
||||||
|
[connection signal="pressed" from="Panel/Content/Buttons/VBoxContainer/skip" to="." method="_on_skip_pressed"]
|
||||||
[connection signal="focus_entered" from="Panel/Content/Buttons/VBoxContainer/put_back" to="." method="_yoink_focus"]
|
[connection signal="focus_entered" from="Panel/Content/Buttons/VBoxContainer/put_back" to="." method="_yoink_focus"]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue