Add cost to card list items

This commit is contained in:
Hamcha 2019-06-12 01:13:24 +02:00
parent f74b53993a
commit 173dd420d1
Signed by: hamcha
GPG key ID: A40413D21021EAEE
6 changed files with 297 additions and 252 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/flat-cost.png-fe23dd757abb9fdc21322baaa3af2bfa.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://MLPAssets/Icons/flat-cost.png"
dest_files=[ "res://.import/flat-cost.png-fe23dd757abb9fdc21322baaa3af2bfa.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View file

@ -1,208 +1,146 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://MLPAssets/Background/hall.png" type="Texture" id=1]
[ext_resource path="res://Scenes/Draft/CardListItem.tscn" type="PackedScene" id=2]
[ext_resource path="res://Scenes/Scripts/Draft.gd" type="Script" id=1]
[ext_resource path="res://MLPAssets/Background/hall.png" type="Texture" id=2]
[ext_resource path="res://MLPAssets/Placeholders/unknowncard.jpg" type="Texture" id=3]
[node name="Control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
[node name="hall" type="TextureRect" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
texture = ExtResource( 1 )
mouse_filter = 2
texture = ExtResource( 2 )
expand = true
stretch_mode = 6
[node name="Drafted" type="GridContainer" parent="."]
margin_left = 122.0
margin_top = 591.0
margin_right = 1158.0
margin_bottom = 780.0
columns = 2
[node name="CardLabel" parent="Drafted" instance=ExtResource( 2 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 200.0
margin_bottom = 23.0
barColors = {
"blue": Color( 0.286275, 0.635294, 0.72549, 1 ),
"none": Color( 0.247059, 0.54902, 0.4, 1 ),
"pink": Color( 0.870588, 0.34902, 0.705882, 1 ),
"purple": Color( 0.670588, 0.34902, 0.870588, 1 ),
"white": Color( 0.698039, 0.698039, 0.698039, 1 )
}
color = "pink"
[node name="CardLabel3" parent="Drafted" instance=ExtResource( 2 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 204.0
margin_right = 404.0
margin_bottom = 23.0
barColors = {
"blue": Color( 0.286275, 0.635294, 0.72549, 1 ),
"none": Color( 0.247059, 0.54902, 0.4, 1 ),
"orange": Color( 0.74902, 0.321569, 0.133333, 1 ),
"pink": Color( 0.870588, 0.34902, 0.705882, 1 ),
"purple": Color( 0.670588, 0.34902, 0.870588, 1 ),
"white": Color( 0.698039, 0.698039, 0.698039, 1 ),
"yellow": Color( 0.788235, 0.792157, 0.431373, 1 )
}
[node name="CardLabel6" parent="Drafted" instance=ExtResource( 2 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 27.0
margin_right = 200.0
margin_bottom = 50.0
barColors = {
"blue": Color( 0.286275, 0.635294, 0.72549, 1 ),
"none": Color( 0.247059, 0.54902, 0.4, 1 ),
"orange": Color( 0.74902, 0.321569, 0.133333, 1 ),
"pink": Color( 0.870588, 0.34902, 0.705882, 1 ),
"purple": Color( 0.670588, 0.34902, 0.870588, 1 ),
"white": Color( 0.698039, 0.698039, 0.698039, 1 ),
"yellow": Color( 0.788235, 0.792157, 0.431373, 1 )
}
color = "purple"
[node name="CardLabel2" parent="Drafted" instance=ExtResource( 2 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 204.0
margin_top = 27.0
margin_right = 404.0
margin_bottom = 50.0
barColors = {
"blue": Color( 0.286275, 0.635294, 0.72549, 1 ),
"none": Color( 0.247059, 0.54902, 0.4, 1 ),
"orange": Color( 0.74902, 0.321569, 0.133333, 1 ),
"pink": Color( 0.870588, 0.34902, 0.705882, 1 ),
"purple": Color( 0.670588, 0.34902, 0.870588, 1 ),
"white": Color( 0.698039, 0.698039, 0.698039, 1 ),
"yellow": Color( 0.788235, 0.792157, 0.431373, 1 )
}
color = "yellow"
[node name="CardLabel7" parent="Drafted" instance=ExtResource( 2 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 54.0
margin_right = 200.0
margin_bottom = 77.0
barColors = {
"blue": Color( 0.286275, 0.635294, 0.72549, 1 ),
"none": Color( 0.247059, 0.54902, 0.4, 1 ),
"orange": Color( 0.74902, 0.321569, 0.133333, 1 ),
"pink": Color( 0.870588, 0.34902, 0.705882, 1 ),
"purple": Color( 0.670588, 0.34902, 0.870588, 1 ),
"white": Color( 0.698039, 0.698039, 0.698039, 1 ),
"yellow": Color( 0.788235, 0.792157, 0.431373, 1 )
}
color = "blue"
[node name="CardLabel5" parent="Drafted" instance=ExtResource( 2 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 204.0
margin_top = 54.0
margin_right = 404.0
margin_bottom = 77.0
barColors = {
"blue": Color( 0.286275, 0.635294, 0.72549, 1 ),
"none": Color( 0.247059, 0.54902, 0.4, 1 ),
"orange": Color( 0.74902, 0.321569, 0.133333, 1 ),
"pink": Color( 0.870588, 0.34902, 0.705882, 1 ),
"purple": Color( 0.670588, 0.34902, 0.870588, 1 ),
"white": Color( 0.698039, 0.698039, 0.698039, 1 ),
"yellow": Color( 0.788235, 0.792157, 0.431373, 1 )
}
color = "orange"
[node name="CardLabel8" parent="Drafted" instance=ExtResource( 2 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 81.0
margin_right = 200.0
margin_bottom = 104.0
barColors = {
"blue": Color( 0.286275, 0.635294, 0.72549, 1 ),
"none": Color( 0.247059, 0.54902, 0.4, 1 ),
"orange": Color( 0.74902, 0.321569, 0.133333, 1 ),
"pink": Color( 0.870588, 0.34902, 0.705882, 1 ),
"purple": Color( 0.670588, 0.34902, 0.870588, 1 ),
"white": Color( 0.698039, 0.698039, 0.698039, 1 ),
"yellow": Color( 0.788235, 0.792157, 0.431373, 1 )
}
color = "white"
[node name="CardLabel4" parent="Drafted" instance=ExtResource( 2 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 204.0
margin_top = 81.0
margin_right = 404.0
margin_bottom = 104.0
barColors = {
"blue": Color( 0.286275, 0.635294, 0.72549, 1 ),
"none": Color( 0.247059, 0.54902, 0.4, 1 ),
"orange": Color( 0.74902, 0.321569, 0.133333, 1 ),
"pink": Color( 0.870588, 0.34902, 0.705882, 1 ),
"purple": Color( 0.670588, 0.34902, 0.870588, 1 ),
"white": Color( 0.698039, 0.698039, 0.698039, 1 ),
"yellow": Color( 0.788235, 0.792157, 0.431373, 1 )
}
color = "multi|yellow+blue"
[node name="CardLabel9" parent="Drafted" instance=ExtResource( 2 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 108.0
margin_right = 200.0
margin_bottom = 131.0
barColors = {
"blue": Color( 0.286275, 0.635294, 0.72549, 1 ),
"none": Color( 0.247059, 0.54902, 0.4, 1 ),
"orange": Color( 0.74902, 0.321569, 0.133333, 1 ),
"pink": Color( 0.870588, 0.34902, 0.705882, 1 ),
"purple": Color( 0.670588, 0.34902, 0.870588, 1 ),
"white": Color( 0.698039, 0.698039, 0.698039, 1 ),
"yellow": Color( 0.788235, 0.792157, 0.431373, 1 )
}
color = "multi|orange+blue"
[node name="CardLabel10" parent="Drafted" instance=ExtResource( 2 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 204.0
margin_top = 108.0
margin_right = 404.0
margin_bottom = 131.0
barColors = {
"blue": Color( 0.286275, 0.635294, 0.72549, 1 ),
"none": Color( 0.247059, 0.54902, 0.4, 1 ),
"orange": Color( 0.74902, 0.321569, 0.133333, 1 ),
"pink": Color( 0.870588, 0.34902, 0.705882, 1 ),
"purple": Color( 0.670588, 0.34902, 0.870588, 1 ),
"white": Color( 0.698039, 0.698039, 0.698039, 1 ),
"yellow": Color( 0.788235, 0.792157, 0.431373, 1 )
}
color = "multi|orange+white+pink"
[node name="Cards" type="GridContainer" parent="."]
[node name="PickedCardListScroll" type="ScrollContainer" parent="."]
anchor_left = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 112.358
margin_top = 73.0827
margin_right = 916.358
margin_bottom = 237.083
margin_left = -248.0
margin_top = 20.0
margin_right = -10.0
margin_bottom = -20.0
mouse_filter = 1
scroll_horizontal_enabled = false
[node name="PickedCardList" type="VBoxContainer" parent="PickedCardListScroll"]
margin_right = 220.0
margin_bottom = 760.0
rect_min_size = Vector2( 220, 0 )
size_flags_vertical = 3
[node name="ManeLabel" type="Label" parent="PickedCardListScroll/PickedCardList"]
visible = false
margin_right = 220.0
margin_bottom = 23.0
rect_min_size = Vector2( 0, 23 )
text = "Mane"
valign = 1
[node name="Mane" type="VBoxContainer" parent="PickedCardListScroll/PickedCardList"]
margin_right = 220.0
[node name="EntryLabel" type="Label" parent="PickedCardListScroll/PickedCardList"]
visible = false
margin_top = 31.0
margin_right = 220.0
margin_bottom = 54.0
rect_min_size = Vector2( 0, 23 )
text = "Entry"
valign = 1
[node name="Entry" type="VBoxContainer" parent="PickedCardListScroll/PickedCardList"]
margin_top = 4.0
margin_right = 220.0
margin_bottom = 4.0
[node name="FriendsLabel" type="Label" parent="PickedCardListScroll/PickedCardList"]
visible = false
margin_top = 62.0
margin_right = 220.0
margin_bottom = 85.0
rect_min_size = Vector2( 0, 23 )
text = "Friends"
valign = 1
[node name="Friends" type="VBoxContainer" parent="PickedCardListScroll/PickedCardList"]
margin_top = 8.0
margin_right = 220.0
margin_bottom = 8.0
[node name="ResourcesLabel" type="Label" parent="PickedCardListScroll/PickedCardList"]
visible = false
margin_top = 93.0
margin_right = 220.0
margin_bottom = 116.0
rect_min_size = Vector2( 0, 23 )
text = "Resources"
valign = 1
[node name="Resources" type="VBoxContainer" parent="PickedCardListScroll/PickedCardList"]
margin_top = 12.0
margin_right = 220.0
margin_bottom = 12.0
[node name="EventsLabel" type="Label" parent="PickedCardListScroll/PickedCardList"]
visible = false
margin_top = 124.0
margin_right = 220.0
margin_bottom = 147.0
rect_min_size = Vector2( 0, 23 )
text = "Events"
valign = 1
[node name="Events" type="VBoxContainer" parent="PickedCardListScroll/PickedCardList"]
margin_top = 16.0
margin_right = 220.0
margin_bottom = 16.0
[node name="TroublemakersLabel" type="Label" parent="PickedCardListScroll/PickedCardList"]
visible = false
margin_top = 155.0
margin_right = 220.0
margin_bottom = 178.0
rect_min_size = Vector2( 0, 23 )
text = "Troublemakers"
valign = 1
[node name="Troublemakers" type="VBoxContainer" parent="PickedCardListScroll/PickedCardList"]
margin_top = 20.0
margin_right = 220.0
margin_bottom = 20.0
[node name="ProblemsLabel" type="Label" parent="PickedCardListScroll/PickedCardList"]
visible = false
margin_top = 186.0
margin_right = 220.0
margin_bottom = 209.0
rect_min_size = Vector2( 0, 23 )
text = "Problems"
valign = 1
[node name="Problems" type="VBoxContainer" parent="PickedCardListScroll/PickedCardList"]
margin_top = 24.0
margin_right = 220.0
margin_bottom = 24.0
[node name="Cards" type="GridContainer" parent="."]
editor/display_folded = true
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 234.076
margin_top = 40.1522
margin_right = 400.0
margin_bottom = 688.152
grow_horizontal = 2
grow_vertical = 2
rect_scale = Vector2( 0.5, 0.5 )
columns = 6
columns = 4
[node name="unknowncard" type="TextureRect" parent="Cards"]
margin_right = 344.0
@ -240,24 +178,6 @@ expand = true
stretch_mode = 6
[node name="unknowncard2" type="TextureRect" parent="Cards"]
margin_left = 1392.0
margin_right = 1736.0
margin_bottom = 480.0
rect_min_size = Vector2( 344, 480 )
texture = ExtResource( 3 )
expand = true
stretch_mode = 6
[node name="unknowncard7" type="TextureRect" parent="Cards"]
margin_left = 1740.0
margin_right = 2084.0
margin_bottom = 480.0
rect_min_size = Vector2( 344, 480 )
texture = ExtResource( 3 )
expand = true
stretch_mode = 6
[node name="unknowncard5" type="TextureRect" parent="Cards"]
margin_top = 484.0
margin_right = 344.0
margin_bottom = 964.0
@ -266,7 +186,7 @@ texture = ExtResource( 3 )
expand = true
stretch_mode = 6
[node name="unknowncard12" type="TextureRect" parent="Cards"]
[node name="unknowncard7" type="TextureRect" parent="Cards"]
margin_left = 348.0
margin_top = 484.0
margin_right = 692.0
@ -276,7 +196,7 @@ texture = ExtResource( 3 )
expand = true
stretch_mode = 6
[node name="unknowncard3" type="TextureRect" parent="Cards"]
[node name="unknowncard5" type="TextureRect" parent="Cards"]
margin_left = 696.0
margin_top = 484.0
margin_right = 1040.0
@ -286,7 +206,7 @@ texture = ExtResource( 3 )
expand = true
stretch_mode = 6
[node name="unknowncard9" type="TextureRect" parent="Cards"]
[node name="unknowncard12" type="TextureRect" parent="Cards"]
margin_left = 1044.0
margin_top = 484.0
margin_right = 1388.0
@ -296,21 +216,40 @@ texture = ExtResource( 3 )
expand = true
stretch_mode = 6
[node name="unknowncard3" type="TextureRect" parent="Cards"]
margin_top = 968.0
margin_right = 344.0
margin_bottom = 1448.0
rect_min_size = Vector2( 344, 480 )
texture = ExtResource( 3 )
expand = true
stretch_mode = 6
[node name="unknowncard9" type="TextureRect" parent="Cards"]
margin_left = 348.0
margin_top = 968.0
margin_right = 692.0
margin_bottom = 1448.0
rect_min_size = Vector2( 344, 480 )
texture = ExtResource( 3 )
expand = true
stretch_mode = 6
[node name="unknowncard6" type="TextureRect" parent="Cards"]
margin_left = 1392.0
margin_top = 484.0
margin_right = 1736.0
margin_bottom = 964.0
margin_left = 696.0
margin_top = 968.0
margin_right = 1040.0
margin_bottom = 1448.0
rect_min_size = Vector2( 344, 480 )
texture = ExtResource( 3 )
expand = true
stretch_mode = 6
[node name="unknowncard11" type="TextureRect" parent="Cards"]
margin_left = 1740.0
margin_top = 484.0
margin_right = 2084.0
margin_bottom = 964.0
margin_left = 1044.0
margin_top = 968.0
margin_right = 1388.0
margin_bottom = 1448.0
rect_min_size = Vector2( 344, 480 )
texture = ExtResource( 3 )
expand = true

View file

@ -2,14 +2,30 @@ extends Panel
export var barColors: Dictionary = {}
export var color: String = "none"
export var cardName: String = "Name"
export var cardSubname: String = "Subname"
export var showCost: bool = false
export var cardCost: int = 0
onready var nameLabel := $TextBlock/NameBlock/Name
onready var subnameLabel := $TextBlock/NameBlock/Subname
onready var colorIndicator := $ColorIndicator
onready var gradientIndicator := $ColorIndicator/TextureRect
onready var costIndicator := $TextBlock/CostIndicator
onready var costIndicatorLabel := $TextBlock/CostIndicator/CostLabel
func _ready():
nameLabel.text = cardName
subnameLabel.text = cardSubname
if showCost:
costIndicator.visible = true
costIndicatorLabel.text = str(cardCost)
if color.begins_with("multi|"):
make_gradient(color.trim_prefix("multi|").split("+"))
else:
if not barColors.has(color):
color = "none"
$ColorIndicator.color = barColors[color]
colorIndicator.color = barColors[color]
func make_gradient(colors: Array):
var gradient := Gradient.new()
@ -23,5 +39,5 @@ func make_gradient(colors: Array):
i += 1
var texture := GradientTexture.new()
texture.gradient = gradient
$ColorIndicator/TextureRect.texture = texture
$ColorIndicator/TextureRect.visible = true
gradientIndicator.texture = texture
gradientIndicator.visible = true

View file

@ -1,8 +1,9 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=8 format=2]
[ext_resource path="res://Scenes/Draft/CardListItem.gd" type="Script" id=1]
[ext_resource path="res://UIAssets/Fonts/Catamaran-Bold.ttf" type="DynamicFontData" id=2]
[ext_resource path="res://UIAssets/Fonts/Catamaran-Light.ttf" type="DynamicFontData" id=3]
[ext_resource path="res://MLPAssets/Icons/flat-cost.png" type="Texture" id=4]
[sub_resource type="DynamicFont" id=1]
size = 12
@ -14,6 +15,10 @@ font_data = ExtResource( 2 )
size = 12
font_data = ExtResource( 3 )
[sub_resource type="DynamicFont" id=3]
size = 14
font_data = ExtResource( 2 )
[node name="CardLabel" type="Panel"]
anchor_right = 1.0
anchor_bottom = 1.0
@ -22,15 +27,71 @@ margin_bottom = -777.0
rect_min_size = Vector2( 200, 23 )
script = ExtResource( 1 )
barColors = {
"blue": Color( 0.286275, 0.635294, 0.72549, 1 ),
"none": Color( 0.247059, 0.54902, 0.4, 1 ),
"orange": Color( 0.74902, 0.321569, 0.133333, 1 ),
"pink": Color( 0.870588, 0.34902, 0.705882, 1 ),
"purple": Color( 0.670588, 0.34902, 0.870588, 1 ),
"white": Color( 0.698039, 0.698039, 0.698039, 1 ),
"yellow": Color( 0.788235, 0.792157, 0.431373, 1 )
"blue": Color( 0.192157, 0.960784, 1, 1 ),
"none": Color( 0.129412, 0.372549, 0.25098, 1 ),
"orange": Color( 0.956863, 0.419608, 0.12549, 1 ),
"pink": Color( 0.972549, 0.270588, 0.603922, 1 ),
"purple": Color( 0.611765, 0.258824, 0.878431, 1 ),
"white": Color( 0.858824, 0.858824, 0.858824, 1 ),
"yellow": Color( 0.921569, 0.929412, 0.196078, 1 )
}
[node name="TextBlock" type="HBoxContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 8.0
margin_top = 2.0
margin_right = -4.0
[node name="NameBlock" type="HBoxContainer" parent="TextBlock"]
margin_right = 188.0
margin_bottom = 21.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Name" type="Label" parent="TextBlock/NameBlock"]
margin_right = 85.0
margin_bottom = 21.0
custom_fonts/font = SubResource( 1 )
text = "Twilight Sparkle"
valign = 1
[node name="Subname" type="Label" parent="TextBlock/NameBlock"]
modulate = Color( 1, 1, 1, 0.666667 )
margin_left = 89.0
margin_right = 188.0
margin_bottom = 21.0
size_flags_horizontal = 3
custom_fonts/font = SubResource( 2 )
text = "Princess of friendship"
valign = 1
clip_text = true
[node name="CostIndicator" type="TextureRect" parent="TextBlock"]
visible = false
self_modulate = Color( 0.396078, 0.396078, 0.396078, 1 )
margin_left = 172.0
margin_right = 188.0
margin_bottom = 21.0
rect_min_size = Vector2( 16, 20 )
texture = ExtResource( 4 )
expand = true
stretch_mode = 6
[node name="CostLabel" type="Label" parent="TextBlock/CostIndicator"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 1.0
margin_top = -5.0
margin_right = 1.0
margin_bottom = 5.0
rect_min_size = Vector2( 16, 0 )
size_flags_horizontal = 3
custom_fonts/font = SubResource( 3 )
text = "2"
align = 1
valign = 1
[node name="ColorIndicator" type="ColorRect" parent="."]
anchor_bottom = 1.0
margin_right = 2.0
@ -43,29 +104,3 @@ margin_right = 26.0
margin_bottom = 3.0
rect_rotation = 89.9999
expand = true
[node name="NameBlock" type="HBoxContainer" parent="."]
anchor_right = 1.0
margin_left = 8.0
margin_top = 2.0
margin_right = -4.0
margin_bottom = 2.0
size_flags_horizontal = 3
[node name="Name" type="Label" parent="NameBlock"]
margin_right = 85.0
margin_bottom = 21.0
custom_fonts/font = SubResource( 1 )
text = "Twilight Sparkle"
valign = 1
[node name="Subname" type="Label" parent="NameBlock"]
modulate = Color( 1, 1, 1, 0.666667 )
margin_left = 89.0
margin_right = 188.0
margin_bottom = 21.0
size_flags_horizontal = 3
custom_fonts/font = SubResource( 2 )
text = "Princess of friendship"
valign = 1
clip_text = true

21
Scenes/Scripts/Draft.gd Normal file
View file

@ -0,0 +1,21 @@
extends Control
var blocks = {
"mane": $PickedCardListScroll/PickedCardList/Mane,
"entry": $PickedCardListScroll/PickedCardList/Entry,
"friend": $PickedCardListScroll/PickedCardList/Friends,
"resource": $PickedCardListScroll/PickedCardList/Resources,
"event": $PickedCardListScroll/PickedCardList/Events,
"troublemaker": $PickedCardListScroll/PickedCardList/Troublemakers,
"problem": $PickedCardListScroll/PickedCardList/Problems
}
var labels = {
"mane": $PickedCardListScroll/PickedCardList/ManeLabel,
"entry": $PickedCardListScroll/PickedCardList/EntryLabel,
"friend": $PickedCardListScroll/PickedCardList/FriendsLabel,
"resource": $PickedCardListScroll/PickedCardList/ResourcesLabel,
"event": $PickedCardListScroll/PickedCardList/EventsLabel,
"troublemaker": $PickedCardListScroll/PickedCardList/TroublemakersLabel,
"problem": $PickedCardListScroll/PickedCardList/ProblemsLabel
}