implementing zoom, amaze hotfixes
This commit is contained in:
parent
0564f994ec
commit
08ff85d768
|
|
@ -21,9 +21,10 @@ func _ready():
|
||||||
connect("mouse_entered", Callable(self, "_on_mouse_entered"))
|
connect("mouse_entered", Callable(self, "_on_mouse_entered"))
|
||||||
|
|
||||||
func _on_mouse_entered():
|
func _on_mouse_entered():
|
||||||
input_ray_pickable = false
|
if not State.focus_locked:
|
||||||
ui.collapsed = false
|
input_ray_pickable = false
|
||||||
has_mouse = true
|
ui.collapsed = false
|
||||||
|
has_mouse = true
|
||||||
|
|
||||||
func _on_mouse_exited():
|
func _on_mouse_exited():
|
||||||
print("mouse_exited")
|
print("mouse_exited")
|
||||||
|
|
|
||||||
|
|
@ -17,19 +17,20 @@ func _unhandled_input(event):
|
||||||
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):
|
||||||
# Position of the event in Sprite3D local coordinates.
|
if not State.focus_locked:
|
||||||
var texture_3d_position = sprite.get_global_transform().affine_inverse() * pos
|
# Position of the event in Sprite3D local coordinates.
|
||||||
#if !is_zero_approx(texture_3d_position.z):
|
var texture_3d_position = sprite.get_global_transform().affine_inverse() * pos
|
||||||
# # Discard event because event didn't happen on the side of the Sprite3D.
|
#if !is_zero_approx(texture_3d_position.z):
|
||||||
# return
|
# # Discard event because event didn't happen on the side of the Sprite3D.
|
||||||
# Position of the event relative to the texture.
|
# return
|
||||||
var texture_position: Vector2 = Vector2(texture_3d_position.x, -texture_3d_position.y) / sprite.pixel_size - sprite.get_item_rect().position
|
# Position of the event relative to the texture.
|
||||||
# Send mouse event.
|
var texture_position: Vector2 = Vector2(texture_3d_position.x, -texture_3d_position.y) / sprite.pixel_size - sprite.get_item_rect().position
|
||||||
var e: InputEvent = event.duplicate()
|
# Send mouse event.
|
||||||
if e is InputEventMouse:
|
var e: InputEvent = event.duplicate()
|
||||||
e.set_position(texture_position)
|
if e is InputEventMouse:
|
||||||
e.set_global_position(texture_position)
|
e.set_position(texture_position)
|
||||||
viewport.push_input(e)
|
e.set_global_position(texture_position)
|
||||||
|
viewport.push_input(e)
|
||||||
|
|
||||||
func _on_button_pressed():
|
func _on_button_pressed():
|
||||||
print("Button pressed")
|
print("Button pressed")
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,11 @@ var has_stage = false:
|
||||||
set(focus):
|
set(focus):
|
||||||
if focus:
|
if focus:
|
||||||
has_stage = true
|
has_stage = true
|
||||||
self.mouse_filter = Control.MOUSE_FILTER_PASS
|
self.mouse_filter = Control.MOUSE_FILTER_PASS
|
||||||
get_tree().call_group("interactables", "collapse")
|
get_tree().call_group("interactables", "collapse")
|
||||||
else:
|
else:
|
||||||
has_stage = false
|
has_stage = false
|
||||||
self.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
self.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
if is_node_ready():
|
if is_node_ready():
|
||||||
if focus:
|
if focus:
|
||||||
process_mode = Node.PROCESS_MODE_INHERIT
|
process_mode = Node.PROCESS_MODE_INHERIT
|
||||||
|
|
@ -115,6 +115,7 @@ func _ready():
|
||||||
if get_parent() == get_tree().root:
|
if get_parent() == get_tree().root:
|
||||||
populate_board(["c_void", 'c_joy', "p_wet", "p_thomas"])
|
populate_board(["c_void", 'c_joy', "p_wet", "p_thomas"])
|
||||||
populate_board(["c_fighting", 'c_hit', "p_girly", "p_vent"])
|
populate_board(["c_fighting", 'c_hit', "p_girly", "p_vent"])
|
||||||
|
mementos_collected = 2
|
||||||
|
|
||||||
has_stage = has_stage
|
has_stage = has_stage
|
||||||
|
|
||||||
|
|
@ -199,6 +200,7 @@ func handle_mouse_button(to_handle: Area2D, input: InputEvent):
|
||||||
if not sticky_note_container.get_child_count() == 0:
|
if not sticky_note_container.get_child_count() == 0:
|
||||||
sticky_note_container.get_child(current_sticky_note_id).clear_if_empty()
|
sticky_note_container.get_child(current_sticky_note_id).clear_if_empty()
|
||||||
current_context = NAVIGATE
|
current_context = NAVIGATE
|
||||||
|
if is_board_complete(): emit_signal("board_completed")
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
_return_sticky_notes_to_panels()
|
_return_sticky_notes_to_panels()
|
||||||
|
|
@ -313,6 +315,7 @@ func _input(event):
|
||||||
card.attach_sticky_note(sticky_note_container.get_child(current_sticky_note_id).attached_sticky_note)
|
card.attach_sticky_note(sticky_note_container.get_child(current_sticky_note_id).attached_sticky_note)
|
||||||
current_context = NAVIGATE
|
current_context = NAVIGATE
|
||||||
focus_stickies = false
|
focus_stickies = false
|
||||||
|
if is_board_complete(): emit_signal("board_completed")
|
||||||
else:
|
else:
|
||||||
if !focus_stickies and card.has_sticky_note_attached():
|
if !focus_stickies and card.has_sticky_note_attached():
|
||||||
currently_active_node = card.remove_sticky_note()
|
currently_active_node = card.remove_sticky_note()
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
size_flags_horizontal = 6
|
size_flags_horizontal = 6
|
||||||
size_flags_vertical = 6
|
size_flags_vertical = 6
|
||||||
mouse_filter = 1
|
mouse_filter = 2
|
||||||
script = ExtResource("3_8v4c4")
|
script = ExtResource("3_8v4c4")
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||||
|
|
|
||||||
|
|
@ -132,3 +132,6 @@ func tween_transform_to(target: Transform2D):
|
||||||
func reset_drag():
|
func reset_drag():
|
||||||
if attached_to != null:
|
if attached_to != null:
|
||||||
attached_to.reclaim_sticky_note()
|
attached_to.reclaim_sticky_note()
|
||||||
|
|
||||||
|
func _enter_tree():
|
||||||
|
print("enter_tree")
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,9 @@ var has_stage = false:
|
||||||
if focus:
|
if focus:
|
||||||
process_mode = Node.PROCESS_MODE_INHERIT
|
process_mode = Node.PROCESS_MODE_INHERIT
|
||||||
self.show()
|
self.show()
|
||||||
self.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
self.mouse_filter = Control.MOUSE_FILTER_PASS
|
||||||
else:
|
else:
|
||||||
self.mouse_filter = Control.MOUSE_FILTER_STOP
|
self.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
self.hide()
|
self.hide()
|
||||||
process_mode = Node.PROCESS_MODE_DISABLED
|
process_mode = Node.PROCESS_MODE_DISABLED
|
||||||
has_stage = focus
|
has_stage = focus
|
||||||
|
|
@ -116,6 +116,8 @@ func _input(event):
|
||||||
if event.is_action_pressed("ui_accept"):
|
if event.is_action_pressed("ui_accept"):
|
||||||
pick(curr_selection_id)
|
pick(curr_selection_id)
|
||||||
elif event.is_action_pressed("skip"):
|
elif event.is_action_pressed("skip"):
|
||||||
|
##fixme: using skip causes a lot of invalid state
|
||||||
|
return
|
||||||
if selection_state == CARDS_SELECTED:
|
if selection_state == CARDS_SELECTED:
|
||||||
transition()
|
transition()
|
||||||
show_posts()
|
show_posts()
|
||||||
|
|
@ -160,9 +162,9 @@ func pick(id: int):
|
||||||
print("Winning ID ", id)
|
print("Winning ID ", id)
|
||||||
|
|
||||||
elif options[0].text == "":
|
elif options[0].text == "":
|
||||||
winning_id = 0
|
|
||||||
else:
|
|
||||||
winning_id = 1
|
winning_id = 1
|
||||||
|
else:
|
||||||
|
winning_id = 0
|
||||||
|
|
||||||
output.append(options.pop_at(winning_id))
|
output.append(options.pop_at(winning_id))
|
||||||
anim_players.pop_at(winning_id).play("shuffle")
|
anim_players.pop_at(winning_id).play("shuffle")
|
||||||
|
|
|
||||||
|
|
@ -1493,6 +1493,7 @@ anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
mouse_filter = 2
|
||||||
script = ExtResource("1_pjntm")
|
script = ExtResource("1_pjntm")
|
||||||
|
|
||||||
[node name="Control" type="Control" parent="."]
|
[node name="Control" type="Control" parent="."]
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,16 @@ var on_crouch_cooldown:bool = false
|
||||||
@onready var camera:Camera3D = $Yaw/Pitch/Mount/Camera3D
|
@onready var camera:Camera3D = $Yaw/Pitch/Mount/Camera3D
|
||||||
@onready var focus_ray: RayCast3D = $Yaw/Pitch/Mount/Camera3D/RayCast3D
|
@onready var focus_ray: RayCast3D = $Yaw/Pitch/Mount/Camera3D/RayCast3D
|
||||||
|
|
||||||
|
var zoomed:
|
||||||
|
set(zoom):
|
||||||
|
if zoomed != zoom:
|
||||||
|
if zoom:
|
||||||
|
var zoom_tween = create_tween()
|
||||||
|
zoom_tween.tween_property(camera, "fov", camera.fov*0.5, 0.5)
|
||||||
|
else:
|
||||||
|
var zoom_tween = create_tween()
|
||||||
|
zoom_tween.tween_property(camera, "fov", camera.fov*2, 0.5)
|
||||||
|
zoomed = zoom
|
||||||
signal ui_entered
|
signal ui_entered
|
||||||
var has_entered:bool = false
|
var has_entered:bool = false
|
||||||
signal ui_exited
|
signal ui_exited
|
||||||
|
|
@ -77,12 +87,18 @@ func _process(_delta):
|
||||||
has_entered = true
|
has_entered = true
|
||||||
focus_ray.get_collider().reveal()
|
focus_ray.get_collider().reveal()
|
||||||
|
|
||||||
if has_entered and has_stage:
|
if has_stage:
|
||||||
if focus_ray.get_collider() == null:
|
if has_entered:
|
||||||
emit_signal("ui_exited")
|
if focus_ray.get_collider() == null:
|
||||||
has_entered = false
|
emit_signal("ui_exited")
|
||||||
if Input.is_action_just_pressed("ui_accept"):
|
has_entered = false
|
||||||
State.pass_stage_to(focus_ray.get_collider())
|
if Input.is_action_just_pressed("ui_accept"):
|
||||||
|
State.pass_stage_to(focus_ray.get_collider())
|
||||||
|
else:
|
||||||
|
if Input.is_action_just_pressed("zoom_in_controller"):
|
||||||
|
zoomed = true
|
||||||
|
elif Input.is_action_just_released("zoom_in_controller"):
|
||||||
|
zoomed = false
|
||||||
|
|
||||||
func _physics_process(delta:float):
|
func _physics_process(delta:float):
|
||||||
if has_stage:
|
if has_stage:
|
||||||
|
|
@ -155,7 +171,12 @@ func _input(event:InputEvent):
|
||||||
_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 event.pressed:
|
if event is InputEventMouseButton and event.pressed:
|
||||||
State.free_focus()
|
if Input.is_action_just_pressed("zoom_in_mouse"):
|
||||||
|
zoomed = true
|
||||||
|
elif Input.is_action_just_pressed("zoom_out_mouse"):
|
||||||
|
zoomed = false
|
||||||
|
else:
|
||||||
|
State.free_focus()
|
||||||
get_tree().call_group("interactables", "reveal")
|
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())
|
||||||
|
|
|
||||||
|
|
@ -124,6 +124,21 @@ skip={
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":2,"pressure":0.0,"pressed":true,"script":null)
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":2,"pressure":0.0,"pressed":true,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
zoom_in_mouse={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":4,"canceled":false,"pressed":false,"double_click":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
zoom_out_mouse={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":5,"canceled":false,"pressed":false,"double_click":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
zoom_in_controller={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":4,"axis_value":1.0,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[layer_names]
|
[layer_names]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue