Add UI support for addition dice, remove card once used
This commit is contained in:
parent
638bb9439a
commit
6a6e74efa8
17
UI/Card.gd
17
UI/Card.gd
@ -15,7 +15,11 @@ const TYPE_COLORS = [
|
|||||||
export (Resource) var card_info
|
export (Resource) var card_info
|
||||||
|
|
||||||
var input_dice = []
|
var input_dice = []
|
||||||
var addition_dice_amount = card_info.addition_amount
|
var addition_dice_amount : int setget _set_addition_dice
|
||||||
|
|
||||||
|
|
||||||
|
func _set_addition_dice(new_amount):
|
||||||
|
$VBox/AutoGrid/InputDice0/Number.text = String(new_amount)
|
||||||
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
@ -34,6 +38,10 @@ func _ready():
|
|||||||
# change the name and description
|
# change the name and description
|
||||||
$VBox/Name.text = card_info.name
|
$VBox/Name.text = card_info.name
|
||||||
$VBox/Description.text = card_info.description
|
$VBox/Description.text = card_info.description
|
||||||
|
|
||||||
|
#maybe set the addition amount
|
||||||
|
if card_info.addition_dice:
|
||||||
|
self.addition_dice_amount = card_info.addition_amount
|
||||||
|
|
||||||
|
|
||||||
func dice_inputted(dice_number : int):
|
func dice_inputted(dice_number : int):
|
||||||
@ -70,7 +78,7 @@ func dice_inputted(dice_number : int):
|
|||||||
|
|
||||||
# -- RUN DICE CHECKS --
|
# -- RUN DICE CHECKS --
|
||||||
if card_info.addition_dice:
|
if card_info.addition_dice:
|
||||||
addition_dice_amount -= dice_number
|
self.addition_dice_amount -= dice_number
|
||||||
input_dice.remove(0)
|
input_dice.remove(0)
|
||||||
if addition_dice_amount > 0:
|
if addition_dice_amount > 0:
|
||||||
return
|
return
|
||||||
@ -135,4 +143,9 @@ func run_card():
|
|||||||
emit_signal("return_dice", dice_number)
|
emit_signal("return_dice", dice_number)
|
||||||
|
|
||||||
|
|
||||||
|
#clear the input dice
|
||||||
input_dice = []
|
input_dice = []
|
||||||
|
|
||||||
|
#card is used, disappear
|
||||||
|
queue_free()
|
||||||
|
|
||||||
|
13
UI/Card.tscn
13
UI/Card.tscn
@ -7,7 +7,7 @@
|
|||||||
[ext_resource path="res://AutoGridContainer - Full Version/AutoGridContainer.tscn" type="PackedScene" id=5]
|
[ext_resource path="res://AutoGridContainer - Full Version/AutoGridContainer.tscn" type="PackedScene" id=5]
|
||||||
[ext_resource path="res://Assets/Metropolis-font/Metropolis-Medium.ttf" type="DynamicFontData" id=6]
|
[ext_resource path="res://Assets/Metropolis-font/Metropolis-Medium.ttf" type="DynamicFontData" id=6]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id=6]
|
[sub_resource type="StyleBoxFlat" id=8]
|
||||||
bg_color = Color( 0.858824, 0.278431, 0.345098, 1 )
|
bg_color = Color( 0.858824, 0.278431, 0.345098, 1 )
|
||||||
corner_radius_top_left = 20
|
corner_radius_top_left = 20
|
||||||
corner_radius_top_right = 20
|
corner_radius_top_right = 20
|
||||||
@ -45,7 +45,7 @@ card_info = ExtResource( 2 )
|
|||||||
[node name="PanelContainer" type="PanelContainer" parent="."]
|
[node name="PanelContainer" type="PanelContainer" parent="."]
|
||||||
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( 8 )
|
||||||
|
|
||||||
[node name="VBox" type="VBoxContainer" parent="."]
|
[node name="VBox" type="VBoxContainer" parent="."]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
@ -59,14 +59,14 @@ margin_bottom = -10.0
|
|||||||
margin_right = 263.0
|
margin_right = 263.0
|
||||||
margin_bottom = 31.0
|
margin_bottom = 31.0
|
||||||
custom_fonts/font = SubResource( 2 )
|
custom_fonts/font = SubResource( 2 )
|
||||||
text = "The Card Name"
|
text = "Broadsword"
|
||||||
align = 1
|
align = 1
|
||||||
autowrap = true
|
autowrap = true
|
||||||
|
|
||||||
[node name="AutoGrid" parent="VBox" instance=ExtResource( 5 )]
|
[node name="AutoGrid" parent="VBox" instance=ExtResource( 5 )]
|
||||||
margin_top = 35.0
|
margin_top = 35.0
|
||||||
margin_right = 263.0
|
margin_right = 263.0
|
||||||
margin_bottom = 259.0
|
margin_bottom = 256.0
|
||||||
|
|
||||||
[node name="InputDice0" type="TextureRect" parent="VBox/AutoGrid"]
|
[node name="InputDice0" type="TextureRect" parent="VBox/AutoGrid"]
|
||||||
margin_left = 9.0
|
margin_left = 9.0
|
||||||
@ -90,12 +90,13 @@ align = 1
|
|||||||
valign = 1
|
valign = 1
|
||||||
|
|
||||||
[node name="Description" type="Label" parent="VBox"]
|
[node name="Description" type="Label" parent="VBox"]
|
||||||
margin_top = 263.0
|
margin_top = 260.0
|
||||||
margin_right = 263.0
|
margin_right = 263.0
|
||||||
margin_bottom = 353.0
|
margin_bottom = 353.0
|
||||||
rect_min_size = Vector2( 0, 90 )
|
rect_min_size = Vector2( 0, 90 )
|
||||||
custom_fonts/font = SubResource( 5 )
|
custom_fonts/font = SubResource( 5 )
|
||||||
text = "Description"
|
text = "Does damage equal to the sum of both dice to all enemies
|
||||||
|
Range: 2 spaces"
|
||||||
align = 1
|
align = 1
|
||||||
valign = 1
|
valign = 1
|
||||||
autowrap = true
|
autowrap = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user