mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-06-13 07:07:12 +08:00
feat(武器系统): 完善武器获取和提炼逻辑
- 在WeaponShow.gd中修改操作标签文本为"获得武器"和"提炼灵魂" - 在Feed.gd中添加武器获取逻辑,区分已有武器和新增武器情况 - 在EntityBase.gd中重构武器图标更新逻辑,提取为rebuildWeaponIcons方法
This commit is contained in:
@@ -85,7 +85,7 @@ var inventoryMax = {
|
|||||||
@onready var stageAnimator: AnimationPlayer = $"%stageAnimator"
|
@onready var stageAnimator: AnimationPlayer = $"%stageAnimator"
|
||||||
@onready var damageAnchor: Node2D = $"%damageAnchor"
|
@onready var damageAnchor: Node2D = $"%damageAnchor"
|
||||||
@onready var trailParticle: GPUParticles2D = $"%trailParticle"
|
@onready var trailParticle: GPUParticles2D = $"%trailParticle"
|
||||||
@onready var weaponStore = $"%weaponStore"
|
@onready var weaponStore: Node2D = $"%weaponStore"
|
||||||
var statebar: EntityStateBar
|
var statebar: EntityStateBar
|
||||||
|
|
||||||
var health: float = 0
|
var health: float = 0
|
||||||
@@ -127,10 +127,7 @@ func _ready():
|
|||||||
else:
|
else:
|
||||||
UIState.energyPercent.setCurrent(newEnergy)
|
UIState.energyPercent.setCurrent(newEnergy)
|
||||||
)
|
)
|
||||||
for i in weapons:
|
rebuildWeaponIcons()
|
||||||
var icon: SkillIcon = ComponentManager.getUIComponent("SkillIcon").instantiate()
|
|
||||||
icon.weapon = i
|
|
||||||
UIState.skillIconContainer.add_child(icon)
|
|
||||||
else:
|
else:
|
||||||
if !currentFocusedBoss:
|
if !currentFocusedBoss:
|
||||||
currentFocusedBoss = get_tree().get_nodes_in_group("players")[0]
|
currentFocusedBoss = get_tree().get_nodes_in_group("players")[0]
|
||||||
@@ -174,6 +171,14 @@ func _physics_process(_delta: float) -> void:
|
|||||||
trailParticle.emitting = trailing
|
trailParticle.emitting = trailing
|
||||||
|
|
||||||
# 通用方法
|
# 通用方法
|
||||||
|
func rebuildWeaponIcons():
|
||||||
|
if isPlayer():
|
||||||
|
for i in UIState.skillIconContainer.get_children():
|
||||||
|
i.queue_free()
|
||||||
|
for i in weapons:
|
||||||
|
var icon: SkillIcon = ComponentManager.getUIComponent("SkillIcon").instantiate()
|
||||||
|
icon.weapon = i
|
||||||
|
UIState.skillIconContainer.add_child(icon)
|
||||||
func timeLived():
|
func timeLived():
|
||||||
return WorldManager.getTime() - spawnTime
|
return WorldManager.getTime() - spawnTime
|
||||||
func setStage(stage: int):
|
func setStage(stage: int):
|
||||||
|
|||||||
@@ -21,12 +21,12 @@ func _ready():
|
|||||||
nameLabel.text = weaponInstance.displayName
|
nameLabel.text = weaponInstance.displayName
|
||||||
soulShow.count = weaponInstance.soulLevel
|
soulShow.count = weaponInstance.soulLevel
|
||||||
if operation == Operation.GET:
|
if operation == Operation.GET:
|
||||||
operationLabel.text = "获得"
|
operationLabel.text = "获得武器"
|
||||||
avatarRect.visible = true
|
avatarRect.visible = true
|
||||||
nameLabel.visible = true
|
nameLabel.visible = true
|
||||||
soulShow.visible = false
|
soulShow.visible = false
|
||||||
else:
|
else:
|
||||||
operationLabel.text = "提炼"
|
operationLabel.text = "提炼灵魂"
|
||||||
avatarRect.visible = false
|
avatarRect.visible = false
|
||||||
nameLabel.visible = false
|
nameLabel.visible = false
|
||||||
soulShow.visible = true
|
soulShow.visible = true
|
||||||
|
|||||||
@@ -51,6 +51,18 @@ func apply(entity: EntityBase):
|
|||||||
if !applier or applier.call(entity, value):
|
if !applier or applier.call(entity, value):
|
||||||
entity.fields[field] += value
|
entity.fields[field] += value
|
||||||
entity.fields[field] = clamp(entity.fields[field], 0, FieldStore.entityMaxValueMap.get(field, INF))
|
entity.fields[field] = clamp(entity.fields[field], 0, FieldStore.entityMaxValueMap.get(field, INF))
|
||||||
|
for i in weapons:
|
||||||
|
var instance = i.instantiate() as Weapon
|
||||||
|
if UIState.player.weaponBag.has(instance.displayName):
|
||||||
|
UIState.player.getItem({
|
||||||
|
ItemStore.ItemType.SOUL: instance.soulLevel
|
||||||
|
})
|
||||||
|
else:
|
||||||
|
instance.hide()
|
||||||
|
entity.weapons.append(instance)
|
||||||
|
entity.weaponBag.append(instance.displayName)
|
||||||
|
entity.weaponStore.add_child(instance)
|
||||||
|
entity.rebuildWeaponIcons()
|
||||||
hide()
|
hide()
|
||||||
selected.emit(allHave)
|
selected.emit(allHave)
|
||||||
return allHave
|
return allHave
|
||||||
|
|||||||
Reference in New Issue
Block a user