Merge branch 'adi_dev' into 'development'
polishing cards See merge request betalars/frame-of-mind!3
This commit is contained in:
commit
80d11da2b7
|
|
@ -130,6 +130,7 @@ func is_in_dropzone(to_check: Node) -> bool:
|
||||||
|
|
||||||
# called if a mouse button is pressed
|
# called if a mouse button is pressed
|
||||||
func handle_mouse_button(to_handle: Area2D, input: InputEvent):
|
func handle_mouse_button(to_handle: Area2D, input: InputEvent):
|
||||||
|
|
||||||
# No two areas can be dragged at the same time.
|
# No two areas can be dragged at the same time.
|
||||||
# Make sure that only the same area is dragged.
|
# Make sure that only the same area is dragged.
|
||||||
# Otherwise overlapping areas are dragged at the same time.
|
# Otherwise overlapping areas are dragged at the same time.
|
||||||
|
|
@ -141,11 +142,8 @@ func handle_mouse_button(to_handle: Area2D, input: InputEvent):
|
||||||
to_handle.is_dragged = input.pressed
|
to_handle.is_dragged = input.pressed
|
||||||
is_area_dragged = input.pressed
|
is_area_dragged = input.pressed
|
||||||
|
|
||||||
# TODO: We need a better way to recognize whether "to_handle" is a Card or a Post-It.
|
# Check what is being dragged
|
||||||
# (Tried checking for a script, didn't work, because script has no name attached.
|
|
||||||
# Alternative might be to check for specific values within the script ("is_card" f.e))
|
|
||||||
if to_handle is Card:
|
if to_handle is Card:
|
||||||
|
|
||||||
active_context = ui_context.DROPZONE
|
active_context = ui_context.DROPZONE
|
||||||
if input.is_pressed():
|
if input.is_pressed():
|
||||||
reorder_areas("dropzone_content")
|
reorder_areas("dropzone_content")
|
||||||
|
|
@ -154,13 +152,17 @@ func handle_mouse_button(to_handle: Area2D, input: InputEvent):
|
||||||
dropzone.move_child(currently_dragged_area, -1)
|
dropzone.move_child(currently_dragged_area, -1)
|
||||||
currently_dragged_area = null
|
currently_dragged_area = null
|
||||||
elif to_handle is PostIt:
|
elif to_handle is PostIt:
|
||||||
if input.is_pressed():
|
if input.is_action_pressed("mouse_left"):
|
||||||
to_handle.reparent(dropzone)
|
to_handle.reparent(dropzone)
|
||||||
to_handle.on_board = true
|
to_handle.on_board = true
|
||||||
to_handle.set_owner(self) # needs to be here otherwise the owner disappears
|
to_handle.set_owner(self) # needs to be here otherwise the owner disappears
|
||||||
area_dict["post_its_in_list"].erase(to_handle)
|
area_dict["post_its_in_list"].erase(to_handle)
|
||||||
area_dict["dropzone_content"].push_back(to_handle)
|
area_dict["dropzone_content"].push_back(to_handle)
|
||||||
# TODO (if needed): Add function to rearrange the array based on positions in the dropzone
|
elif input.is_action_pressed("mouse_right"):
|
||||||
|
_return_postit_to_panels(to_handle)
|
||||||
|
to_handle.is_dragged = false
|
||||||
|
is_area_dragged = false
|
||||||
|
currently_dragged_area = null
|
||||||
else:
|
else:
|
||||||
if is_in_dropzone(to_handle):
|
if is_in_dropzone(to_handle):
|
||||||
if to_handle.has_overlapping_areas():
|
if to_handle.has_overlapping_areas():
|
||||||
|
|
@ -187,7 +189,8 @@ func attach_postit_to_card(postit: Area2D, card: Area2D, update_dict = false):
|
||||||
_return_postit_to_panels(postit) # don't attach if card has already a post-it attached
|
_return_postit_to_panels(postit) # don't attach if card has already a post-it attached
|
||||||
return
|
return
|
||||||
|
|
||||||
postit.reparent(card)
|
postit.reparent(card.get_child(3, true))
|
||||||
|
postit.position = Vector2(0,0)
|
||||||
postit.on_board = false
|
postit.on_board = false
|
||||||
postit.set_owner(self)
|
postit.set_owner(self)
|
||||||
postit.position = card.get_child(3).position
|
postit.position = card.get_child(3).position
|
||||||
|
|
@ -243,6 +246,7 @@ func _input(event):
|
||||||
|
|
||||||
if event.is_action_pressed("ui_cancel"):
|
if event.is_action_pressed("ui_cancel"):
|
||||||
State.leave_stage(self)
|
State.leave_stage(self)
|
||||||
|
|
||||||
# Return, if the input is a mouse event (mouse events are handled separately)
|
# Return, if the input is a mouse event (mouse events are handled separately)
|
||||||
if event is InputEventMouse or !has_stage or not is_instance_valid(currently_selected_node): return
|
if event is InputEventMouse or !has_stage or not is_instance_valid(currently_selected_node): return
|
||||||
|
|
||||||
|
|
@ -266,7 +270,7 @@ func _input(event):
|
||||||
|
|
||||||
elif event.is_action_pressed("ui_left"): # left to switch context to the left
|
elif event.is_action_pressed("ui_left"): # left to switch context to the left
|
||||||
active_context -= 1
|
active_context -= 1
|
||||||
if active_context < -1:
|
if active_context <= -1:
|
||||||
active_context = ui_context.POST_IT_LIST
|
active_context = ui_context.POST_IT_LIST
|
||||||
|
|
||||||
elif event.is_action_pressed("ui_right"): # right to switch context to the right
|
elif event.is_action_pressed("ui_right"): # right to switch context to the right
|
||||||
|
|
@ -282,8 +286,6 @@ func _input(event):
|
||||||
else:
|
else:
|
||||||
_enter_assignment_context()
|
_enter_assignment_context()
|
||||||
|
|
||||||
# TODO: I forgor the HECKING RIGHT-CLICK!!!!111 AAAAAAAAAAAAAAAAAAAA
|
|
||||||
|
|
||||||
# do some adjustments to loop elements (after last element, select first one etc.)
|
# do some adjustments to loop elements (after last element, select first one etc.)
|
||||||
if selected_dropzone_element < 0:
|
if selected_dropzone_element < 0:
|
||||||
selected_dropzone_element = area_dict["dropzone_content"].size()-1
|
selected_dropzone_element = area_dict["dropzone_content"].size()-1
|
||||||
|
|
@ -356,15 +358,14 @@ func _leave_assignment_context():
|
||||||
# handles everything to return a post it to the panels
|
# handles everything to return a post it to the panels
|
||||||
func _return_postit_to_panels(post_it: Area2D):
|
func _return_postit_to_panels(post_it: Area2D):
|
||||||
for panel in area_dict["post_it_panels"]:
|
for panel in area_dict["post_it_panels"]:
|
||||||
print(area_dict["post_it_panels"])
|
|
||||||
if panel.get_child_count() == 1:
|
if panel.get_child_count() == 1:
|
||||||
area_dict["dropzone_content"].erase(post_it)
|
area_dict["dropzone_content"].erase(post_it)
|
||||||
post_it.on_board = false
|
post_it.on_board = false
|
||||||
area_dict["post_its_in_list"].push_back(post_it)
|
area_dict["post_its_in_list"].push_back(post_it)
|
||||||
#post_it.tween_transform_to(panel.get_child(0).position)
|
|
||||||
post_it.reparent(panel)
|
post_it.reparent(panel)
|
||||||
post_it.transform = panel.get_child(0).transform
|
post_it.transform = panel.get_child(0).transform
|
||||||
post_it.set_owner(self)
|
post_it.set_owner(self)
|
||||||
|
#post_it.position = Vector2(0,0)
|
||||||
reorder_areas("dropzone_content")
|
reorder_areas("dropzone_content")
|
||||||
reorder_areas("post_its_in_list")
|
reorder_areas("post_its_in_list")
|
||||||
break
|
break
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ var scale_tween
|
||||||
@export var voice_line: AudioStream = null
|
@export var voice_line: AudioStream = null
|
||||||
@export var is_dragable: bool = false
|
@export var is_dragable: bool = false
|
||||||
@onready var diameter = $CollisionShape2D.shape.height
|
@onready var diameter = $CollisionShape2D.shape.height
|
||||||
|
@onready var postit_anchor = get_child(3)
|
||||||
|
|
||||||
var is_dragged: bool = false:
|
var is_dragged: bool = false:
|
||||||
set(dragged):
|
set(dragged):
|
||||||
|
|
@ -124,7 +125,7 @@ func _on_mouse_entered():
|
||||||
is_mouse_entered = true
|
is_mouse_entered = true
|
||||||
if not Input.is_action_pressed("mouse_left"):
|
if not Input.is_action_pressed("mouse_left"):
|
||||||
if has_postit_attached():
|
if has_postit_attached():
|
||||||
if get_child(-1).highlighted:
|
if postit_anchor.get_child(-1).highlighted:
|
||||||
return
|
return
|
||||||
highlighted = true
|
highlighted = true
|
||||||
if "handle_hover" in owner:
|
if "handle_hover" in owner:
|
||||||
|
|
@ -151,11 +152,7 @@ func _move_card():
|
||||||
position += (get_viewport().get_mouse_position() - position) - mouse_offset
|
position += (get_viewport().get_mouse_position() - position) - mouse_offset
|
||||||
|
|
||||||
func has_postit_attached() -> bool:
|
func has_postit_attached() -> bool:
|
||||||
var all_children = get_children()
|
return postit_anchor.get_child(-1) is PostIt
|
||||||
for child in all_children:
|
|
||||||
if child is PostIt:
|
|
||||||
return true
|
|
||||||
return false
|
|
||||||
|
|
||||||
func check_hover():
|
func check_hover():
|
||||||
if is_mouse_entered:
|
if is_mouse_entered:
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ theme_type_variation = &"card_text"
|
||||||
autowrap_mode = 3
|
autowrap_mode = 3
|
||||||
|
|
||||||
[node name="postit anchor" type="Node2D" parent="."]
|
[node name="postit anchor" type="Node2D" parent="."]
|
||||||
position = Vector2(-65.6478, 60.3852)
|
position = Vector2(0, 21)
|
||||||
|
|
||||||
[connection signal="input_event" from="." to="." method="_on_input_event"]
|
[connection signal="input_event" from="." to="." method="_on_input_event"]
|
||||||
[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"]
|
[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"]
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ func _on_input_event(viewport, event, shape_idx):
|
||||||
_move_post_it()
|
_move_post_it()
|
||||||
|
|
||||||
if event is InputEventMouseButton:
|
if event is InputEventMouseButton:
|
||||||
if event.button_index == MOUSE_BUTTON_LEFT:
|
if event.button_index == MOUSE_BUTTON_LEFT or event.button_index == MOUSE_BUTTON_RIGHT:
|
||||||
if "handle_mouse_button" in owner:
|
if "handle_mouse_button" in owner:
|
||||||
mouse_offset = (get_viewport().get_mouse_position() - global_position)
|
mouse_offset = (get_viewport().get_mouse_position() - global_position)
|
||||||
owner.handle_mouse_button(self, event)
|
owner.handle_mouse_button(self, event)
|
||||||
|
|
@ -116,9 +116,8 @@ func _move_post_it():
|
||||||
position += (get_viewport().get_mouse_position() - position) - mouse_offset
|
position += (get_viewport().get_mouse_position() - position) - mouse_offset
|
||||||
|
|
||||||
func is_postit_attached() -> bool:
|
func is_postit_attached() -> bool:
|
||||||
if self.get_parent() is Card:
|
# there is probably a nicer way to do this
|
||||||
return true
|
return self.get_parent().get_parent() is Card
|
||||||
return false
|
|
||||||
|
|
||||||
func tween_transform_to(target: Vector2):
|
func tween_transform_to(target: Vector2):
|
||||||
var transform_tween = create_tween()
|
var transform_tween = create_tween()
|
||||||
|
|
|
||||||
|
|
@ -410,7 +410,7 @@ size_flags_horizontal = 3
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
max_value = 1.0
|
max_value = 1.0
|
||||||
step = 0.05
|
step = 0.05
|
||||||
value = 1.0
|
value = 0.5
|
||||||
ticks_on_borders = true
|
ticks_on_borders = true
|
||||||
script = ExtResource("3_q2gbh")
|
script = ExtResource("3_q2gbh")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ config_version=5
|
||||||
|
|
||||||
config/name="Frame of Mind"
|
config/name="Frame of Mind"
|
||||||
run/main_scene="res://main.tscn"
|
run/main_scene="res://main.tscn"
|
||||||
config/features=PackedStringArray("4.1", "Forward Plus")
|
config/features=PackedStringArray("4.0", "Forward Plus")
|
||||||
run/max_fps=60
|
run/max_fps=60
|
||||||
boot_splash/bg_color=Color(0.0313726, 0.0117647, 0.129412, 1)
|
boot_splash/bg_color=Color(0.0313726, 0.0117647, 0.129412, 1)
|
||||||
boot_splash/image="res://splash.png"
|
boot_splash/image="res://splash.png"
|
||||||
|
|
@ -31,7 +31,7 @@ gdscript/warnings/native_method_override=0
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
window/size/viewport_width=1440
|
window/size/viewport_width=1440
|
||||||
window/size/viewport_height=1080
|
window/size/viewport_height=960
|
||||||
window/stretch/mode="canvas_items"
|
window/stretch/mode="canvas_items"
|
||||||
window/stretch/aspect="expand"
|
window/stretch/aspect="expand"
|
||||||
mouse_cursor/custom_image="res://import/interface-elements/cursor.png"
|
mouse_cursor/custom_image="res://import/interface-elements/cursor.png"
|
||||||
|
|
@ -80,7 +80,12 @@ player_backwards={
|
||||||
}
|
}
|
||||||
mouse_left={
|
mouse_left={
|
||||||
"deadzone": 0.5,
|
"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":1,"canceled":false,"pressed":false,"double_click":false,"script":null)
|
"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":1,"pressed":false,"double_click":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
mouse_right={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [null, 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":2,"pressed":false,"double_click":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
look_right={
|
look_right={
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue