Merge commit 'ef93aafd9ef7cb787fbc6d1464b063dac3362d01' into cards

This commit is contained in:
betalars 2023-06-30 01:30:46 +02:00
commit 62390e5881
5 changed files with 118 additions and 37 deletions

View File

@ -50,6 +50,8 @@ var scale_tween
wiggle_intensity = 0 wiggle_intensity = 0
@export var voice_line: AudioStream = null @export var voice_line: AudioStream = null
@export var is_dragable: bool = false
var is_dragged: bool = false
func _ready(): func _ready():
@ -93,3 +95,24 @@ func _on_focus_entered():
func _on_focus_exited(): func _on_focus_exited():
print(self, "is not focused") print(self, "is not focused")
func _on_mouse_entered():
if not Input.is_action_pressed("mouse_left"):
highlighted = true
if "handle_hover" in owner:
owner.handle_hover(self)
func _on_mouse_exited():
highlighted = false
func _on_input_event(viewport, event, shape_idx):
if event is InputEventMouseMotion and is_dragged:
position += event.relative
if event is InputEventMouseButton:
if event.button_index == MOUSE_BUTTON_LEFT:
if is_dragable:
is_dragged = event.pressed
if "handle_mouse_button" in owner:
owner.handle_mouse_button(self, event)

View File

@ -146,19 +146,18 @@ func _process(_delta):
" "
[node name="card" type="Area2D"] [node name="card" type="Area2D"]
rotation = -0.0265383 rotation = -0.0714123
script = ExtResource("1_emip0") script = ExtResource("1_emip0")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(-0.0713516, 0.997451)
rotation = 1.5708 rotation = 1.5708
scale = Vector2(1, 1)
shape = SubResource("CapsuleShape2D_foovg") shape = SubResource("CapsuleShape2D_foovg")
[node name="BackgroundSprite" type="AnimatedSprite2D" parent="."] [node name="BackgroundSprite" type="AnimatedSprite2D" parent="."]
clip_children = 2 clip_children = 2
scale = Vector2(0.6, 0.6) scale = Vector2(0.6, 0.6)
sprite_frames = SubResource("SpriteFrames_ckivt") sprite_frames = SubResource("SpriteFrames_ckivt")
frame = 1
script = SubResource("GDScript_8bs16") script = SubResource("GDScript_8bs16")
[node name="GPUParticles2D" type="GPUParticles2D" parent="BackgroundSprite"] [node name="GPUParticles2D" type="GPUParticles2D" parent="BackgroundSprite"]
@ -202,3 +201,7 @@ offset_left = 100.0
offset_top = 148.0 offset_top = 148.0
offset_right = 140.0 offset_right = 140.0
offset_bottom = 188.0 offset_bottom = 188.0
[connection signal="input_event" from="." to="." method="_on_input_event"]
[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"]
[connection signal="mouse_exited" from="." to="." method="_on_mouse_exited"]

View File

@ -1,10 +1,11 @@
[gd_scene load_steps=9 format=3 uid="uid://bnskiyx1sksww"] [gd_scene load_steps=10 format=3 uid="uid://bnskiyx1sksww"]
[ext_resource type="Texture2D" uid="uid://bi3xqdknw5tpe" path="res://logic-scenes/board/board-texture/Cork002_2K_Color.png" id="1_8brxc"] [ext_resource type="Texture2D" uid="uid://bi3xqdknw5tpe" path="res://logic-scenes/board/board-texture/Cork002_2K_Color.png" id="1_8brxc"]
[ext_resource type="Shader" path="res://logic-scenes/board/physics-board.gdshader" id="1_ggnth"] [ext_resource type="Shader" path="res://logic-scenes/board/physics-board.gdshader" id="1_ggnth"]
[ext_resource type="Script" path="res://logic-scenes/board/card-board.gd" id="3_8v4c4"] [ext_resource type="Script" path="res://logic-scenes/board/card-board.gd" id="3_8v4c4"]
[ext_resource type="PackedScene" uid="uid://dy5rd437h5hsw" path="res://logic-scenes/board/card.tscn" id="3_mg053"] [ext_resource type="PackedScene" uid="uid://dy5rd437h5hsw" path="res://logic-scenes/board/card.tscn" id="3_mg053"]
[ext_resource type="PackedScene" uid="uid://bvowj4l8dtceu" path="res://dev-util/board of devs.tscn" id="4_sskx2"] [ext_resource type="PackedScene" uid="uid://bvowj4l8dtceu" path="res://dev-util/board of devs.tscn" id="4_sskx2"]
[ext_resource type="PackedScene" uid="uid://vkcdj8c3ytbq" path="res://logic-scenes/board/post-it.tscn" id="5_048k0"]
[ext_resource type="Script" path="res://logic-scenes/board/bouncy-card.gd" id="6_gcxd7"] [ext_resource type="Script" path="res://logic-scenes/board/bouncy-card.gd" id="6_gcxd7"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ttqei"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_ttqei"]
@ -15,7 +16,7 @@ shader_parameter/tex = ExtResource("1_8brxc")
[sub_resource type="CircleShape2D" id="CircleShape2D_x8rl2"] [sub_resource type="CircleShape2D" id="CircleShape2D_x8rl2"]
radius = 154.052 radius = 154.052
[node name="Panel" type="PanelContainer"] [node name="board" type="PanelContainer"]
material = SubResource("ShaderMaterial_ttqei") material = SubResource("ShaderMaterial_ttqei")
clip_contents = true clip_contents = true
anchors_preset = 15 anchors_preset = 15
@ -25,46 +26,79 @@ 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
script = ExtResource("3_8v4c4") script = ExtResource("3_8v4c4")
[node name="HBoxContainer" type="HBoxContainer" parent="."] [node name="HBoxContainer" type="HBoxContainer" parent="."]
layout_mode = 2 layout_mode = 2
[node name="Panel" type="Panel" parent="HBoxContainer"] [node name="dropzone" type="Panel" parent="HBoxContainer"]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
mouse_filter = 1
[node name="Control" type="Control" parent="HBoxContainer/Panel"] [node name="card3" parent="HBoxContainer/dropzone" instance=ExtResource("3_mg053")]
anchors_preset = 0 z_as_relative = false
offset_left = 305.0 position = Vector2(371, 290)
offset_top = 463.0 rotation = 0.00712087
offset_right = 305.0 collision_layer = 2147483649
offset_bottom = 463.0
[node name="card3" parent="HBoxContainer/Panel/Control" instance=ExtResource("3_mg053")] [node name="card" parent="HBoxContainer/dropzone" instance=ExtResource("3_mg053")]
offset_left = 0.0 position = Vector2(640, 659)
offset_top = 0.0 rotation = 0.0714344
offset_right = 0.0 scale = Vector2(1, 1)
offset_bottom = 0.0 is_dragable = true
[node name="VBoxContainer3" type="VBoxContainer" parent="HBoxContainer"] [node name="ScrollContainer" type="ScrollContainer" parent="HBoxContainer"]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 8
[node name="CenterContainer" type="ScrollContainer" parent="HBoxContainer/VBoxContainer3"]
layout_mode = 2
size_flags_vertical = 3
horizontal_scroll_mode = 0 horizontal_scroll_mode = 0
[node name="post-ancor" type="Panel" parent="HBoxContainer/VBoxContainer3/CenterContainer"] [node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer/ScrollContainer"]
custom_minimum_size = Vector2(320, 110)
layout_mode = 2 layout_mode = 2
[node name="Panel" type="Panel" parent="HBoxContainer/ScrollContainer/VBoxContainer"]
custom_minimum_size = Vector2(400, 120)
layout_mode = 2
mouse_filter = 1
[node name="post-it" parent="HBoxContainer/ScrollContainer/VBoxContainer/Panel" instance=ExtResource("5_048k0")]
z_index = 1
position = Vector2(105, 57)
is_dragable = true
[node name="Panel2" type="Panel" parent="HBoxContainer/ScrollContainer/VBoxContainer"]
custom_minimum_size = Vector2(400, 120)
layout_mode = 2
mouse_filter = 1
[node name="post-it" parent="HBoxContainer/ScrollContainer/VBoxContainer/Panel2" instance=ExtResource("5_048k0")]
position = Vector2(105, 57)
is_dragable = true
[node name="Panel3" type="Panel" parent="HBoxContainer/ScrollContainer/VBoxContainer"]
custom_minimum_size = Vector2(400, 120)
layout_mode = 2
mouse_filter = 1
[node name="post-it" parent="HBoxContainer/ScrollContainer/VBoxContainer/Panel3" instance=ExtResource("5_048k0")]
position = Vector2(105, 57)
is_dragable = true
[node name="Panel4" type="Panel" parent="HBoxContainer/ScrollContainer/VBoxContainer"]
custom_minimum_size = Vector2(400, 120)
layout_mode = 2
mouse_filter = 1
[node name="post-it" parent="HBoxContainer/ScrollContainer/VBoxContainer/Panel4" instance=ExtResource("5_048k0")]
position = Vector2(105, 57)
is_dragable = true
[node name="board of devs" parent="." instance=ExtResource("4_sskx2")] [node name="board of devs" parent="." instance=ExtResource("4_sskx2")]
visible = false visible = false
layout_mode = 2 layout_mode = 2
[node name="Node2D" type="Node2D" parent="."] [node name="Node2D" type="Node2D" parent="."]
visible = false
[node name="RigidBody2D" type="Area2D" parent="Node2D"] [node name="RigidBody2D" type="Area2D" parent="Node2D"]
position = Vector2(686, 379) position = Vector2(686, 379)
@ -77,10 +111,8 @@ shape = SubResource("CircleShape2D_x8rl2")
position = Vector2(-151, -107) position = Vector2(-151, -107)
[node name="card2" parent="Node2D/RigidBody2D/ancor" instance=ExtResource("3_mg053")] [node name="card2" parent="Node2D/RigidBody2D/ancor" instance=ExtResource("3_mg053")]
offset_left = 0.0 rotation = -0.0180459
offset_top = 0.0 collision_layer = 2
offset_right = 0.0
offset_bottom = 0.0
[node name="RigidBody2D2" type="Area2D" parent="Node2D"] [node name="RigidBody2D2" type="Area2D" parent="Node2D"]
position = Vector2(742, 323) position = Vector2(742, 323)
@ -93,10 +125,8 @@ shape = SubResource("CircleShape2D_x8rl2")
position = Vector2(-151, -107) position = Vector2(-151, -107)
[node name="card2" parent="Node2D/RigidBody2D2/ancor" instance=ExtResource("3_mg053")] [node name="card2" parent="Node2D/RigidBody2D2/ancor" instance=ExtResource("3_mg053")]
offset_left = 0.0 rotation = 0.0612526
offset_top = 0.0 collision_layer = 2
offset_right = 0.0
offset_bottom = 0.0
[node name="RigidBody2D3" type="Area2D" parent="Node2D"] [node name="RigidBody2D3" type="Area2D" parent="Node2D"]
position = Vector2(694, 353) position = Vector2(694, 353)
@ -109,7 +139,5 @@ shape = SubResource("CircleShape2D_x8rl2")
position = Vector2(-151, -107) position = Vector2(-151, -107)
[node name="card2" parent="Node2D/RigidBody2D3/ancor" instance=ExtResource("3_mg053")] [node name="card2" parent="Node2D/RigidBody2D3/ancor" instance=ExtResource("3_mg053")]
offset_left = 0.0 rotation = 0.0528008
offset_top = 0.0 collision_layer = 2
offset_right = 0.0
offset_bottom = 0.0

View File

@ -41,6 +41,8 @@ var modulate_tween
modulate = Color(1, 1, 1) modulate = Color(1, 1, 1)
@export var voice_line: AudioStream = null @export var voice_line: AudioStream = null
@export var is_dragable: bool = false
var is_dragged = false
func _ready() -> void: func _ready() -> void:
$Content/Label.text = self.text $Content/Label.text = self.text
@ -60,3 +62,23 @@ func _on_focus_entered():
func _on_focus_exited(): func _on_focus_exited():
print(self, "is not focused") print(self, "is not focused")
func _on_mouse_entered():
if not Input.is_action_pressed("mouse_left"):
highlighted = true
if "handle_hover" in owner:
owner.handle_hover(self)
func _on_mouse_exited():
highlighted = false
func _on_input_event(viewport, event, shape_idx):
if event is InputEventMouseMotion and is_dragged:
position += event.relative
if event is InputEventMouseButton:
if event.button_index == MOUSE_BUTTON_LEFT:
if is_dragable:
is_dragged = event.pressed
if "handle_mouse_button" in owner:
owner.handle_mouse_button(self, event)

View File

@ -103,6 +103,7 @@ animations = [{
[node name="post-it" type="Area2D"] [node name="post-it" type="Area2D"]
script = ExtResource("1_yvh5n") script = ExtResource("1_yvh5n")
highlight_color = Color(1.2, 1.2, 1.2, 1) highlight_color = Color(1.2, 1.2, 1.2, 1)
is_dragable = null
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(99.5, 0) position = Vector2(99.5, 0)
@ -133,3 +134,7 @@ theme = ExtResource("3_hu2as")
theme_type_variation = &"card_text" theme_type_variation = &"card_text"
vertical_alignment = 1 vertical_alignment = 1
autowrap_mode = 3 autowrap_mode = 3
[connection signal="input_event" from="." to="." method="_on_input_event"]
[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"]
[connection signal="mouse_exited" from="." to="." method="_on_mouse_exited"]