diff --git a/components/Abstracts/WeaponCardBase.tscn b/components/Abstracts/WeaponCardBase.tscn
index 88ca697..b0d7a18 100644
--- a/components/Abstracts/WeaponCardBase.tscn
+++ b/components/Abstracts/WeaponCardBase.tscn
@@ -5,7 +5,12 @@
[ext_resource type="Texture2D" uid="uid://dwwpkn4q07ja2" path="res://icon.svg" id="2_j0w4u"]
[ext_resource type="PackedScene" uid="uid://ch81vd3awkmhk" path="res://components/UI/WeaponName.tscn" id="3_qv0b1"]
[ext_resource type="Texture2D" uid="uid://k13cte17httt" path="res://resources/items/energy.svg" id="4_6gohw"]
+[ext_resource type="Texture2D" uid="uid://bq8wf01j5ulwe" path="res://resources/ui/update-level.svg" id="4_do015"]
+[ext_resource type="Texture2D" uid="uid://f5rjbiw18tew" path="res://resources/ui/auto.png" id="4_h3enm"]
+[ext_resource type="Texture2D" uid="uid://bqplsjw07wkn8" path="res://resources/ui/update-soul.svg" id="4_j0v0r"]
[ext_resource type="PackedScene" uid="uid://bbm8l3hr4ihar" path="res://components/UI/ItemShow.tscn" id="4_k01vb"]
+[ext_resource type="Texture2D" uid="uid://clobdvvfmj618" path="res://resources/ui/downdate-soul.svg" id="5_j7v7d"]
+[ext_resource type="Texture2D" uid="uid://lrvlfvt55j0" path="res://resources/ui/once-update.svg" id="5_jv1l6"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_n2ewr"]
content_margin_left = 30.0
@@ -13,15 +18,17 @@ content_margin_top = 20.0
content_margin_right = 30.0
content_margin_bottom = 20.0
bg_color = Color(0, 0, 0, 0.5)
-border_width_left = 2
-border_width_top = 2
-border_width_right = 2
-border_width_bottom = 2
-border_color = Color(0, 0, 0, 0.75)
-corner_radius_top_left = 5
-corner_radius_top_right = 5
-corner_radius_bottom_right = 5
-corner_radius_bottom_left = 5
+border_width_left = 10
+border_width_top = 10
+border_width_right = 10
+border_width_bottom = 10
+border_color = Color(1, 1, 1, 1)
+border_blend = true
+corner_radius_top_left = 15
+corner_radius_top_right = 15
+corner_radius_bottom_right = 15
+corner_radius_bottom_left = 15
+corner_detail = 1
[sub_resource type="LabelSettings" id="LabelSettings_b3nsw"]
font_size = 12
@@ -50,11 +57,32 @@ alignment = 1
[node name="wrapper" type="VBoxContainer" parent="container" unique_id=673686123]
layout_mode = 2
+[node name="updates" type="HBoxContainer" parent="container/wrapper" unique_id=901133416]
+layout_mode = 2
+
+[node name="autoUpdateBtn" type="Button" parent="container/wrapper/updates" unique_id=287764631]
+unique_name_in_owner = true
+layout_mode = 2
+size_flags_horizontal = 3
+theme = ExtResource("2_fwkd3")
+toggle_mode = true
+text = "自动强化"
+icon = ExtResource("4_h3enm")
+
+[node name="onceUpdateBtn" type="Button" parent="container/wrapper/updates" unique_id=1523224875]
+unique_name_in_owner = true
+layout_mode = 2
+size_flags_horizontal = 3
+theme = ExtResource("2_fwkd3")
+text = "一键强化"
+icon = ExtResource("5_jv1l6")
+
[node name="updateBtn" type="Button" parent="container/wrapper" unique_id=248603389]
unique_name_in_owner = true
layout_mode = 2
theme = ExtResource("2_fwkd3")
-text = "升级"
+text = "强化武器"
+icon = ExtResource("4_do015")
[node name="souls" type="HBoxContainer" parent="container/wrapper" unique_id=1439164733]
layout_mode = 2
@@ -64,14 +92,16 @@ unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("2_fwkd3")
-text = "提炼"
+text = "灵魂·提炼"
+icon = ExtResource("4_j0v0r")
[node name="inlayBtn" type="Button" parent="container/wrapper/souls" unique_id=1008423578]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("2_fwkd3")
-text = "镶嵌"
+text = "灵魂·镶嵌"
+icon = ExtResource("5_j7v7d")
[node name="info" type="VBoxContainer" parent="container" unique_id=1625294072]
layout_mode = 2
@@ -162,6 +192,7 @@ fit_content = true
[node name="tease" type="Label" parent="container" unique_id=689277044]
unique_name_in_owner = true
+visible = false
layout_mode = 2
label_settings = SubResource("LabelSettings_b3nsw")
horizontal_alignment = 1
diff --git a/resources/ui/auto.png b/resources/ui/auto.png
new file mode 100644
index 0000000..feff444
Binary files /dev/null and b/resources/ui/auto.png differ
diff --git a/resources/ui/auto.png.import b/resources/ui/auto.png.import
new file mode 100644
index 0000000..f770377
--- /dev/null
+++ b/resources/ui/auto.png.import
@@ -0,0 +1,40 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://f5rjbiw18tew"
+path="res://.godot/imported/auto.png-ad5b7fc14787a8899369c158f319b816.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://resources/ui/auto.png"
+dest_files=["res://.godot/imported/auto.png-ad5b7fc14787a8899369c158f319b816.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/uastc_level=0
+compress/rdo_quality_loss=0.0
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/channel_remap/red=0
+process/channel_remap/green=1
+process/channel_remap/blue=2
+process/channel_remap/alpha=3
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
diff --git a/resources/ui/auto.svg b/resources/ui/auto.svg
new file mode 100644
index 0000000..cb56ed6
--- /dev/null
+++ b/resources/ui/auto.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources/ui/auto.svg.import b/resources/ui/auto.svg.import
new file mode 100644
index 0000000..6a1215e
--- /dev/null
+++ b/resources/ui/auto.svg.import
@@ -0,0 +1,43 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://bsk7o4p3bhab1"
+path="res://.godot/imported/auto.svg-253ef1198e5abac5b88bffc824c6c2c2.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://resources/ui/auto.svg"
+dest_files=["res://.godot/imported/auto.svg-253ef1198e5abac5b88bffc824c6c2c2.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/uastc_level=0
+compress/rdo_quality_loss=0.0
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/channel_remap/red=0
+process/channel_remap/green=1
+process/channel_remap/blue=2
+process/channel_remap/alpha=3
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
+svg/scale=1.0
+editor/scale_with_editor_scale=false
+editor/convert_colors_with_editor_theme=false
diff --git a/resources/ui/downdate-soul.svg b/resources/ui/downdate-soul.svg
new file mode 100644
index 0000000..3c09b6d
--- /dev/null
+++ b/resources/ui/downdate-soul.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources/ui/downdate-soul.svg.import b/resources/ui/downdate-soul.svg.import
new file mode 100644
index 0000000..c60ca0e
--- /dev/null
+++ b/resources/ui/downdate-soul.svg.import
@@ -0,0 +1,43 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://clobdvvfmj618"
+path="res://.godot/imported/downdate-soul.svg-4940d058a3f28afe423042c147fa67ea.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://resources/ui/downdate-soul.svg"
+dest_files=["res://.godot/imported/downdate-soul.svg-4940d058a3f28afe423042c147fa67ea.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/uastc_level=0
+compress/rdo_quality_loss=0.0
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/channel_remap/red=0
+process/channel_remap/green=1
+process/channel_remap/blue=2
+process/channel_remap/alpha=3
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
+svg/scale=1.0
+editor/scale_with_editor_scale=false
+editor/convert_colors_with_editor_theme=false
diff --git a/resources/ui/once-update.svg b/resources/ui/once-update.svg
new file mode 100644
index 0000000..e95895f
--- /dev/null
+++ b/resources/ui/once-update.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources/ui/once-update.svg.import b/resources/ui/once-update.svg.import
new file mode 100644
index 0000000..74650f8
--- /dev/null
+++ b/resources/ui/once-update.svg.import
@@ -0,0 +1,43 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://lrvlfvt55j0"
+path="res://.godot/imported/once-update.svg-f4b1e5659f6e3a349130c0b70453ee90.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://resources/ui/once-update.svg"
+dest_files=["res://.godot/imported/once-update.svg-f4b1e5659f6e3a349130c0b70453ee90.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/uastc_level=0
+compress/rdo_quality_loss=0.0
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/channel_remap/red=0
+process/channel_remap/green=1
+process/channel_remap/blue=2
+process/channel_remap/alpha=3
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
+svg/scale=1.0
+editor/scale_with_editor_scale=false
+editor/convert_colors_with_editor_theme=false
diff --git a/resources/ui/update-level.svg b/resources/ui/update-level.svg
new file mode 100644
index 0000000..222f5ab
--- /dev/null
+++ b/resources/ui/update-level.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources/ui/update-level.svg.import b/resources/ui/update-level.svg.import
new file mode 100644
index 0000000..e913164
--- /dev/null
+++ b/resources/ui/update-level.svg.import
@@ -0,0 +1,43 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://bq8wf01j5ulwe"
+path="res://.godot/imported/update-level.svg-c783aa8a587d702ab0b6f2ab2cae6028.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://resources/ui/update-level.svg"
+dest_files=["res://.godot/imported/update-level.svg-c783aa8a587d702ab0b6f2ab2cae6028.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/uastc_level=0
+compress/rdo_quality_loss=0.0
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/channel_remap/red=0
+process/channel_remap/green=1
+process/channel_remap/blue=2
+process/channel_remap/alpha=3
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
+svg/scale=1.0
+editor/scale_with_editor_scale=false
+editor/convert_colors_with_editor_theme=false
diff --git a/resources/ui/update-soul.svg b/resources/ui/update-soul.svg
new file mode 100644
index 0000000..e768c8a
--- /dev/null
+++ b/resources/ui/update-soul.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources/ui/update-soul.svg.import b/resources/ui/update-soul.svg.import
new file mode 100644
index 0000000..42cb801
--- /dev/null
+++ b/resources/ui/update-soul.svg.import
@@ -0,0 +1,43 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://bqplsjw07wkn8"
+path="res://.godot/imported/update-soul.svg-6c04c5cb2f7fa02a9e0fd187158d3b93.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://resources/ui/update-soul.svg"
+dest_files=["res://.godot/imported/update-soul.svg-6c04c5cb2f7fa02a9e0fd187158d3b93.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/uastc_level=0
+compress/rdo_quality_loss=0.0
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/channel_remap/red=0
+process/channel_remap/green=1
+process/channel_remap/blue=2
+process/channel_remap/alpha=3
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
+svg/scale=1.0
+editor/scale_with_editor_scale=false
+editor/convert_colors_with_editor_theme=false
diff --git a/scripts/Statemachine/EntityBase.gd b/scripts/Statemachine/EntityBase.gd
index 485d76c..24e9ae5 100644
--- a/scripts/Statemachine/EntityBase.gd
+++ b/scripts/Statemachine/EntityBase.gd
@@ -312,6 +312,10 @@ func bulletHit(bullet: BulletBase, crit: bool):
func collectItem(itemType: ItemStore.ItemType, amount: int):
inventory[itemType] += amount
playSound("collect")
+ for weapon in weapons:
+ if weapon.autoUpdate && weapon.canUpdate(self ):
+ weapon.updateApply(self )
+ UIState.showTip("[b]%s[/b]已自动强化!" % weapon.displayName)
func storeEnergy(value: float, dontChangeDirection: bool = false):
energy += value * fields.get(FieldStore.Entity.ENERGY_MULTIPILER)
energyChanged.emit(energy, dontChangeDirection)
diff --git a/scripts/Structs/Feed.gd b/scripts/Structs/Feed.gd
index f5d7f12..882a9b2 100644
--- a/scripts/Structs/Feed.gd
+++ b/scripts/Structs/Feed.gd
@@ -66,6 +66,8 @@ func apply(entity: EntityBase):
entity.weaponStore.add_child(instance)
entity.rebuildWeaponIcons()
hide()
+ else:
+ UIState.showTip("物品不足!", TipBox.MessageType.ERROR)
selected.emit(allHave)
return allHave
func countOf(index: int) -> int:
diff --git a/scripts/Structs/Weapon.gd b/scripts/Structs/Weapon.gd
index e35f3dd..a4cc526 100644
--- a/scripts/Structs/Weapon.gd
+++ b/scripts/Structs/Weapon.gd
@@ -30,34 +30,53 @@ enum EmitType {
@export var debugRebuild: bool = false
@export var level: int = 0
-@onready var avatarRect: TextureRect = $"%avatar"
-@onready var nameLabel: WeaponName = $"%name"
-@onready var sourceLabel: Label = $"%source"
-@onready var teaseLabel: Label = $"%tease"
-@onready var energyLabel: Label = $"%energy"
-@onready var beachball: ItemShow = $"%beachball"
-@onready var soul: ItemShow = $"%soul"
-@onready var descriptionLabel: RichTextLabel = $"%description"
-@onready var updateBtn: Button = $"%updateBtn"
-@onready var extractBtn: Button = $"%extractBtn"
-@onready var inlayBtn: Button = $"%inlayBtn"
-@onready var sounds: Node2D = $"%sounds"
-@onready var moveLeftBtn: Button = $"%moveleft"
-@onready var moveRightBtn: Button = $"%moveright"
+@onready var avatarRect: TextureRect = $%avatar
+@onready var nameLabel: WeaponName = $%name
+@onready var sourceLabel: Label = $%source
+@onready var teaseLabel: Label = $%tease
+@onready var energyLabel: Label = $%energy
+@onready var beachball: ItemShow = $%beachball
+@onready var soul: ItemShow = $%soul
+@onready var descriptionLabel: RichTextLabel = $%description
+@onready var sounds: Node2D = $%sounds
+@onready var moveLeftBtn: Button = $%moveleft
+@onready var moveRightBtn: Button = $%moveright
+
+@onready var autoUpdateBtn: Button = $%autoUpdateBtn
+@onready var onceUpdateBtn: Button = $%onceUpdateBtn
+@onready var updateBtn: Button = $%updateBtn
+@onready var extractBtn: Button = $%extractBtn
+@onready var inlayBtn: Button = $%inlayBtn
var cooldownTimer: CooldownTimer = null
var originalStore: Dictionary = {}
var chargedTime: float = 0
var attackSpeed: float = 1
var looping: bool = false
+var autoUpdate: bool = false
func _ready():
cooldownTimer = CooldownTimer.new()
cooldownTimer.cooldown = cooldown
originalStore = store
+ autoUpdateBtn.toggled.connect(
+ func(on: bool):
+ autoUpdate = on
+ )
+ onceUpdateBtn.pressed.connect(
+ func():
+ var count = 0
+ while canUpdate(UIState.player):
+ updateApply(UIState.player)
+ count += 1
+ if count > 0:
+ UIState.showTip("一键强化提升了[b]%d[/b]级!" % count)
+ else:
+ UIState.showTip("一键强化没有提升等级......", TipBox.MessageType.ERROR)
+ )
updateBtn.pressed.connect(
func():
- apply(UIState.player)
+ updateApply(UIState.player)
)
extractBtn.pressed.connect(
func():
@@ -105,18 +124,20 @@ func _physics_process(_delta):
if debugRebuild:
rebuildInfo()
-func canUpdate():
- return UIState.player.hasItem({ItemStore.ItemType.BEACHBALL: costBeachball})
+func canUpdate(entity: EntityBase):
+ return entity.hasItem({ItemStore.ItemType.BEACHBALL: costBeachball})
func canInlay():
return UIState.player.hasItem({ItemStore.ItemType.SOUL: soulLevel})
-func apply(entity: EntityBase) -> bool:
- if canUpdate():
+func updateApply(entity: EntityBase) -> bool:
+ if canUpdate(entity):
level += 1
entity.inventory[ItemStore.ItemType.BEACHBALL] -= costBeachball
updateStore(level, entity)
costBeachball = floor(GameRule.weaponUpdateCost * costBeachball)
rebuildInfo(true)
return true
+ else:
+ UIState.showTip("沙滩球不足!", TipBox.MessageType.ERROR)
return false
func updateStore(to: int, entity: EntityBase):
store = update(to, originalStore.duplicate(), entity)
@@ -142,9 +163,9 @@ func rebuildInfo(showNext: bool = false):
beachball.count = costBeachball
soul.count = soulLevel
if is_instance_valid(UIState.player):
- beachball.enough = canUpdate()
+ beachball.enough = canUpdate(UIState.player)
soul.enough = canInlay()
- descriptionLabel.text = buildDescription(showNext && (canUpdate() || canInlay()))
+ descriptionLabel.text = buildDescription(showNext && (canUpdate(UIState.player) || canInlay()))
func formatValue(value: Variant, type: FieldStore.DataType) -> String:
if type == FieldStore.DataType.VALUE:
return "%.2f" % value