tiger-cleanup #1
|
|
@ -32,6 +32,17 @@ var has_mouse: bool = false
|
||||||
func _ready():
|
func _ready():
|
||||||
mouse_entered.connect(_on_mouse_entered)
|
mouse_entered.connect(_on_mouse_entered)
|
||||||
|
|
||||||
|
# Wire up the CollectableUi with the CanvasLayer for story playback
|
||||||
|
var canvas = get_node_or_null("%CanvasLayer")
|
||||||
|
if canvas and ui:
|
||||||
|
ui.canvas_layer = canvas
|
||||||
|
# Find and wire the StoryPlayable if not already set
|
||||||
|
if ui.story_playable == null:
|
||||||
|
for child in canvas.get_children():
|
||||||
|
if child is StoryPlayable:
|
||||||
|
ui.story_playable = child
|
||||||
|
break
|
||||||
|
|
||||||
func _on_mouse_entered():
|
func _on_mouse_entered():
|
||||||
if not State.focus_locked:
|
if not State.focus_locked:
|
||||||
input_ray_pickable = false
|
input_ray_pickable = false
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,13 @@ extends CenterContainer
|
||||||
class_name CollectableUi
|
class_name CollectableUi
|
||||||
|
|
||||||
## The StoryPlayable to play when this memento is collected.
|
## The StoryPlayable to play when this memento is collected.
|
||||||
## Should be a child node (typically inside a CanvasLayer for full-screen display).
|
## Auto-discovered from the owner's %CanvasLayer, or can be set manually.
|
||||||
@export var story_playable: StoryPlayable
|
@export var story_playable: StoryPlayable
|
||||||
|
|
||||||
|
## Reference to the CanvasLayer containing the story_playable.
|
||||||
|
## Auto-discovered in _ready() if not set.
|
||||||
|
var canvas_layer: CanvasLayer
|
||||||
|
|
||||||
@export var has_stage: bool = false:
|
@export var has_stage: bool = false:
|
||||||
set(focused):
|
set(focused):
|
||||||
if has_stage == focused: return
|
if has_stage == focused: return
|
||||||
|
|
@ -166,8 +170,21 @@ func _ready() -> void:
|
||||||
%CollectButton.pressed.connect(collect_memento)
|
%CollectButton.pressed.connect(collect_memento)
|
||||||
##TODO: add functions for remaining buttons
|
##TODO: add functions for remaining buttons
|
||||||
|
|
||||||
|
# Auto-discover story_playable and canvas_layer from scene hierarchy
|
||||||
|
_discover_story_playable()
|
||||||
|
|
||||||
update_state()
|
update_state()
|
||||||
|
|
||||||
|
|
||||||
|
## Ensure canvas_layer is set if story_playable was set via export.
|
||||||
|
## InteractiveSprite._ready() handles the main wiring for inherited scenes.
|
||||||
|
func _discover_story_playable() -> void:
|
||||||
|
if story_playable != null and canvas_layer == null:
|
||||||
|
# story_playable set via export, find its parent CanvasLayer
|
||||||
|
var parent = story_playable.get_parent()
|
||||||
|
if parent is CanvasLayer:
|
||||||
|
canvas_layer = parent
|
||||||
|
|
||||||
func _on_context_updated() -> void:
|
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
|
||||||
|
|
@ -242,22 +259,28 @@ func collect_memento() -> void:
|
||||||
is_collected = true
|
is_collected = true
|
||||||
return
|
return
|
||||||
|
|
||||||
# Take stage and mark sequence as starting
|
# Signal that a scene is starting (for music, etc.)
|
||||||
State.take_stage(self)
|
|
||||||
Scenes.begin_sequence(scene)
|
Scenes.begin_sequence(scene)
|
||||||
|
|
||||||
# Hide mouse and collapse other interactables
|
# Hide mouse and collapse other interactables BEFORE showing canvas
|
||||||
get_tree().call_group("interactables", "collapse")
|
get_tree().call_group("interactables", "collapse")
|
||||||
Input.mouse_mode = Input.MOUSE_MODE_HIDDEN
|
Input.mouse_mode = Input.MOUSE_MODE_HIDDEN
|
||||||
|
|
||||||
# Play the story (StoryPlayable handles its own visibility via animations)
|
# Show the CanvasLayer so the story is visible full-screen
|
||||||
|
if canvas_layer:
|
||||||
|
canvas_layer.show()
|
||||||
|
|
||||||
|
# Play the story
|
||||||
await story_playable.play()
|
await story_playable.play()
|
||||||
|
|
||||||
|
# Hide the CanvasLayer when done
|
||||||
|
if canvas_layer:
|
||||||
|
canvas_layer.hide()
|
||||||
|
|
||||||
# Restore mouse
|
# Restore mouse
|
||||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||||
|
|
||||||
# Leave stage and mark sequence as finished
|
# Signal that the scene is finished
|
||||||
State.leave_stage(self)
|
|
||||||
Scenes.end_sequence(scene)
|
Scenes.end_sequence(scene)
|
||||||
|
|
||||||
if was_skipped:
|
if was_skipped:
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,10 @@ var enabled_sequences: int = 255:
|
||||||
set(stuff): pass
|
set(stuff): pass
|
||||||
var current_sequence: int = -1
|
var current_sequence: int = -1
|
||||||
|
|
||||||
|
## Returns true if a scene is currently playing.
|
||||||
|
var is_playing: bool:
|
||||||
|
get: return current_sequence != -1
|
||||||
|
|
||||||
enum id {
|
enum id {
|
||||||
YOUTH_DRAEVEN,
|
YOUTH_DRAEVEN,
|
||||||
YOUTH_CHILDHOOD,
|
YOUTH_CHILDHOOD,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue