Compare commits

...

8 Commits

9 changed files with 155 additions and 52 deletions

BIN
Assets/DiceInputBold.kra Normal file

Binary file not shown.

BIN
Assets/DiceInputBold.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/DiceInputBold.png-dc499cd822102d68e5e44449ce5835a3.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/DiceInputBold.png"
dest_files=[ "res://.import/DiceInputBold.png-dc499cd822102d68e5e44449ce5835a3.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
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@ -1,4 +1,5 @@
extends Node
class_name Card
signal return_dice(dice_number)
signal do_movement(movement_range)
@ -6,7 +7,7 @@ signal do_damage(damage, damage_range)
signal do_effect(effect, effect_range)
signal card_removed(card_self)
export (Resource) var card_info
export (Resource) var card_info = preload("res://Assets/CardDB/Default.tres")
var input_dice = []
var addition_dice_amount = card_info.addition_amount

66
UI/CardView.gd Normal file
View File

@ -0,0 +1,66 @@
tool
extends Control
const TYPE_COLORS = [
Color("#db4758"), # DAMAGE
Color("#3cc361"), # UTILITY
Color("#bcb64f"), # SPECIAL
Color("#bc5ec6"), # EFFECT
Color("#a4a4a4"), # MOVEMENT
]
const input_dice_view = preload("res://UI/InputDiceView.tscn")
var input_dice_views = []
var card : Card = Card.new() setget update_cardview
func _ready():
update_cardview()
func update_cardview(new_card = null):
# allow the update card function to work with and without setget
if new_card != null:
card = new_card
# change the color of the panel to match the appropriate type
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)
# change the name and description
$VBox/Name.text = card.card_info.name
$VBox/Description.text = card.card_info.description
# add the correct number of input dice views
for i in card.card_info.number_of_dice:
add_input_dice_view()
# set the extra info
var extra_text = ""
if card.card_info.addition_dice == true:
# set the dice to have the remaining addition
extra_text = str(card.addition_dice_amount)
else:
# set the dice to have a list of accepted dice
for dice in card.card_info.accepted_dice:
extra_text += str(dice) + ", "
extra_text = extra_text.trim_suffix(", ")
for i in input_dice_views:
i.set_extra_info(extra_text)
# set bold dice if addition dice
for i in input_dice_views:
i.bold = true
# add an input_dice_view to the array (for easy management)
# and to the autogrid
func add_input_dice_view():
var dice_view = input_dice_view.instance()
input_dice_views.append(dice_view)
$"%AutoGrid".add_child(dice_view)

View File

@ -1,11 +1,10 @@
[gd_scene load_steps=10 format=2]
[gd_scene load_steps=8 format=2]
[ext_resource path="res://Assets/Metropolis-font/Metropolis-Medium.ttf" type="DynamicFontData" id=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]
[ext_resource path="res://Assets/DiceInput.png" type="Texture" id=5]
[ext_resource path="res://AutoGridContainer - Full Version/AutoGridContainer.tscn" type="PackedScene" id=6]
[sub_resource type="StyleBoxFlat" id=8]
[sub_resource type="StyleBoxFlat" id=6]
bg_color = Color( 0.858824, 0.278431, 0.345098, 1 )
corner_radius_top_left = 20
corner_radius_top_right = 20
@ -20,11 +19,6 @@ size = 30
use_filter = true
font_data = SubResource( 4 )
[sub_resource type="DynamicFont" id=7]
size = 64
use_filter = true
font_data = ExtResource( 2 )
[sub_resource type="DynamicFont" id=5]
size = 20
use_filter = true
@ -33,13 +27,16 @@ font_data = ExtResource( 4 )
[node name="CardView" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_right = -965.0
margin_bottom = -325.0
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource( 1 )
[node name="PanelContainer" type="PanelContainer" parent="."]
[node name="Background" type="PanelContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
custom_styles/panel = SubResource( 8 )
custom_styles/panel = SubResource( 6 )
[node name="VBox" type="VBoxContainer" parent="."]
anchor_right = 1.0
@ -50,7 +47,7 @@ margin_right = -10.0
margin_bottom = -10.0
[node name="Name" type="Label" parent="VBox"]
margin_right = 1260.0
margin_right = 295.0
margin_bottom = 31.0
custom_fonts/font = SubResource( 2 )
text = "Default"
@ -58,36 +55,15 @@ align = 1
autowrap = true
[node name="AutoGrid" parent="VBox" instance=ExtResource( 6 )]
unique_name_in_owner = true
margin_top = 35.0
margin_right = 1260.0
margin_bottom = 606.0
[node name="InputDice0" type="TextureRect" parent="VBox/AutoGrid"]
margin_left = 42.0
margin_top = 5.0
margin_right = 192.0
margin_bottom = 155.0
rect_min_size = Vector2( 75, 75 )
size_flags_horizontal = 3
size_flags_vertical = 3
texture = ExtResource( 5 )
expand = true
stretch_mode = 6
[node name="Number" type="Label" parent="VBox/AutoGrid/InputDice0"]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_colors/font_color = Color( 0, 0, 0, 1 )
custom_fonts/font = SubResource( 7 )
align = 1
valign = 1
margin_right = 295.0
margin_bottom = 281.0
[node name="Description" type="Label" parent="VBox"]
margin_top = 610.0
margin_right = 1260.0
margin_bottom = 700.0
margin_top = 285.0
margin_right = 295.0
margin_bottom = 375.0
rect_min_size = Vector2( 0, 90 )
custom_fonts/font = SubResource( 5 )
text = "Default Description"

View File

@ -1,9 +1,25 @@
tool
extends Control
export var bold : bool setget set_bold
func _process(_delta):
# update the pivot offset to make sure the object's animations
# are always centered
$Sprite.rect_pivot_offset = rect_size/2
$Particles2D.position = rect_size/2
func set_extra_info(text : String):
$"%ExtraInfo".text = text
func set_bold(is_bold : bool = true):
if is_bold:
$Sprite.texture = load("res://Assets/DiceInputBold.png")
else:
$Sprite.texture = load("res://Assets/DiceInput.png")
bold = is_bold

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=10 format=2]
[ext_resource path="res://Assets/Metropolis-font/Metropolis-Medium.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://Assets/Metropolis-font/Metropolis-SemiBold.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://Assets/DiceInput.png" type="Texture" id=2]
[ext_resource path="res://UI/InputDiceView.gd" type="Script" id=3]
@ -114,6 +114,9 @@ tracks/2/keys = {
[node name="InputDiceView" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
rect_min_size = Vector2( 75, 75 )
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource( 3 )
[node name="Particles2D" type="Particles2D" parent="."]
@ -127,7 +130,18 @@ speed_scale = 2.0
process_material = SubResource( 12 )
texture = ExtResource( 2 )
[node name="Sprite" type="TextureRect" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
rect_pivot_offset = Vector2( 640, 360 )
size_flags_horizontal = 3
size_flags_vertical = 3
texture = ExtResource( 2 )
expand = true
stretch_mode = 6
[node name="ExtraInfo" type="Label" parent="."]
unique_name_in_owner = true
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
@ -137,17 +151,6 @@ custom_fonts/font = SubResource( 7 )
align = 1
valign = 1
[node name="Sprite" type="TextureRect" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
rect_min_size = Vector2( 75, 75 )
rect_pivot_offset = Vector2( 640, 360 )
size_flags_horizontal = 3
size_flags_vertical = 3
texture = ExtResource( 2 )
expand = true
stretch_mode = 6
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/Disappear = SubResource( 8 )
anims/RESET = SubResource( 9 )

View File

@ -9,6 +9,11 @@
config_version=4
_global_script_classes=[ {
"base": "Node",
"class": "Card",
"language": "GDScript",
"path": "res://UI/Card.gd"
}, {
"base": "Resource",
"class": "CardResource",
"language": "GDScript",
@ -20,6 +25,7 @@ _global_script_classes=[ {
"path": "res://Characters/Character.gd"
} ]
_global_script_class_icons={
"Card": "",
"CardResource": "",
"Character": ""
}