implementing signaling and staging, wip
This commit is contained in:
parent
0bf60900af
commit
97fbfce1ee
|
|
@ -11,7 +11,8 @@ enum Modes {
|
||||||
|
|
||||||
signal freeze
|
signal freeze
|
||||||
signal unfreeze
|
signal unfreeze
|
||||||
signal startup
|
signal ini_room
|
||||||
|
signal resume_room
|
||||||
|
|
||||||
var current_mode: int = Modes.FREEZE:
|
var current_mode: int = Modes.FREEZE:
|
||||||
set(new_mode):
|
set(new_mode):
|
||||||
|
|
@ -19,10 +20,7 @@ var current_mode: int = Modes.FREEZE:
|
||||||
current_mode = _update_scene(new_mode)
|
current_mode = _update_scene(new_mode)
|
||||||
|
|
||||||
func start():
|
func start():
|
||||||
emit_signal("startup")
|
emit_signal("ini_room")
|
||||||
$light_animation.play("light_up")
|
|
||||||
$AudioPlayer.play("intro")
|
|
||||||
State.pass_stage_to($PlayerController)
|
|
||||||
current_mode = Modes.WALKING
|
current_mode = Modes.WALKING
|
||||||
|
|
||||||
func _update_scene(new_mode) -> int:
|
func _update_scene(new_mode) -> int:
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -14,11 +14,6 @@ func _process(_delta):
|
||||||
look_at(look, Vector3.UP)
|
look_at(look, Vector3.UP)
|
||||||
|
|
||||||
func _unhandled_input(event):
|
func _unhandled_input(event):
|
||||||
if event is InputEventMouse:
|
|
||||||
if event is InputEventMouseButton:
|
|
||||||
if event.button_index == MOUSE_BUTTON_RIGHT:
|
|
||||||
assert(false)
|
|
||||||
return
|
|
||||||
viewport.push_input(event)
|
viewport.push_input(event)
|
||||||
|
|
||||||
func _on_input_event(_camera: Camera3D, event: InputEvent, pos: Vector3, _normal: Vector3, _shape_idx: int):
|
func _on_input_event(_camera: Camera3D, event: InputEvent, pos: Vector3, _normal: Vector3, _shape_idx: int):
|
||||||
|
|
|
||||||
|
|
@ -1491,7 +1491,6 @@ libraries = {
|
||||||
|
|
||||||
[node name="card" parent="cards/card_1" instance=ExtResource("2_dqebt")]
|
[node name="card" parent="cards/card_1" instance=ExtResource("2_dqebt")]
|
||||||
text = "Slot 1"
|
text = "Slot 1"
|
||||||
metadata/type = "card"
|
|
||||||
|
|
||||||
[node name="card_2" type="Control" parent="cards"]
|
[node name="card_2" type="Control" parent="cards"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
@ -1504,7 +1503,6 @@ libraries = {
|
||||||
|
|
||||||
[node name="card" parent="cards/card_2" instance=ExtResource("2_dqebt")]
|
[node name="card" parent="cards/card_2" instance=ExtResource("2_dqebt")]
|
||||||
text = "Slot 2"
|
text = "Slot 2"
|
||||||
metadata/type = "card"
|
|
||||||
|
|
||||||
[node name="card_3" type="Control" parent="cards"]
|
[node name="card_3" type="Control" parent="cards"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
@ -1522,7 +1520,6 @@ libraries = {
|
||||||
|
|
||||||
[node name="card" parent="cards/card_3" instance=ExtResource("2_dqebt")]
|
[node name="card" parent="cards/card_3" instance=ExtResource("2_dqebt")]
|
||||||
text = "Slot 3"
|
text = "Slot 3"
|
||||||
metadata/type = "card"
|
|
||||||
|
|
||||||
[node name="postIts" type="Panel" parent="."]
|
[node name="postIts" type="Panel" parent="."]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
extends CenterContainer
|
extends CenterContainer
|
||||||
class_name Collectable_Ui
|
class_name Collectable_Ui
|
||||||
|
|
||||||
|
@export var scene = Scenes.id
|
||||||
|
|
||||||
@export var collapsed = true:
|
@export var collapsed = true:
|
||||||
set(collapse):
|
set(collapse):
|
||||||
if is_inside_tree() and not Engine.is_editor_hint():
|
if is_inside_tree() and not Engine.is_editor_hint():
|
||||||
|
|
@ -17,6 +19,8 @@ class_name Collectable_Ui
|
||||||
_show_buttons()
|
_show_buttons()
|
||||||
collapsed = collapse
|
collapsed = collapse
|
||||||
|
|
||||||
|
if collapse and has_stage: State.leave_stage(self)
|
||||||
|
|
||||||
@export var is_story: bool = false
|
@export var is_story: bool = false
|
||||||
@export var has_stage: bool = false:
|
@export var has_stage: bool = false:
|
||||||
set(focused):
|
set(focused):
|
||||||
|
|
@ -36,9 +40,6 @@ class_name Collectable_Ui
|
||||||
elif has_stage:
|
elif has_stage:
|
||||||
has_stage = false
|
has_stage = false
|
||||||
get_viewport().gui_release_focus()
|
get_viewport().gui_release_focus()
|
||||||
#hide()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@export var collected: bool = false:
|
@export var collected: bool = false:
|
||||||
set(set_collected):
|
set(set_collected):
|
||||||
|
|
@ -100,8 +101,10 @@ func hide():
|
||||||
_hide_buttons()
|
_hide_buttons()
|
||||||
await tween.finished
|
await tween.finished
|
||||||
visible = false
|
visible = false
|
||||||
|
if has_stage: State.leave_stage(self)
|
||||||
|
|
||||||
func show():
|
func show():
|
||||||
|
if !visible:
|
||||||
if not collapsed:
|
if not collapsed:
|
||||||
_show_buttons()
|
_show_buttons()
|
||||||
modulate = Color()
|
modulate = Color()
|
||||||
|
|
@ -110,12 +113,14 @@ func show():
|
||||||
tween.tween_property(self, "modulate", Color(1, 1, 1), 0.4)
|
tween.tween_property(self, "modulate", Color(1, 1, 1), 0.4)
|
||||||
|
|
||||||
func _yoink_focus():
|
func _yoink_focus():
|
||||||
return # fixme
|
|
||||||
if not has_stage:
|
if not has_stage:
|
||||||
State.take_stage(self, true)
|
State.transition_stage_to(self)
|
||||||
|
|
||||||
func _on_pick_button_pressed():
|
func _on_pick_button_pressed():
|
||||||
hide()
|
|
||||||
print("card collected!")
|
print("card collected!")
|
||||||
emit_signal("card_collected")
|
if scene != null:
|
||||||
|
get_tree().call_group("animation_player", "play_scene", scene)
|
||||||
State.leave_stage(self)
|
State.leave_stage(self)
|
||||||
|
|
||||||
|
func _on_pick_button_released():
|
||||||
|
hide()
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,7 @@ grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
theme = ExtResource("1_2apkb")
|
theme = ExtResource("1_2apkb")
|
||||||
script = ExtResource("1_tgjc2")
|
script = ExtResource("1_tgjc2")
|
||||||
|
scene = null
|
||||||
|
|
||||||
[node name="Panel" type="PanelContainer" parent="."]
|
[node name="Panel" type="PanelContainer" parent="."]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
@ -170,6 +171,7 @@ libraries = {
|
||||||
}
|
}
|
||||||
|
|
||||||
[connection signal="resized" from="Panel/Content/Buttons/VBoxContainer" to="Panel/Content/Buttons" method="_on_v_box_container_resized"]
|
[connection signal="resized" from="Panel/Content/Buttons/VBoxContainer" to="Panel/Content/Buttons" method="_on_v_box_container_resized"]
|
||||||
|
[connection signal="button_up" from="Panel/Content/Buttons/VBoxContainer/collect_or_listen" to="." method="_on_pick_button_released"]
|
||||||
[connection signal="focus_entered" from="Panel/Content/Buttons/VBoxContainer/collect_or_listen" to="." method="_yoink_focus"]
|
[connection signal="focus_entered" from="Panel/Content/Buttons/VBoxContainer/collect_or_listen" to="." method="_yoink_focus"]
|
||||||
[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"]
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,9 @@ signal ui_exited
|
||||||
func _ready():
|
func _ready():
|
||||||
_handle_jitter(0)
|
_handle_jitter(0)
|
||||||
|
|
||||||
|
func _on_ini_room():
|
||||||
|
State.take_stage(self)
|
||||||
|
|
||||||
func _process(_delta):
|
func _process(_delta):
|
||||||
|
|
||||||
if focus_ray.get_collider() != null:
|
if focus_ray.get_collider() != null:
|
||||||
|
|
@ -148,14 +151,16 @@ func _input(event:InputEvent):
|
||||||
if event is InputEventMouseMotion and Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
|
if event is InputEventMouseMotion and Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
|
||||||
_handle_mouse_input(event)
|
_handle_mouse_input(event)
|
||||||
get_viewport().set_input_as_handled()
|
get_viewport().set_input_as_handled()
|
||||||
if event is InputEventMouseButton and has_entered:
|
if event is InputEventMouseButton and event.pressed:
|
||||||
State.free_focus()
|
State.free_focus()
|
||||||
get_viewport().set_input_as_handled()
|
get_tree().call_group("interactables", "reveal")
|
||||||
#if event.is_action_pressed("ui_accept"):
|
#if event.is_action_pressed("ui_accept"):
|
||||||
# State.pass_stage_to(focus_ray.get_collider())
|
# State.pass_stage_to(focus_ray.get_collider())
|
||||||
# get_viewport().set_input_as_handled()
|
# get_viewport().set_input_as_handled()
|
||||||
|
else:
|
||||||
func _on_empty_click():
|
if event is InputEventMouseButton:
|
||||||
|
if event.button_index == MOUSE_BUTTON_RIGHT and event.pressed:
|
||||||
|
if !Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT):
|
||||||
State.take_stage(self, true)
|
State.take_stage(self, true)
|
||||||
|
|
||||||
func _on_bed_enter(_body):
|
func _on_bed_enter(_body):
|
||||||
|
|
@ -175,5 +180,3 @@ func _on_bed_exit(_body):
|
||||||
on_crouch_cooldown = true
|
on_crouch_cooldown = true
|
||||||
await get_tree().create_timer(1.0).timeout
|
await get_tree().create_timer(1.0).timeout
|
||||||
on_crouch_cooldown = false
|
on_crouch_cooldown = false
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ config/icon="res://icon.png"
|
||||||
[autoload]
|
[autoload]
|
||||||
|
|
||||||
State="*res://singletons/global_state.gd"
|
State="*res://singletons/global_state.gd"
|
||||||
|
Scenes="*res://singletons/scene_reference.gd"
|
||||||
|
|
||||||
[debug]
|
[debug]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue