feat: 添加升级卡和样式

This commit is contained in:
luke358
2026-05-20 21:24:47 +08:00
parent 4a3cd81ff7
commit 2ba69606ee
8 changed files with 134 additions and 1 deletions
+3
View File
@@ -17,3 +17,6 @@ enum UnitType {
@export var luck := 1.0
@export var block_chance := 0.0
@export var gold_drop := 1
@export var hp_regen := 0.0
@export var life_steal := 0.0
@export var harvesting := 0
+3
View File
@@ -5,6 +5,7 @@
[ext_resource type="Texture2D" uid="uid://ov4fmsbglo55" path="res://assets/sprites/Map.png" id="2_5tue2"]
[ext_resource type="PackedScene" uid="uid://cgljr7wcstmyp" path="res://scenes/unit/players/player_well_rounded.tscn" id="3_5tue2"]
[ext_resource type="Script" uid="uid://cegcsi6n6r4gv" path="res://scenes/arena/camera_2d.gd" id="4_aj7ud"]
[ext_resource type="PackedScene" uid="uid://cp1haphh1gj8t" path="res://scenes/ui/stats_container/stats_container.tscn" id="9_6w4xk"]
[ext_resource type="Script" uid="uid://bd5bscq0u8wld" path="res://scenes/arena/spawner.gd" id="17_rhjlh"]
[ext_resource type="Script" uid="uid://dqhoumuppl4bx" path="res://resources/waves/wave_data.gd" id="18_8kk48"]
[ext_resource type="Resource" uid="uid://cer6rdmxrnenh" path="res://resources/waves/data/wave_1_to_5.tres" id="18_tp84n"]
@@ -74,5 +75,7 @@ grow_horizontal = 2
text = "10"
label_settings = SubResource("LabelSettings_wqbss")
[node name="StatsContainer" parent="GameUI" unique_id=827713059 instance=ExtResource("9_6w4xk")]
[connection signal="timeout" from="Spawner/SpawnTimer" to="Spawner" method="_on_spawn_timer_timeout"]
[connection signal="timeout" from="Spawner/WaveTimer" to="Spawner" method="_on_wave_timer_timeout"]
@@ -0,0 +1,31 @@
[gd_scene format=3 uid="uid://cexaxg5jj2ljl"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_mkexl"]
bg_color = Color(0.3882353, 0.3882353, 0.3882353, 1)
corner_radius_top_left = 12
corner_radius_top_right = 12
corner_radius_bottom_right = 12
corner_radius_bottom_left = 12
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_p145h"]
bg_color = Color(0.09411765, 0.62352943, 0.74509805, 1)
corner_radius_top_left = 12
corner_radius_top_right = 12
corner_radius_bottom_right = 12
corner_radius_bottom_left = 12
[node name="CustomButton" type="Button" unique_id=667533022]
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -32.5
offset_top = -28.0
offset_right = 32.5
grow_horizontal = 2
grow_vertical = 0
theme_override_font_sizes/font_size = 48
theme_override_styles/normal = SubResource("StyleBoxFlat_mkexl")
theme_override_styles/hover = SubResource("StyleBoxFlat_p145h")
text = "select"
+12 -1
View File
@@ -7,6 +7,7 @@ class_name StatsContainer
@onready var damage_label: Label = %DamageLabel
@onready var luck_label: Label = %LuckLabel
@onready var speed_label: Label = %SpeedLabel
@onready var block_label: Label = %BlockLabel
@onready var harvesting_label: Label = %HarvestingLabel
# Called when the node enters the scene tree for the first time.
@@ -16,4 +17,14 @@ func _ready() -> void:
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
if not is_instance_valid(Global.player):
return
health_label.text = str(Global.player.stats.health)
hp_regen_label.text = str(Global.player.stats.hp_regen)
life_steal_label.text = str(Global.player.stats.life_steal) + "%"
damage_label.text = str(Global.player.stats.damage)
luck_label.text = str(Global.player.stats.luck)
speed_label.text = str(Global.player.stats.speed)
block_label.text = str(Global.player.stats.block_chance) + "%"
harvesting_label.text = str(Global.player.stats.harvesting)
+11
View File
@@ -0,0 +1,11 @@
extends Panel
class_name UpgradeCard
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
@@ -0,0 +1 @@
uid://yarrkdmu5xcl
+65
View File
@@ -0,0 +1,65 @@
[gd_scene format=3 uid="uid://bfohai4xgom8w"]
[ext_resource type="Script" uid="uid://yarrkdmu5xcl" path="res://scenes/ui/upgrade_card/upgrade_card.gd" id="1_7erta"]
[ext_resource type="StyleBox" uid="uid://dt8ypn0hibm80" path="res://styles/common_style.tres" id="1_v41mk"]
[ext_resource type="Texture2D" uid="uid://dn68qq5evmvwa" path="res://assets/sprites/Upgrades/12.png" id="2_mkexl"]
[ext_resource type="PackedScene" uid="uid://cexaxg5jj2ljl" path="res://scenes/ui/custom_button/custom_button.tscn" id="4_kjnsj"]
[sub_resource type="LabelSettings" id="LabelSettings_mkexl"]
font_size = 28
[node name="UpgradeCard" type="Panel" unique_id=816521847]
custom_minimum_size = Vector2(300, 200)
offset_right = 40.0
offset_bottom = 40.0
theme_override_styles/panel = ExtResource("1_v41mk")
script = ExtResource("1_7erta")
[node name="MarginContainer" type="MarginContainer" parent="." unique_id=458128927]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 8
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 8
theme_override_constants/margin_bottom = 8
[node name="Control" type="Control" parent="MarginContainer" unique_id=1979281248]
layout_mode = 2
[node name="Icon" type="TextureRect" parent="MarginContainer/Control" unique_id=1868739971]
custom_minimum_size = Vector2(100, 100)
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
texture = ExtResource("2_mkexl")
expand_mode = 1
stretch_mode = 5
[node name="Name" type="Label" parent="MarginContainer/Control" unique_id=1952735558]
layout_mode = 0
offset_left = 100.0
offset_top = 10.0
offset_right = 277.0
offset_bottom = 48.666668
text = "damage"
label_settings = SubResource("LabelSettings_mkexl")
vertical_alignment = 1
[node name="Description" type="Label" parent="MarginContainer/Control" unique_id=1620881988]
modulate = Color(0.827451, 0.9098039, 0.17254902, 1)
layout_mode = 0
offset_left = 100.0
offset_top = 55.0
offset_right = 277.0
offset_bottom = 93.66667
text = "+1"
label_settings = SubResource("LabelSettings_mkexl")
vertical_alignment = 1
[node name="CustomButton" parent="MarginContainer/Control" unique_id=667533022 instance=ExtResource("4_kjnsj")]
layout_mode = 0
anchors_preset = 0
+8
View File
@@ -0,0 +1,8 @@
[gd_resource type="StyleBoxFlat" format=3 uid="uid://dt8ypn0hibm80"]
[resource]
bg_color = Color(0.101960786, 0.101960786, 0.101960786, 1)
corner_radius_top_left = 12
corner_radius_top_right = 12
corner_radius_bottom_right = 12
corner_radius_bottom_left = 12