Compare commits
5 Commits
c181c4f70b
...
3f2281a155
Author | SHA1 | Date | |
---|---|---|---|
3f2281a155 | |||
5d0b1933b6 | |||
321defe228 | |||
f019cdd1e3 | |||
f4b9d4718b |
@ -17,6 +17,7 @@ var card : Card = Card.new() setget update_cardview
|
||||
|
||||
func _ready():
|
||||
update_cardview()
|
||||
connect_signals()
|
||||
|
||||
|
||||
func update_cardview(new_card = null):
|
||||
@ -24,15 +25,16 @@ func update_cardview(new_card = null):
|
||||
# allow the update card function to work with and without setget
|
||||
if new_card != null:
|
||||
card = new_card
|
||||
connect_signals()
|
||||
|
||||
# change the color of the panel to match the appropriate type
|
||||
var card_style = $Background.get('custom_styles/panel').duplicate(true)
|
||||
var card_style = $"%Background".get('custom_styles/panel').duplicate(true)
|
||||
card_style.set_bg_color(TYPE_COLORS[card.card_info.type])
|
||||
$Background.set('custom_styles/panel', card_style)
|
||||
$"%Background".set('custom_styles/panel', card_style)
|
||||
|
||||
# change the name and description
|
||||
$VBox/Name.text = card.card_info.name
|
||||
$VBox/Description.text = card.card_info.description
|
||||
$"%Name".text = card.card_info.name
|
||||
$"%Description".text = card.card_info.description
|
||||
|
||||
# add the correct number of input dice views
|
||||
for i in card.card_info.number_of_dice:
|
||||
@ -54,8 +56,9 @@ func update_cardview(new_card = null):
|
||||
i.set_extra_info(extra_text)
|
||||
|
||||
# set bold dice if addition dice
|
||||
for i in input_dice_views:
|
||||
i.bold = true
|
||||
if card.card_info.addition_dice == true:
|
||||
for i in input_dice_views:
|
||||
i.bold = true
|
||||
|
||||
|
||||
# add an input_dice_view to the array (for easy management)
|
||||
@ -64,3 +67,17 @@ func add_input_dice_view():
|
||||
var dice_view = input_dice_view.instance()
|
||||
input_dice_views.append(dice_view)
|
||||
$"%AutoGrid".add_child(dice_view)
|
||||
|
||||
|
||||
# this is run once the card emits card_removed
|
||||
func card_view_run():
|
||||
# play the using animation
|
||||
$AnimationPlayer.play("Fly Off")
|
||||
yield($AnimationPlayer, "animation_finished")
|
||||
|
||||
# remove the card completely once used
|
||||
queue_free()
|
||||
|
||||
|
||||
func connect_signals():
|
||||
card.connect("card_removed", self, "card_view_run")
|
||||
|
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=8 format=2]
|
||||
[gd_scene load_steps=10 format=2]
|
||||
|
||||
[ext_resource path="res://UI/CardView.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Assets/Metropolis-font/Metropolis-Bold.ttf" type="DynamicFontData" id=4]
|
||||
@ -24,6 +24,62 @@ size = 20
|
||||
use_filter = true
|
||||
font_data = ExtResource( 4 )
|
||||
|
||||
[sub_resource type="Animation" id=7]
|
||||
resource_name = "Fly Off"
|
||||
length = 0.5
|
||||
step = 0.01
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("LocalPosition:rect_position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.5 ),
|
||||
"transitions": PoolRealArray( 5, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 0, 0 ), Vector2( 0, -999 ) ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath(".:rect_scale")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0, 0.18, 0.5 ),
|
||||
"transitions": PoolRealArray( 1, 6.06286, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 1, 1 ), Vector2( 1, 1 ), Vector2( 1, 1.4 ) ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=8]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("LocalPosition:rect_position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 0, 0 ) ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath(".:rect_scale")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 1, 1 ) ]
|
||||
}
|
||||
|
||||
[node name="CardView" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
@ -33,12 +89,17 @@ size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Background" type="PanelContainer" parent="."]
|
||||
[node name="LocalPosition" type="Control" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
|
||||
[node name="Background" type="PanelContainer" parent="LocalPosition"]
|
||||
unique_name_in_owner = true
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
custom_styles/panel = SubResource( 6 )
|
||||
|
||||
[node name="VBox" type="VBoxContainer" parent="."]
|
||||
[node name="VBox" type="VBoxContainer" parent="LocalPosition"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 10.0
|
||||
@ -46,7 +107,8 @@ margin_top = 10.0
|
||||
margin_right = -10.0
|
||||
margin_bottom = -10.0
|
||||
|
||||
[node name="Name" type="Label" parent="VBox"]
|
||||
[node name="Name" type="Label" parent="LocalPosition/VBox"]
|
||||
unique_name_in_owner = true
|
||||
margin_right = 295.0
|
||||
margin_bottom = 31.0
|
||||
custom_fonts/font = SubResource( 2 )
|
||||
@ -54,13 +116,14 @@ text = "Default"
|
||||
align = 1
|
||||
autowrap = true
|
||||
|
||||
[node name="AutoGrid" parent="VBox" instance=ExtResource( 6 )]
|
||||
[node name="AutoGrid" parent="LocalPosition/VBox" instance=ExtResource( 6 )]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 35.0
|
||||
margin_right = 295.0
|
||||
margin_bottom = 281.0
|
||||
|
||||
[node name="Description" type="Label" parent="VBox"]
|
||||
[node name="Description" type="Label" parent="LocalPosition/VBox"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 285.0
|
||||
margin_right = 295.0
|
||||
margin_bottom = 375.0
|
||||
@ -70,3 +133,7 @@ text = "Default Description"
|
||||
align = 1
|
||||
valign = 1
|
||||
autowrap = true
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
"anims/Fly Off" = SubResource( 7 )
|
||||
anims/RESET = SubResource( 8 )
|
||||
|
Loading…
x
Reference in New Issue
Block a user