refactor: card highlighting is now inherited
This commit is contained in:
parent
c20ce4054a
commit
53ace145aa
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=117 format=4 uid="uid://b3b0gyvklqn50"]
|
[gd_scene load_steps=118 format=4 uid="uid://b3b0gyvklqn50"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://bsop46tqngddc" path="res://base-environments/youth_room/youth_room.gd" id="1_aitp0"]
|
[ext_resource type="Script" uid="uid://bsop46tqngddc" path="res://base-environments/youth_room/youth_room.gd" id="1_aitp0"]
|
||||||
[ext_resource type="AudioStream" uid="uid://1h6k2d8q1kw3" path="res://base-environments/youth_room/import/sounds/rain_on_window.mp3" id="2_3haaq"]
|
[ext_resource type="AudioStream" uid="uid://1h6k2d8q1kw3" path="res://base-environments/youth_room/import/sounds/rain_on_window.mp3" id="2_3haaq"]
|
||||||
|
|
@ -851,6 +851,10 @@ _surfaces = [{
|
||||||
blend_shape_mode = 0
|
blend_shape_mode = 0
|
||||||
shadow_mesh = SubResource("ArrayMesh_lag5h")
|
shadow_mesh = SubResource("ArrayMesh_lag5h")
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_dqyng"]
|
||||||
|
radius = 0.5600586
|
||||||
|
height = 1.2539063
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_xum02"]
|
[sub_resource type="Animation" id="Animation_xum02"]
|
||||||
length = 0.001
|
length = 0.001
|
||||||
tracks/0/type = "value"
|
tracks/0/type = "value"
|
||||||
|
|
@ -1877,6 +1881,13 @@ interaction = ExtResource("12_viwxf")
|
||||||
[node name="MindBoardInteractable" parent="logic" instance=ExtResource("22_ks23q")]
|
[node name="MindBoardInteractable" parent="logic" instance=ExtResource("22_ks23q")]
|
||||||
transform = Transform3D(-4.371126e-08, 0, -0.9999984, 0, 1, 0, 0.9999984, 0, -4.371126e-08, -0.907206, 1.17661, 1.74337)
|
transform = Transform3D(-4.371126e-08, 0, -0.9999984, 0, 1, 0, 0.9999984, 0, -4.371126e-08, -0.907206, 1.17661, 1.74337)
|
||||||
interaction = ExtResource("4_gyjxx")
|
interaction = ExtResource("4_gyjxx")
|
||||||
|
billboard = false
|
||||||
|
|
||||||
|
[node name="Frame" parent="logic/MindBoardInteractable" index="0"]
|
||||||
|
transform = Transform3D(0.99999994, 0, 3.5527137e-15, 0, 1, 0, -3.5527137e-15, 0, 0.99999994, -0.08004689, -0.023632765, 0)
|
||||||
|
|
||||||
|
[node name="View" parent="logic/MindBoardInteractable" index="1"]
|
||||||
|
transform = Transform3D(-0.9999999, 0, -8.742278e-08, 0, 1, 0, 8.742278e-08, 0, -0.9999999, -0.08611119, 0.040526867, -0.06492537)
|
||||||
|
|
||||||
[node name="CeilingInteractable" parent="logic" instance=ExtResource("22_ks23q")]
|
[node name="CeilingInteractable" parent="logic" instance=ExtResource("22_ks23q")]
|
||||||
transform = Transform3D(0.78626597, 0, 0.6178859, 0, 1, 0, -0.6178859, 0, 0.78626597, -0.13478619, 2.0720484, -0.42032808)
|
transform = Transform3D(0.78626597, 0, 0.6178859, 0, 1, 0, -0.6178859, 0, 0.78626597, -0.13478619, 2.0720484, -0.42032808)
|
||||||
|
|
@ -1900,7 +1911,18 @@ transform = Transform3D(1, 0, 2.9802322e-08, 0, 1, 0, -2.9802322e-08, 0, 1, -0.0
|
||||||
transform = Transform3D(0.99999976, 0, 0, 0, 1, 0, 0, 0, 0.99999976, 0.10009599, -0.040801764, -0.19775379)
|
transform = Transform3D(0.99999976, 0, 0, 0, 1, 0, 0, 0, 0.99999976, 0.10009599, -0.040801764, -0.19775379)
|
||||||
|
|
||||||
[node name="DoorInteractable" parent="logic" instance=ExtResource("22_ks23q")]
|
[node name="DoorInteractable" parent="logic" instance=ExtResource("22_ks23q")]
|
||||||
transform = Transform3D(-0.9999984, 0, 8.7422585e-08, 0, 1, 0, -8.7422585e-08, 0, -0.9999984, 0.067167796, 1.3931, -0.954428)
|
transform = Transform3D(-0.9999984, 0, 8.7422585e-08, 0, 1, 0, -8.7422585e-08, 0, -0.9999984, 0.42437345, 0.9173807, -0.95442796)
|
||||||
|
billboard = false
|
||||||
|
|
||||||
|
[node name="View" parent="logic/DoorInteractable" index="1"]
|
||||||
|
transform = Transform3D(-0.99999964, 0, -8.7422755e-08, 0, 1, 0, 8.7422755e-08, 0, -0.99999964, 0.30241805, 0.49012983, -5.9604645e-08)
|
||||||
|
|
||||||
|
[node name="Area3D" parent="logic/DoorInteractable" index="2"]
|
||||||
|
transform = Transform3D(0.9999998, 0, 2.1316282e-14, 0, 1, 0, -2.1316282e-14, 0, 0.9999998, 0.5580833, 0.16355383, 0)
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" parent="logic/DoorInteractable/Area3D" index="0"]
|
||||||
|
transform = Transform3D(-4.371139e-08, -1, 0, 1, -4.371139e-08, 0, 0, 0, 1, -0.2322388, 0, 0)
|
||||||
|
shape = SubResource("CapsuleShape3D_dqyng")
|
||||||
|
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
libraries = {
|
libraries = {
|
||||||
|
|
@ -2162,5 +2184,7 @@ data = ExtResource("40_ea6x8")
|
||||||
[connection signal="pressed" from="logic/UI/ending_button" to="logic/UI/ending_button" method="hide"]
|
[connection signal="pressed" from="logic/UI/ending_button" to="logic/UI/ending_button" method="hide"]
|
||||||
[connection signal="pressed" from="logic/UI/ending_button" to="logic/UI/ending" method="show"]
|
[connection signal="pressed" from="logic/UI/ending_button" to="logic/UI/ending" method="show"]
|
||||||
|
|
||||||
|
[editable path="logic/MindBoardInteractable"]
|
||||||
[editable path="logic/ComicInteractable"]
|
[editable path="logic/ComicInteractable"]
|
||||||
[editable path="logic/ClothesInteractable"]
|
[editable path="logic/ClothesInteractable"]
|
||||||
|
[editable path="logic/DoorInteractable"]
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ var mementos_collected: int = 0:
|
||||||
4:
|
4:
|
||||||
instructions.text = "Combine cards to order your thoughts."
|
instructions.text = "Combine cards to order your thoughts."
|
||||||
|
|
||||||
@onready var currently_active_node: Area2D = null:
|
@onready var currently_active_node: Draggable = null:
|
||||||
set(new_node):
|
set(new_node):
|
||||||
# this makes sure no accidental context switches can happen while a card is being dragged.
|
# this makes sure no accidental context switches can happen while a card is being dragged.
|
||||||
if not (current_context == DRAG):
|
if not (current_context == DRAG):
|
||||||
|
|
|
||||||
|
|
@ -45,49 +45,50 @@ var transfor_arr: Array[Transform2D] = [
|
||||||
@export_range(1, 2) var scale_bump: float = 1.05
|
@export_range(1, 2) var scale_bump: float = 1.05
|
||||||
@export_range(1.0, 10.0) var bounce_speed: float = 5
|
@export_range(1.0, 10.0) var bounce_speed: float = 5
|
||||||
@export_range(1.0, 2.0) var highlight_brightness: float = 1.4
|
@export_range(1.0, 2.0) var highlight_brightness: float = 1.4
|
||||||
@export var highlighted: bool = false:
|
|
||||||
set(highlight):
|
|
||||||
if highlight != highlighted:
|
|
||||||
highlighted = highlight
|
|
||||||
|
|
||||||
if is_inside_tree() and is_node_ready():
|
## Override set_highlight to add visual feedback for cards
|
||||||
if scale_tween: scale_tween.kill()
|
func set_highlight(value: bool) -> void:
|
||||||
if wiggle_tween: wiggle_tween.kill()
|
if value != _highlighted:
|
||||||
if brightness_tween: brightness_tween.kill()
|
_highlighted = value
|
||||||
if highlighted:
|
|
||||||
scale_tween = get_tree().create_tween()
|
if is_inside_tree() and is_node_ready():
|
||||||
scale_tween.tween_property(self, "scale", Vector2(scale_bump, scale_bump), 0.1)
|
if scale_tween: scale_tween.kill()
|
||||||
wiggle_tween = get_tree().create_tween()
|
if wiggle_tween: wiggle_tween.kill()
|
||||||
wiggle_tween.tween_property(self, "wiggle_intensity", 1, 0.2)
|
if brightness_tween: brightness_tween.kill()
|
||||||
brightness_tween = get_tree().create_tween()
|
if _highlighted:
|
||||||
brightness_tween.set_parallel(true)
|
scale_tween = get_tree().create_tween()
|
||||||
brightness_tween.tween_property(background_sprite, "modulate", Color(highlight_brightness, highlight_brightness, highlight_brightness), 0.15)
|
scale_tween.tween_property(self, "scale", Vector2(scale_bump, scale_bump), 0.1)
|
||||||
brightness_tween.tween_property(label, "modulate", Color(highlight_brightness, highlight_brightness, highlight_brightness), 0.15)
|
wiggle_tween = get_tree().create_tween()
|
||||||
else:
|
wiggle_tween.tween_property(self, "wiggle_intensity", 1, 0.2)
|
||||||
scale_tween = get_tree().create_tween()
|
brightness_tween = get_tree().create_tween()
|
||||||
scale_tween.tween_property(self, "scale", Vector2(1, 1), 0.3)
|
brightness_tween.set_parallel(true)
|
||||||
wiggle_tween = get_tree().create_tween()
|
brightness_tween.tween_property(background_sprite, "modulate", Color(highlight_brightness, highlight_brightness, highlight_brightness), 0.15)
|
||||||
wiggle_tween.tween_property(self, "wiggle_intensity", 0, 0.5)
|
brightness_tween.tween_property(label, "modulate", Color(highlight_brightness, highlight_brightness, highlight_brightness), 0.15)
|
||||||
brightness_tween = get_tree().create_tween()
|
|
||||||
brightness_tween.set_parallel(true)
|
|
||||||
brightness_tween.tween_property(background_sprite, "modulate", Color.WHITE, 0.2)
|
|
||||||
brightness_tween.tween_property(label, "modulate", Color.WHITE, 0.2)
|
|
||||||
else:
|
else:
|
||||||
if highlighted:
|
scale_tween = get_tree().create_tween()
|
||||||
scale = Vector2(scale_bump, scale_bump)
|
scale_tween.tween_property(self, "scale", Vector2(1, 1), 0.3)
|
||||||
wiggle_intensity = 1
|
wiggle_tween = get_tree().create_tween()
|
||||||
if background_sprite:
|
wiggle_tween.tween_property(self, "wiggle_intensity", 0, 0.5)
|
||||||
background_sprite.modulate = Color(highlight_brightness, highlight_brightness, highlight_brightness)
|
brightness_tween = get_tree().create_tween()
|
||||||
if label:
|
brightness_tween.set_parallel(true)
|
||||||
label.modulate = Color(highlight_brightness, highlight_brightness, highlight_brightness)
|
brightness_tween.tween_property(background_sprite, "modulate", Color.WHITE, 0.2)
|
||||||
else:
|
brightness_tween.tween_property(label, "modulate", Color.WHITE, 0.2)
|
||||||
scale = Vector2(1,1)
|
else:
|
||||||
wiggle_intensity = 0
|
if _highlighted:
|
||||||
if background_sprite:
|
scale = Vector2(scale_bump, scale_bump)
|
||||||
background_sprite.modulate = Color.WHITE
|
wiggle_intensity = 1
|
||||||
if label:
|
if background_sprite:
|
||||||
label.modulate = Color.WHITE
|
background_sprite.modulate = Color(highlight_brightness, highlight_brightness, highlight_brightness)
|
||||||
|
if label:
|
||||||
|
label.modulate = Color(highlight_brightness, highlight_brightness, highlight_brightness)
|
||||||
|
else:
|
||||||
|
scale = Vector2(1,1)
|
||||||
|
wiggle_intensity = 0
|
||||||
|
if background_sprite:
|
||||||
|
background_sprite.modulate = Color.WHITE
|
||||||
|
if label:
|
||||||
|
label.modulate = Color.WHITE
|
||||||
|
|
||||||
@export var voice_line: AudioStream = null
|
@export var voice_line: AudioStream = null
|
||||||
@export var is_dragable: bool = false
|
@export var is_dragable: bool = false
|
||||||
@export var diameter := 336.0
|
@export var diameter := 336.0
|
||||||
|
|
@ -104,7 +105,7 @@ var transfor_arr: Array[Transform2D] = [
|
||||||
card_fire.material.set_shader_parameter("fire_progression", 0)
|
card_fire.material.set_shader_parameter("fire_progression", 0)
|
||||||
background_sprite.material = null
|
background_sprite.material = null
|
||||||
remove_child(card_fire)
|
remove_child(card_fire)
|
||||||
|
|
||||||
burn_progress = burn
|
burn_progress = burn
|
||||||
if background_sprite != null and card_fire != null and burn_progress > 0:
|
if background_sprite != null and card_fire != null and burn_progress > 0:
|
||||||
background_sprite.material.set_shader_parameter("fire_progression", burn_progress)
|
background_sprite.material.set_shader_parameter("fire_progression", burn_progress)
|
||||||
|
|
@ -151,58 +152,58 @@ var mouse_offset: Vector2
|
||||||
func init(card_name: String = "card", own_id:StringName = "-1") -> void:
|
func init(card_name: String = "card", own_id:StringName = "-1") -> void:
|
||||||
if card_name != "c_void":
|
if card_name != "c_void":
|
||||||
text = card_name
|
text = card_name
|
||||||
if !card_name.begins_with("c"):
|
if !card_name.begins_with("c"):
|
||||||
push_error("Illegal card.")
|
push_error("Illegal card.")
|
||||||
card_id = own_id
|
card_id = own_id
|
||||||
name = card_name
|
name = card_name
|
||||||
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
input_event.connect(_on_input_event)
|
input_event.connect(_on_input_event)
|
||||||
|
|
||||||
_handle_wiggle(0)
|
_handle_wiggle(0)
|
||||||
_on_text_updated.call_deferred()
|
_on_text_updated.call_deferred()
|
||||||
|
|
||||||
func _on_text_updated():
|
func _on_text_updated():
|
||||||
if is_node_ready():
|
if is_node_ready():
|
||||||
var curr_frame := text.hash() % background_sprite.sprite_frames.get_frame_count(background_sprite.animation)
|
var curr_frame := text.hash() % background_sprite.sprite_frames.get_frame_count(background_sprite.animation)
|
||||||
background_sprite.frame = curr_frame
|
background_sprite.frame = curr_frame
|
||||||
|
|
||||||
if text == "":
|
if text == "":
|
||||||
if background_sprite.get_child_count() == 0:
|
if background_sprite.get_child_count() == 0:
|
||||||
background_sprite.add_child(load("res://logic-scenes/board/void_stuff.tscn").instantiate(), false, Node.INTERNAL_MODE_DISABLED)
|
background_sprite.add_child(load("res://logic-scenes/board/void_stuff.tscn").instantiate(), false, Node.INTERNAL_MODE_DISABLED)
|
||||||
else:
|
else:
|
||||||
if background_sprite.get_child_count() > 0:
|
if background_sprite.get_child_count() > 0:
|
||||||
background_sprite.get_child(0).queue_free()
|
background_sprite.get_child(0).queue_free()
|
||||||
|
|
||||||
label.text = text
|
label.text = text
|
||||||
|
|
||||||
wiggle_pos = float(text.hash() % 100)
|
wiggle_pos = float(text.hash() % 100)
|
||||||
|
|
||||||
label.rotation = deg_to_rad(transfor_arr[curr_frame].get_rotation())
|
label.rotation = deg_to_rad(transfor_arr[curr_frame].get_rotation())
|
||||||
#label.position = transfor_arr[curr_frame].origin
|
#label.position = transfor_arr[curr_frame].origin
|
||||||
|
|
||||||
burn_progress = burn_progress
|
burn_progress = burn_progress
|
||||||
|
|
||||||
if not Engine.is_editor_hint():
|
if not Engine.is_editor_hint():
|
||||||
_handle_wiggle(0)
|
_handle_wiggle(0)
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
if highlighted:
|
if highlighted:
|
||||||
_handle_wiggle(delta)
|
_handle_wiggle(delta)
|
||||||
|
|
||||||
if get_overlapping_areas().size() > 0 and is_dragable:
|
if get_overlapping_areas().size() > 0 and is_dragable:
|
||||||
for area in get_overlapping_areas():
|
for area in get_overlapping_areas():
|
||||||
if area is Card:
|
if area is Card:
|
||||||
if not (area.highlighted or self.highlighted) and area.is_dragable:
|
if not (area.highlighted or self.highlighted) and area.is_dragable:
|
||||||
var diff:Vector2 = position - area.position
|
var diff:Vector2 = position - area.position
|
||||||
position -= diff.normalized() * ((diff.length()-diameter)/diameter) * bounce_speed * (delta/(1.0/60))
|
position -= diff.normalized() * ((diff.length()-diameter)/diameter) * bounce_speed * (delta/(1.0/60))
|
||||||
|
|
||||||
_move_card()
|
_move_card()
|
||||||
|
|
||||||
func _handle_wiggle(delta):
|
func _handle_wiggle(delta):
|
||||||
wiggle_pos += delta * wiggle_speed * wiggle_intensity
|
wiggle_pos += delta * wiggle_speed * wiggle_intensity
|
||||||
|
|
||||||
rotation = noise.get_noise_1d(wiggle_pos)*wiggle_strength
|
rotation = noise.get_noise_1d(wiggle_pos)*wiggle_strength
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -243,7 +244,7 @@ func get_attached_sticky_note() -> StickyNote:
|
||||||
if child is StickyNote:
|
if child is StickyNote:
|
||||||
return child
|
return child
|
||||||
return null
|
return null
|
||||||
|
|
||||||
|
|
||||||
func preview_sticky_note(sticky_note: StickyNote):
|
func preview_sticky_note(sticky_note: StickyNote):
|
||||||
if not is_instance_valid(sticky_note):
|
if not is_instance_valid(sticky_note):
|
||||||
|
|
@ -260,7 +261,7 @@ func preview_sticky_note(sticky_note: StickyNote):
|
||||||
func attach_sticky_note(sticky_note: StickyNote) -> bool:
|
func attach_sticky_note(sticky_note: StickyNote) -> bool:
|
||||||
if has_sticky_note_attached():
|
if has_sticky_note_attached():
|
||||||
return false
|
return false
|
||||||
|
|
||||||
sticky_note.reparent(self)
|
sticky_note.reparent(self)
|
||||||
sticky_note.position = sticky_note_position
|
sticky_note.position = sticky_note_position
|
||||||
sticky_note.on_board = false
|
sticky_note.on_board = false
|
||||||
|
|
@ -268,15 +269,15 @@ func attach_sticky_note(sticky_note: StickyNote) -> bool:
|
||||||
current_sticky_note = sticky_note
|
current_sticky_note = sticky_note
|
||||||
#var former_parent = sticky_note.attached_to
|
#var former_parent = sticky_note.attached_to
|
||||||
sticky_note.attached_to = self
|
sticky_note.attached_to = self
|
||||||
|
|
||||||
if name == "c_hit" and sticky_note.name == "c_effort" and Steamworks.has_initialized:
|
if name == "c_hit" and sticky_note.name == "c_effort" and Steamworks.has_initialized:
|
||||||
Steam.setAchievement("FIGHT_FOR_GOOD")
|
Steam.setAchievement("FIGHT_FOR_GOOD")
|
||||||
Steam.storeStats()
|
Steam.storeStats()
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|
||||||
func remove_sticky_note() -> StickyNote:
|
func remove_sticky_note() -> StickyNote:
|
||||||
var former_child:StickyNote = get_attached_sticky_note()
|
var former_child:StickyNote = get_attached_sticky_note()
|
||||||
current_sticky_note = null
|
current_sticky_note = null
|
||||||
former_child.reparent(get_parent())
|
former_child.reparent(get_parent())
|
||||||
former_child.owner = self.owner
|
former_child.owner = self.owner
|
||||||
|
|
@ -316,7 +317,7 @@ func can_accept_drop(draggable: Draggable) -> bool:
|
||||||
func handle_drop(draggable: StickyNote) -> int:
|
func handle_drop(draggable: StickyNote) -> int:
|
||||||
if not can_accept_drop(draggable):
|
if not can_accept_drop(draggable):
|
||||||
return Draggable.DropResult.REJECTED
|
return Draggable.DropResult.REJECTED
|
||||||
|
|
||||||
if has_sticky_note_attached():
|
if has_sticky_note_attached():
|
||||||
# Exchange: remove current, attach new, store old for retrieval
|
# Exchange: remove current, attach new, store old for retrieval
|
||||||
_last_exchanged_sticky = exchange_sticky_note_with(draggable)
|
_last_exchanged_sticky = exchange_sticky_note_with(draggable)
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,19 @@ var is_dragged: bool = false:
|
||||||
is_dragged = dragged
|
is_dragged = dragged
|
||||||
z_index = int(dragged)
|
z_index = int(dragged)
|
||||||
|
|
||||||
|
## Internal highlighted state - do not set directly, use set_highlight()
|
||||||
|
var _highlighted: bool = false
|
||||||
|
|
||||||
|
## Public highlighted property - use for reading state
|
||||||
|
var highlighted: bool:
|
||||||
|
get: return _highlighted
|
||||||
|
set(value): set_highlight(value)
|
||||||
|
|
||||||
|
## Sets the highlight state - override in subclasses for visual feedback
|
||||||
|
## Base implementation just updates the internal state
|
||||||
|
func set_highlight(value: bool) -> void:
|
||||||
|
_highlighted = value
|
||||||
|
|
||||||
## Margin from screen edges when confining to screen bounds
|
## Margin from screen edges when confining to screen bounds
|
||||||
@export var screen_margin: float = 50.0
|
@export var screen_margin: float = 50.0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,29 +31,30 @@ var label: Label
|
||||||
|
|
||||||
@export var shift_by: Vector2 = Vector2(-32, 0)
|
@export var shift_by: Vector2 = Vector2(-32, 0)
|
||||||
@export_color_no_alpha var highlight_color: Color = Color(1.5, 1.5, 1.5)
|
@export_color_no_alpha var highlight_color: Color = Color(1.5, 1.5, 1.5)
|
||||||
@export var highlighted: bool = false:
|
|
||||||
set(highlight):
|
|
||||||
if highlight != highlighted:
|
|
||||||
highlighted = highlight
|
|
||||||
|
|
||||||
if is_inside_tree() and is_node_ready():
|
## Override set_highlight to add visual feedback for sticky notes
|
||||||
if modulate_tween: modulate_tween.kill()
|
func set_highlight(value: bool) -> void:
|
||||||
if shift_tween: shift_tween.kill()
|
if value != _highlighted:
|
||||||
if highlighted:
|
_highlighted = value
|
||||||
modulate_tween = get_tree().create_tween()
|
|
||||||
modulate_tween.tween_property(self, "modulate", highlight_color, 0.1)
|
if is_inside_tree() and is_node_ready():
|
||||||
shift_tween = get_tree().create_tween()
|
if modulate_tween: modulate_tween.kill()
|
||||||
shift_tween.tween_property(content, "position", shift_by, 0.2)
|
if shift_tween: shift_tween.kill()
|
||||||
else:
|
if _highlighted:
|
||||||
modulate_tween = get_tree().create_tween()
|
modulate_tween = get_tree().create_tween()
|
||||||
modulate_tween.tween_property(self, "modulate", Color(1, 1, 1), 0.3)
|
modulate_tween.tween_property(self, "modulate", highlight_color, 0.1)
|
||||||
shift_tween = get_tree().create_tween()
|
shift_tween = get_tree().create_tween()
|
||||||
shift_tween.tween_property(content, "position", Vector2.ZERO, 0.5)
|
shift_tween.tween_property(content, "position", shift_by, 0.2)
|
||||||
else:
|
else:
|
||||||
if highlighted:
|
modulate_tween = get_tree().create_tween()
|
||||||
modulate = Color(1, 1, 1)
|
modulate_tween.tween_property(self, "modulate", Color(1, 1, 1), 0.3)
|
||||||
else:
|
shift_tween = get_tree().create_tween()
|
||||||
modulate = Color(1, 1, 1)
|
shift_tween.tween_property(content, "position", Vector2.ZERO, 0.5)
|
||||||
|
else:
|
||||||
|
if _highlighted:
|
||||||
|
modulate = Color(1, 1, 1)
|
||||||
|
else:
|
||||||
|
modulate = Color(1, 1, 1)
|
||||||
|
|
||||||
@export var voice_line: AudioStream = null
|
@export var voice_line: AudioStream = null
|
||||||
@export var is_dragable: bool = false
|
@export var is_dragable: bool = false
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ signal cards_picked(cardnames: Array[String])
|
||||||
# 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() -> void:
|
func _ready() -> void:
|
||||||
if current_scene_id != Scenes.id.NONE:
|
if current_scene_id != Scenes.id.NONE:
|
||||||
pick_cards(current_scene_id, false)
|
pick_cards(current_scene_id)
|
||||||
|
|
||||||
|
|
||||||
func reset():
|
func reset():
|
||||||
|
|
@ -176,7 +176,6 @@ func pick(id: int) -> void:
|
||||||
print_debug("Randomly selected card %s" % HardCards.get_obscure_name(options[1].name))
|
print_debug("Randomly selected card %s" % HardCards.get_obscure_name(options[1].name))
|
||||||
if not (current_scene_id == Scenes.id.YOUTH_JUI_JUTSU and selection_state == CARDS_SELECTED):
|
if not (current_scene_id == Scenes.id.YOUTH_JUI_JUTSU and selection_state == CARDS_SELECTED):
|
||||||
randomize()
|
randomize()
|
||||||
# investigate if this fixes error on line 197
|
|
||||||
winning_id = randi() % options.size() - ( 1 if selection_state == POSTS_SELECTED else 0)
|
winning_id = randi() % options.size() - ( 1 if selection_state == POSTS_SELECTED else 0)
|
||||||
else:
|
else:
|
||||||
winning_id = 1 if id == 0 else 0
|
winning_id = 1 if id == 0 else 0
|
||||||
|
|
@ -237,22 +236,21 @@ func handle_mouse_button(button_event: InputEventMouseButton, new_selection: Nod
|
||||||
pick(options.find(new_selection))
|
pick(options.find(new_selection))
|
||||||
|
|
||||||
|
|
||||||
func pick_cards(id: Scenes.id, repeat: bool):
|
func pick_cards(id: Scenes.id):
|
||||||
current_scene_id = id
|
current_scene_id = id
|
||||||
print_debug("Reached actor %s in sequence %s. Is%s repeating." % [name, Scenes.id.keys()[id], " not" if repeat else ""])
|
hide()
|
||||||
if not repeat:
|
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||||
hide()
|
fill_card_slots(id)
|
||||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
reset()
|
||||||
fill_card_slots(id)
|
show()
|
||||||
reset()
|
selection_state = CARDS
|
||||||
show()
|
|
||||||
selection_state = CARDS
|
|
||||||
if id == Scenes.id.YOUTH_DRAVEN and not repeat:
|
|
||||||
$Meaning.play()
|
|
||||||
State.room.scene_player.play("intro")
|
|
||||||
|
|
||||||
await cards_picked
|
if id == Scenes.id.YOUTH_DRAVEN:
|
||||||
hide()
|
$Meaning.play()
|
||||||
await get_tree().process_frame
|
State.room.scene_player.play("intro")
|
||||||
State.room.save_room()
|
|
||||||
|
await cards_picked
|
||||||
|
hide()
|
||||||
|
await get_tree().process_frame
|
||||||
|
State.room.save_room()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@ func collect_memento() -> void:
|
||||||
if interaction_ui is StoryPlayable:
|
if interaction_ui is StoryPlayable:
|
||||||
# Pick the cards
|
# Pick the cards
|
||||||
var picker := State.room.get_node("%Picker") as CardPicker
|
var picker := State.room.get_node("%Picker") as CardPicker
|
||||||
await picker.pick_cards(interaction_ui.scene_id, false)
|
await picker.pick_cards(interaction_ui.scene_id)
|
||||||
|
|
||||||
# Hide the CanvasLayer when done
|
# Hide the CanvasLayer when done
|
||||||
canvas_layer.hide()
|
canvas_layer.hide()
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ var collected : bool = false:
|
||||||
var tween: Tween = null
|
var tween: Tween = null
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
assert(note and frame and canvas_layer, "Interactable must have views and frame attached")
|
assert(note and frame and canvas_layer, "Interactable must have views and frame attached")
|
||||||
view.scale = Vector3.ZERO
|
view.scale = Vector3.ZERO
|
||||||
frame.modulate.a = 0
|
frame.modulate.a = 0
|
||||||
if interaction:
|
if interaction:
|
||||||
|
|
@ -48,15 +48,15 @@ func _player_active(value: bool) -> void:
|
||||||
func expand() -> void:
|
func expand() -> void:
|
||||||
shown = true
|
shown = true
|
||||||
_process_billboard()
|
_process_billboard()
|
||||||
|
|
||||||
if tween and tween.is_valid():
|
if tween and tween.is_valid():
|
||||||
tween.kill()
|
tween.kill()
|
||||||
else:
|
else:
|
||||||
view.scale = Vector3.ZERO
|
view.scale = Vector3.ZERO
|
||||||
note.rotation.z = -PI*0.5 # Godot angle wrapping is ... something
|
note.rotation.z = -PI*0.5 # Godot angle wrapping is ... something
|
||||||
frame.modulate = Color.TRANSPARENT
|
frame.modulate = Color.TRANSPARENT
|
||||||
frame.scale = Vector3(1.5, 1.5, 1.5)
|
frame.scale = Vector3(1.5, 1.5, 1.5)
|
||||||
|
|
||||||
tween = create_tween().set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_BACK)
|
tween = create_tween().set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_BACK)
|
||||||
tween.parallel().tween_property(view, "scale", Vector3.ONE, 1.0).set_delay(0.5)
|
tween.parallel().tween_property(view, "scale", Vector3.ONE, 1.0).set_delay(0.5)
|
||||||
tween.parallel().tween_property(note, "rotation:z", 0, 0.8).set_delay(0.5)
|
tween.parallel().tween_property(note, "rotation:z", 0, 0.8).set_delay(0.5)
|
||||||
|
|
@ -92,7 +92,7 @@ func _process_hover() -> void:
|
||||||
func _input(event: InputEvent) -> void:
|
func _input(event: InputEvent) -> void:
|
||||||
if not active or not hover or not shown: return
|
if not active or not hover or not shown: return
|
||||||
|
|
||||||
var clicked : bool = (event.is_action_pressed("ui_accept")) or (event is InputEventMouseButton and event.pressed)
|
var clicked : bool = (event.is_action_pressed("ui_accept")) or (event is InputEventMouseButton and event.is_pressed())
|
||||||
if hover and shown and clicked:
|
if hover and shown and clicked:
|
||||||
collect_memento()
|
collect_memento()
|
||||||
|
|
||||||
|
|
@ -101,14 +101,14 @@ func play_story() -> void:
|
||||||
var repeat := collected
|
var repeat := collected
|
||||||
collected = true
|
collected = true
|
||||||
canvas_layer.show()
|
canvas_layer.show()
|
||||||
|
|
||||||
# Check if this is a repeat playthrough
|
# Check if this is a repeat playthrough
|
||||||
var is_repeating := Scenes.is_sequence_repeating(interaction_ui.scene_id)
|
var is_repeating := Scenes.is_sequence_repeating(interaction_ui.scene_id)
|
||||||
|
|
||||||
# Allow room to prepare for scene (e.g., play animations)
|
# Allow room to prepare for scene (e.g., play animations)
|
||||||
if State.room and State.room.has_method("prepare_scene_start"):
|
if State.room and State.room.has_method("prepare_scene_start"):
|
||||||
await State.room.prepare_scene_start(interaction_ui.scene_id, is_repeating)
|
await State.room.prepare_scene_start(interaction_ui.scene_id, is_repeating)
|
||||||
|
|
||||||
Scenes.begin_sequence(interaction_ui.scene_id)
|
Scenes.begin_sequence(interaction_ui.scene_id)
|
||||||
|
|
||||||
# Play the story
|
# Play the story
|
||||||
|
|
@ -117,12 +117,12 @@ func play_story() -> void:
|
||||||
# Pick the cards if not already picked
|
# Pick the cards if not already picked
|
||||||
if not repeat:
|
if not repeat:
|
||||||
var picker := State.room.get_node("%Picker") as CardPicker
|
var picker := State.room.get_node("%Picker") as CardPicker
|
||||||
await picker.pick_cards(interaction_ui.scene_id, false)
|
await picker.pick_cards(interaction_ui.scene_id)
|
||||||
|
|
||||||
|
|
||||||
# Hide the CanvasLayer when done
|
# Hide the CanvasLayer when done
|
||||||
canvas_layer.hide()
|
canvas_layer.hide()
|
||||||
|
|
||||||
Scenes.end_sequence(interaction_ui.scene_id) # todo: maybe later?
|
Scenes.end_sequence(interaction_ui.scene_id) # todo: maybe later?
|
||||||
|
|
||||||
Scenes.player_enable.emit(true)
|
Scenes.player_enable.emit(true)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue