Add New Card Resouce Type

This commit is contained in:
2022-07-16 12:06:46 +01:00
parent 97322b565f
commit dca0def350
14 changed files with 208 additions and 25 deletions

View File

@ -1,25 +1,20 @@
tool
extends Control
export (Resource) var card_info
enum TYPE {
DAMAGE = 0
UTILITY = 1
SPECIAL = 2
EFFECT = 3
}
const TYPE_COLORS = [
Color("#db4758"), # DAMAGE
Color("#3cc361"), # UTILITY
Color("#ddd55c"), # SPECIAL
Color("#bc5ec6"), # EFFECT
Color("#a4a4a4"), # MOVEMENT
]
export (TYPE) var type
func _ready():
# change the color of the panel to match the appropriate type
var card_style = $PanelContainer.get('custom_styles/panel').duplicate(true)
card_style.set_bg_color(TYPE_COLORS[type])
card_style.set_bg_color(TYPE_COLORS[card_info.type])
$PanelContainer.set('custom_styles/panel', card_style)

View File

@ -1,7 +1,14 @@
[gd_scene load_steps=3 format=2]
[gd_scene load_steps=4 format=2]
[ext_resource path="res://UI/Card.gd" type="Script" id=1]
[ext_resource path="res://UI/CardStyle.tres" type="StyleBox" id=2]
[ext_resource path="res://Assets/CardDB/Move.tres" type="Resource" id=2]
[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0.858824, 0.278431, 0.345098, 1 )
corner_radius_top_left = 20
corner_radius_top_right = 20
corner_radius_bottom_right = 20
corner_radius_bottom_left = 20
[node name="Card" type="Control"]
anchor_right = 1.0
@ -9,8 +16,9 @@ anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource( 1 )
card_info = ExtResource( 2 )
[node name="PanelContainer" type="PanelContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
custom_styles/panel = ExtResource( 2 )
custom_styles/panel = SubResource( 1 )

View File

@ -1,6 +1,7 @@
[gd_resource type="StyleBoxFlat" format=2]
[resource]
bg_color = Color( 0.643137, 0.643137, 0.643137, 1 )
corner_radius_top_left = 20
corner_radius_top_right = 20
corner_radius_bottom_right = 20

View File

@ -1,10 +1,16 @@
[gd_scene load_steps=2 format=2]
[gd_scene load_steps=6 format=2]
[ext_resource path="res://UI/Card.tscn" type="PackedScene" id=1]
[ext_resource path="res://Assets/CardDB/Damage.tres" type="Resource" id=2]
[ext_resource path="res://Assets/DiceInput.png" type="Texture" id=3]
[ext_resource path="res://Assets/Dice/Dice2.png" type="Texture" id=4]
[ext_resource path="res://Assets/CardDB/Effect.tres" type="Resource" id=5]
[node name="CardView" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_top = 277.0
margin_right = -252.0
[node name="HBox" type="HBoxContainer" parent="."]
anchor_right = 1.0
@ -14,22 +20,40 @@ custom_constants/separation = 50
[node name="Card1" parent="HBox" instance=ExtResource( 1 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 308.0
margin_bottom = 600.0
type = 1
margin_right = 224.0
margin_bottom = 323.0
[node name="Card2" parent="HBox" instance=ExtResource( 1 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 358.0
margin_right = 666.0
margin_bottom = 600.0
type = 2
margin_left = 274.0
margin_right = 498.0
margin_bottom = 323.0
card_info = ExtResource( 2 )
[node name="Card3" parent="HBox" instance=ExtResource( 1 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 716.0
margin_right = 1024.0
margin_bottom = 600.0
type = 3
margin_left = 548.0
margin_right = 772.0
margin_bottom = 323.0
card_info = ExtResource( 5 )
[node name="DiceInput" type="Sprite" parent="."]
position = Vector2( 111, 109 )
scale = Vector2( 0.2, 0.2 )
texture = ExtResource( 3 )
[node name="DiceInput2" type="Sprite" parent="."]
position = Vector2( 662, 109 )
scale = Vector2( 0.2, 0.2 )
texture = ExtResource( 3 )
[node name="DiceInput3" type="Sprite" parent="."]
position = Vector2( 387, 108 )
scale = Vector2( 0.2, 0.2 )
texture = ExtResource( 3 )
[node name="Dice2" type="Sprite" parent="DiceInput3"]
position = Vector2( -1390, 15 )
texture = ExtResource( 4 )