diff --git a/components/Abstracts/EffectBase.tscn b/components/Abstracts/EffectBase.tscn index 646b143..804d7a0 100644 --- a/components/Abstracts/EffectBase.tscn +++ b/components/Abstracts/EffectBase.tscn @@ -5,6 +5,7 @@ [sub_resource type="ShaderMaterial" id="ShaderMaterial_7cv4k"] [node name="EffectBase" type="Node2D"] +z_index = 1 script = ExtResource("1_pt2rk") [node name="sounds" type="Node2D" parent="."] diff --git a/components/Abstracts/WeaponCardBase.tscn b/components/Abstracts/WeaponCardBase.tscn index d988704..0033b18 100644 --- a/components/Abstracts/WeaponCardBase.tscn +++ b/components/Abstracts/WeaponCardBase.tscn @@ -1,11 +1,10 @@ -[gd_scene load_steps=8 format=3 uid="uid://ckq2cq6m23hq3"] +[gd_scene load_steps=7 format=3 uid="uid://ckq2cq6m23hq3"] [ext_resource type="Script" path="res://scripts/Structs/Weapon.gd" id="1_g802t"] [ext_resource type="Theme" uid="uid://dhvs6urgf6jr5" path="res://themes/main.tres" id="2_fwkd3"] [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://dw0g7cb4skd5s" path="res://resources/items/beachball.svg" id="5_pr18h"] -[ext_resource type="Texture2D" uid="uid://7jhhyoinptns" path="res://resources/items/soul.svg" id="6_tygah"] +[ext_resource type="PackedScene" uid="uid://bbm8l3hr4ihar" path="res://components/UI/ItemShow.tscn" id="4_k01vb"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_n2ewr"] content_margin_left = 30.0 @@ -103,46 +102,21 @@ unique_name_in_owner = true layout_mode = 2 text = "0.0" -[node name="beachballInfo" type="HBoxContainer" parent="container/info/infos"] -layout_mode = 2 -alignment = 1 - -[node name="icon" type="TextureRect" parent="container/info/infos/beachballInfo"] -custom_minimum_size = Vector2(15, 15) -layout_mode = 2 -size_flags_horizontal = 4 -size_flags_vertical = 4 -texture = ExtResource("5_pr18h") -expand_mode = 1 -stretch_mode = 5 - -[node name="beachball" type="Label" parent="container/info/infos/beachballInfo"] +[node name="beachball" parent="container/info/infos" instance=ExtResource("4_k01vb")] unique_name_in_owner = true layout_mode = 2 -text = "500" - -[node name="soulInfo" type="HBoxContainer" parent="container/info/infos"] -layout_mode = 2 -alignment = 1 - -[node name="icon" type="TextureRect" parent="container/info/infos/soulInfo"] -custom_minimum_size = Vector2(15, 15) -layout_mode = 2 size_flags_horizontal = 4 -size_flags_vertical = 4 -texture = ExtResource("6_tygah") -expand_mode = 1 -stretch_mode = 5 +type = 3 -[node name="soul" type="Label" parent="container/info/infos/soulInfo"] +[node name="soul" parent="container/info/infos" instance=ExtResource("4_k01vb")] unique_name_in_owner = true layout_mode = 2 -text = "1" +size_flags_horizontal = 4 +type = 4 [node name="name" parent="container/info" instance=ExtResource("3_qv0b1")] unique_name_in_owner = true layout_mode = 2 -displayName = "未命名饲料" soulLevelColorMap = { 1: Color(1, 1, 1, 1), 2: Color(0.489296, 1, 0.548293, 1), @@ -155,7 +129,7 @@ soulLevelColorMap = { unique_name_in_owner = true layout_mode = 2 bbcode_enabled = true -text = "[center]造成[color=cyan]10[/color]→[color=yellow]10[/color]点伤害。[/center]" +text = "[center]造成[color=cyan]10[/color]点伤害。[/center]" fit_content = true [node name="costs" type="GridContainer" parent="container"] diff --git a/components/Bullets/PurpleCrystal.tscn b/components/Bullets/PurpleCrystal.tscn index 11b0cdb..79e63fd 100644 --- a/components/Bullets/PurpleCrystal.tscn +++ b/components/Bullets/PurpleCrystal.tscn @@ -20,6 +20,7 @@ animations = [{ [node name="PurpleCrystal" instance=ExtResource("1_45mh7")] script = ExtResource("2_4lnlm") displayName = "水晶" +lifeTime = 1000.0 [node name="texture" parent="." index="0"] sprite_frames = SubResource("SpriteFrames_r86b3") diff --git a/components/Bullets/PurpleCrystalSmall.tscn b/components/Bullets/PurpleCrystalSmall.tscn index 65ba39d..cfd2601 100644 --- a/components/Bullets/PurpleCrystalSmall.tscn +++ b/components/Bullets/PurpleCrystalSmall.tscn @@ -24,7 +24,7 @@ script = ExtResource("2_it0pa") displayName = "微型水晶" speed = 15.0 damage = 0.5 -lifeDistance = 1400.0 +lifeTime = 1000.0 [node name="texture" parent="." index="0"] scale = Vector2(0.6, 0.6) diff --git a/components/Effects/CatBoom.tscn b/components/Effects/CatBoom.tscn index fc19375..ae0da2d 100644 --- a/components/Effects/CatBoom.tscn +++ b/components/Effects/CatBoom.tscn @@ -1,9 +1,9 @@ -[gd_scene load_steps=9 format=3 uid="uid://b4y1kq7yger4h"] +[gd_scene load_steps=11 format=3 uid="uid://b4y1kq7yger4h"] [ext_resource type="PackedScene" uid="uid://bcvuuy2m0pke0" path="res://components/Abstracts/EffectBase.tscn" id="1_fwc1i"] [sub_resource type="Curve" id="Curve_snh3o"] -_data = [Vector2(0.502092, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] +_data = [Vector2(0.6, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] point_count = 2 [sub_resource type="CurveTexture" id="CurveTexture_tr6r8"] @@ -16,8 +16,15 @@ colors = PackedColorArray(1, 0.75, 0.75, 1, 1, 0.8625, 0.75, 1, 1, 0.970833, 0.7 [sub_resource type="GradientTexture1D" id="GradientTexture1D_5ra8e"] gradient = SubResource("Gradient_v4pid") +[sub_resource type="Curve" id="Curve_bqxyt"] +_data = [Vector2(0.4, 0), 162.223, 0.0, 1, 0, Vector2(0.8, 1), 0.0, 162.223, 0, 1] +point_count = 2 + +[sub_resource type="CurveTexture" id="CurveTexture_xd1pr"] +curve = SubResource("Curve_bqxyt") + [sub_resource type="Curve" id="Curve_a27b5"] -_data = [Vector2(0.497908, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] +_data = [Vector2(0.6, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] point_count = 2 [sub_resource type="CurveTexture" id="CurveTexture_sgxbq"] @@ -28,11 +35,12 @@ particle_flag_disable_z = true angle_min = 1.07288e-05 angle_max = 360.0 spread = 180.0 -initial_velocity_min = 80.0 -initial_velocity_max = 120.0 +initial_velocity_min = 150.0 +initial_velocity_max = 180.0 gravity = Vector3(0, 0, 0) -damping_min = 50.0 -damping_max = 50.0 +damping_min = 1000.0 +damping_max = 1000.0 +damping_curve = SubResource("CurveTexture_xd1pr") scale_min = 3.0 scale_max = 6.0 scale_curve = SubResource("CurveTexture_sgxbq") @@ -43,5 +51,5 @@ alpha_curve = SubResource("CurveTexture_tr6r8") [node name="particles" parent="." index="1"] z_index = 1 -amount = 150 +amount = 100 process_material = SubResource("ParticleProcessMaterial_yytbm") diff --git a/components/Weapons/BigLaser.tscn b/components/Weapons/BigLaser.tscn index 2477743..013fae2 100644 --- a/components/Weapons/BigLaser.tscn +++ b/components/Weapons/BigLaser.tscn @@ -30,13 +30,10 @@ stream = ExtResource("4_cb5nh") [node name="avatar" parent="container/info" index="0"] texture = ExtResource("2_qe8gb") -[node name="energy" parent="container/info/infos/energyInfo" index="1"] -text = "200.0" - [node name="name" parent="container/info" index="2"] displayName = "湮灭激光" quality = 2 typeTopic = 1 [node name="description" parent="container" index="2"] -text = "[center]每[color=cyan]0.10[/color]→[color=yellow]0.10[/color]秒造成[color=cyan]40[/color]→[color=yellow]45[/color]点伤害。[/center]" +text = "[center]每[color=cyan]0.10[/color]秒造成[color=cyan]40[/color]点伤害。[/center]" diff --git a/components/Weapons/ChainGun.tscn b/components/Weapons/ChainGun.tscn index a2ebb99..a6db0d9 100644 --- a/components/Weapons/ChainGun.tscn +++ b/components/Weapons/ChainGun.tscn @@ -26,11 +26,7 @@ cooldown = 50.0 [node name="avatar" parent="container/info" index="0"] texture = ExtResource("2_ghn43") -[node name="energy" parent="container/info/infos/energyInfo" index="1"] -text = "1.0" -[node name="beachball" parent="container/info/infos/beachballInfo" index="1"] -text = "400" [node name="name" parent="container/info" index="2"] displayName = "链式机枪" diff --git a/components/Weapons/LGBT.tscn b/components/Weapons/LGBT.tscn index 578cd42..251d890 100644 --- a/components/Weapons/LGBT.tscn +++ b/components/Weapons/LGBT.tscn @@ -37,11 +37,7 @@ stream = ExtResource("4_c5xse") [node name="avatar" parent="container/info" index="0"] texture = ExtResource("2_ou6jo") -[node name="energy" parent="container/info/infos/energyInfo" index="1"] -text = "50.0" -[node name="beachball" parent="container/info/infos/beachballInfo" index="1"] -text = "200" [node name="name" parent="container/info" index="2"] displayName = "彩虹旗" diff --git a/components/Weapons/Meowmere.tscn b/components/Weapons/Meowmere.tscn index 61fc14f..22d4656 100644 --- a/components/Weapons/Meowmere.tscn +++ b/components/Weapons/Meowmere.tscn @@ -30,8 +30,6 @@ cooldown = 200.0 [node name="avatar" parent="container/info" index="0"] texture = ExtResource("2_kiocs") -[node name="beachball" parent="container/info/infos/beachballInfo" index="1"] -text = "600" [node name="name" parent="container/info" index="2"] displayName = "彩虹猫之刃" diff --git a/components/Weapons/MushroomPickaxe.tscn b/components/Weapons/MushroomPickaxe.tscn index 6130fd5..ded1f6e 100644 --- a/components/Weapons/MushroomPickaxe.tscn +++ b/components/Weapons/MushroomPickaxe.tscn @@ -26,11 +26,7 @@ debugRebuild = true [node name="avatar" parent="container/info" index="0"] texture = ExtResource("2_u2d30") -[node name="energy" parent="container/info/infos/energyInfo" index="1"] -text = "2.0" -[node name="beachball" parent="container/info/infos/beachballInfo" index="1"] -text = "750" [node name="name" parent="container/info" index="2"] displayName = "蘑菇矿挖爪" diff --git a/components/Weapons/NuclearBomb.tscn b/components/Weapons/NuclearBomb.tscn index 38bf9e6..165fa0f 100644 --- a/components/Weapons/NuclearBomb.tscn +++ b/components/Weapons/NuclearBomb.tscn @@ -27,11 +27,7 @@ debugRebuild = true [node name="avatar" parent="container/info" index="0"] texture = ExtResource("2_5nh8i") -[node name="energy" parent="container/info/infos/energyInfo" index="1"] -text = "120.0" -[node name="beachball" parent="container/info/infos/beachballInfo" index="1"] -text = "600" [node name="name" parent="container/info" index="2"] displayName = "核弹控制器" diff --git a/components/Weapons/PurpleCrystal.tscn b/components/Weapons/PurpleCrystal.tscn index eff276d..7810f1f 100644 --- a/components/Weapons/PurpleCrystal.tscn +++ b/components/Weapons/PurpleCrystal.tscn @@ -21,8 +21,6 @@ stream = ExtResource("4_16daa") [node name="avatar" parent="container/info" index="0"] texture = ExtResource("2_wgtcw") -[node name="beachball" parent="container/info/infos/beachballInfo" index="1"] -text = "250" [node name="name" parent="container/info" index="2"] displayName = "紫水晶簇" diff --git a/components/Weapons/SevenSoul.tscn b/components/Weapons/SevenSoul.tscn index 282d06c..c91ca75 100644 --- a/components/Weapons/SevenSoul.tscn +++ b/components/Weapons/SevenSoul.tscn @@ -25,8 +25,6 @@ volume_db = 20.0 [node name="avatar" parent="container/info" index="0"] texture = ExtResource("3_nq3bo") -[node name="energy" parent="container/info/infos/energyInfo" index="1"] -text = "150.0" [node name="name" parent="container/info" index="2"] displayName = "bilioicik" diff --git a/components/Weapons/VectorStar.tscn b/components/Weapons/VectorStar.tscn index 683eb95..19f37de 100644 --- a/components/Weapons/VectorStar.tscn +++ b/components/Weapons/VectorStar.tscn @@ -29,11 +29,7 @@ cooldown = 500.0 [node name="avatar" parent="container/info" index="0"] texture = ExtResource("3_wfty8") -[node name="energy" parent="container/info/infos/energyInfo" index="1"] -text = "10.0" -[node name="beachball" parent="container/info/infos/beachballInfo" index="1"] -text = "400" [node name="name" parent="container/info" index="2"] displayName = "矢量核心" diff --git a/components/Weapons/WhiteSoul.tscn b/components/Weapons/WhiteSoul.tscn index ac9f1e4..6c17582 100644 --- a/components/Weapons/WhiteSoul.tscn +++ b/components/Weapons/WhiteSoul.tscn @@ -26,8 +26,6 @@ cooldown = 50.0 [node name="avatar" parent="container/info" index="0"] texture = ExtResource("2_kcegs") -[node name="beachball" parent="container/info/infos/beachballInfo" index="1"] -text = "300" [node name="name" parent="container/info" index="2"] displayName = "代达罗斯风暴魂" diff --git a/scripts/Contents/Panels/WeaponPanel.gd b/scripts/Contents/Panels/WeaponPanel.gd index 66ce012..4512994 100644 --- a/scripts/Contents/Panels/WeaponPanel.gd +++ b/scripts/Contents/Panels/WeaponPanel.gd @@ -6,6 +6,7 @@ extends FullscreenPanelBase func beforeOpen(_args: Array = []): for weapon in UIState.player.weapons: weapon.show() + weapon.rebuildInfo() UIState.player.weaponStore.remove_child(weapon) box.add_child(weapon) func afterClose(): diff --git a/scripts/Structs/Weapon.gd b/scripts/Structs/Weapon.gd index 8363250..ec45ccd 100644 --- a/scripts/Structs/Weapon.gd +++ b/scripts/Structs/Weapon.gd @@ -23,8 +23,8 @@ class_name Weapon @onready var avatarRect: TextureRect = $"%avatar" @onready var nameLabel: WeaponName = $"%name" @onready var energyLabel: Label = $"%energy" -@onready var beachballLabel: Label = $"%beachball" -@onready var soulLabel: Label = $"%soul" +@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" @@ -40,6 +40,12 @@ func _ready(): cooldownTimer = CooldownTimer.new() cooldownTimer.cooldown = cooldown originalStore = store + updateBtn.mouse_entered.connect(func(): rebuildInfo(true)) + updateBtn.mouse_exited.connect(func(): rebuildInfo()) + extractBtn.mouse_entered.connect(func(): rebuildInfo(true)) + extractBtn.mouse_exited.connect(func(): rebuildInfo()) + inlayBtn.mouse_entered.connect(func(): rebuildInfo(true)) + inlayBtn.mouse_exited.connect(func(): rebuildInfo()) updateBtn.pressed.connect( func(): apply(UIState.player) @@ -90,17 +96,19 @@ func _physics_process(_delta): if debugRebuild: rebuildInfo() -func allHad(entity: EntityBase) -> bool: - return entity.inventory[ItemStore.ItemType.BEACHBALL] >= costBeachball -func apply(entity: EntityBase): - var allHave = allHad(entity) - if allHave: +func canUpdate(): + return UIState.player.hasItem({ItemStore.ItemType.BEACHBALL: costBeachball}) +func canInlay(): + return UIState.player.hasItem({ItemStore.ItemType.SOUL: soulLevel}) +func apply(entity: EntityBase) -> bool: + if canUpdate(): level += 1 entity.inventory[ItemStore.ItemType.BEACHBALL] -= costBeachball updateStore(level, entity) costBeachball = floor(GameRule.weaponUpdateCost * costBeachball) - rebuildInfo() - return allHave + rebuildInfo(true) + return true + return false func updateStore(to: int, entity: EntityBase): store = update(to, originalStore.duplicate(), entity) func multipiler() -> float: @@ -108,7 +116,7 @@ func multipiler() -> float: return 1 - UIState.player.fields.get(FieldStore.Entity.PRICE_REDUCTION) else: return 1 -func rebuildInfo(): +func rebuildInfo(showNext: bool = false): avatarRect.texture = avatarTexture nameLabel.displayName = displayName nameLabel.quality = quality @@ -116,9 +124,12 @@ func rebuildInfo(): nameLabel.soulLevel = soulLevel nameLabel.level = level energyLabel.text = "%.1f" % needEnergy - beachballLabel.text = str(costBeachball) - soulLabel.text = str(soulLevel) - descriptionLabel.text = buildDescription() + beachball.count = costBeachball + soul.count = soulLevel + if is_instance_valid(UIState.player): + beachball.enough = canUpdate() + soul.enough = canInlay() + descriptionLabel.text = buildDescription(showNext && (canUpdate() || canInlay())) func formatValue(value: Variant, type: FieldStore.DataType) -> String: if type == FieldStore.DataType.VALUE: return "%.2f" % value @@ -128,9 +139,11 @@ func formatValue(value: Variant, type: FieldStore.DataType) -> String: return ("%d" % (value * 100)) + "%" elif type == FieldStore.DataType.ANGLE: return "%.1f°" % value + elif type == FieldStore.DataType.FREQUENCY: + return "%.1fHz" % value else: return str(value) -func buildDescription() -> String: +func buildDescription(showNext: bool = false) -> String: var current = store var next = update(level + 1, originalStore.duplicate(), UIState.player) var result = descriptionTemplate @@ -140,7 +153,12 @@ func buildDescription() -> String: var type = storeType.get(key, FieldStore.DataType.VALUE) data = formatValue(data, type) nextData = formatValue(nextData, type) - result = result.replace("$" + key, "[color=cyan]%s[/color]→[color=yellow]%s[/color]" % [data, nextData]) + var text + if showNext: + text = "[color=cyan]%s[/color]→[color=yellow]%s[/color]" % [data, nextData] + else: + text = "[color=cyan]%s[/color]" % data + result = result.replace("$" + key, text) return "[center]%s[/center]" % result func readStore(key: String, default: Variant = null): return store.get(key, default) diff --git a/scripts/Tools/FieldStore.gd b/scripts/Tools/FieldStore.gd index 60be641..754edab 100644 --- a/scripts/Tools/FieldStore.gd +++ b/scripts/Tools/FieldStore.gd @@ -5,7 +5,8 @@ enum DataType { VALUE, INTEGER, PERCENT, - ANGLE + ANGLE, + FREQUENCY } enum Entity { MAX_HEALTH,