Compare commits
No commits in common. "3f2281a155d18a4b64e34f04dea1d85bb2b806c9" and "c181c4f70b50059535c487d2ea6e5ab73ad11637" have entirely different histories.
3f2281a155
...
c181c4f70b
@ -17,7 +17,6 @@ var card : Card = Card.new() setget update_cardview
|
|||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
update_cardview()
|
update_cardview()
|
||||||
connect_signals()
|
|
||||||
|
|
||||||
|
|
||||||
func update_cardview(new_card = null):
|
func update_cardview(new_card = null):
|
||||||
@ -25,16 +24,15 @@ func update_cardview(new_card = null):
|
|||||||
# allow the update card function to work with and without setget
|
# allow the update card function to work with and without setget
|
||||||
if new_card != null:
|
if new_card != null:
|
||||||
card = new_card
|
card = new_card
|
||||||
connect_signals()
|
|
||||||
|
|
||||||
# change the color of the panel to match the appropriate type
|
# 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])
|
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
|
# change the name and description
|
||||||
$"%Name".text = card.card_info.name
|
$VBox/Name.text = card.card_info.name
|
||||||
$"%Description".text = card.card_info.description
|
$VBox/Description.text = card.card_info.description
|
||||||
|
|
||||||
# add the correct number of input dice views
|
# add the correct number of input dice views
|
||||||
for i in card.card_info.number_of_dice:
|
for i in card.card_info.number_of_dice:
|
||||||
@ -56,7 +54,6 @@ func update_cardview(new_card = null):
|
|||||||
i.set_extra_info(extra_text)
|
i.set_extra_info(extra_text)
|
||||||
|
|
||||||
# set bold dice if addition dice
|
# set bold dice if addition dice
|
||||||
if card.card_info.addition_dice == true:
|
|
||||||
for i in input_dice_views:
|
for i in input_dice_views:
|
||||||
i.bold = true
|
i.bold = true
|
||||||
|
|
||||||
@ -67,17 +64,3 @@ func add_input_dice_view():
|
|||||||
var dice_view = input_dice_view.instance()
|
var dice_view = input_dice_view.instance()
|
||||||
input_dice_views.append(dice_view)
|
input_dice_views.append(dice_view)
|
||||||
$"%AutoGrid".add_child(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=10 format=2]
|
[gd_scene load_steps=8 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://UI/CardView.gd" type="Script" id=1]
|
[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]
|
[ext_resource path="res://Assets/Metropolis-font/Metropolis-Bold.ttf" type="DynamicFontData" id=4]
|
||||||
@ -24,62 +24,6 @@ size = 20
|
|||||||
use_filter = true
|
use_filter = true
|
||||||
font_data = ExtResource( 4 )
|
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"]
|
[node name="CardView" type="Control"]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
@ -89,17 +33,12 @@ size_flags_horizontal = 3
|
|||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
[node name="LocalPosition" type="Control" parent="."]
|
[node name="Background" type="PanelContainer" 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_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
custom_styles/panel = SubResource( 6 )
|
custom_styles/panel = SubResource( 6 )
|
||||||
|
|
||||||
[node name="VBox" type="VBoxContainer" parent="LocalPosition"]
|
[node name="VBox" type="VBoxContainer" parent="."]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
margin_left = 10.0
|
margin_left = 10.0
|
||||||
@ -107,8 +46,7 @@ margin_top = 10.0
|
|||||||
margin_right = -10.0
|
margin_right = -10.0
|
||||||
margin_bottom = -10.0
|
margin_bottom = -10.0
|
||||||
|
|
||||||
[node name="Name" type="Label" parent="LocalPosition/VBox"]
|
[node name="Name" type="Label" parent="VBox"]
|
||||||
unique_name_in_owner = true
|
|
||||||
margin_right = 295.0
|
margin_right = 295.0
|
||||||
margin_bottom = 31.0
|
margin_bottom = 31.0
|
||||||
custom_fonts/font = SubResource( 2 )
|
custom_fonts/font = SubResource( 2 )
|
||||||
@ -116,14 +54,13 @@ text = "Default"
|
|||||||
align = 1
|
align = 1
|
||||||
autowrap = true
|
autowrap = true
|
||||||
|
|
||||||
[node name="AutoGrid" parent="LocalPosition/VBox" instance=ExtResource( 6 )]
|
[node name="AutoGrid" parent="VBox" instance=ExtResource( 6 )]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
margin_top = 35.0
|
margin_top = 35.0
|
||||||
margin_right = 295.0
|
margin_right = 295.0
|
||||||
margin_bottom = 281.0
|
margin_bottom = 281.0
|
||||||
|
|
||||||
[node name="Description" type="Label" parent="LocalPosition/VBox"]
|
[node name="Description" type="Label" parent="VBox"]
|
||||||
unique_name_in_owner = true
|
|
||||||
margin_top = 285.0
|
margin_top = 285.0
|
||||||
margin_right = 295.0
|
margin_right = 295.0
|
||||||
margin_bottom = 375.0
|
margin_bottom = 375.0
|
||||||
@ -133,7 +70,3 @@ text = "Default Description"
|
|||||||
align = 1
|
align = 1
|
||||||
valign = 1
|
valign = 1
|
||||||
autowrap = true
|
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