mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-06-07 04:07:13 +08:00
feat: 更新饲料和物品显示逻辑,添加香蕉饲料场景,重构字段显示功能
This commit is contained in:
@@ -56,7 +56,7 @@ static func generate(
|
||||
var instance: BulletBase = bullet.instantiate()
|
||||
instance.launcher = launchBy
|
||||
instance.position = spawnPosition
|
||||
instance.rotation = spawnRotation
|
||||
instance.rotation = spawnRotation + randf_range(-launchBy.fields.get(FieldStore.Entity.OFFSET_SHOOT), launchBy.fields.get(FieldStore.Entity.OFFSET_SHOOT))
|
||||
if addToWorld:
|
||||
WorldManager.rootNode.add_child(instance)
|
||||
return instance
|
||||
|
||||
@@ -9,6 +9,7 @@ var fields = {
|
||||
FieldStore.Entity.CRIT_RATE: 0.05,
|
||||
FieldStore.Entity.CRIT_DAMAGE: 1,
|
||||
FieldStore.Entity.PENERATE: 0,
|
||||
FieldStore.Entity.OFFSET_SHOOT: 3
|
||||
}
|
||||
|
||||
@export var cooldownUnit: float = 100 # 100毫秒每次攻击
|
||||
|
||||
@@ -1,12 +1,21 @@
|
||||
@tool
|
||||
extends HBoxContainer
|
||||
class_name FieldShow
|
||||
|
||||
@export var field: FieldStore.Entity = FieldStore.Entity.MAX_HEALTH
|
||||
@export var value: String = ""
|
||||
@export var value: float = 0
|
||||
|
||||
@onready var nameLabel: Label = $"%name"
|
||||
@onready var valueLabel: Label = $"%value"
|
||||
|
||||
func _process(_delta):
|
||||
func _ready():
|
||||
nameLabel.text = FieldStore.entityMap[field]
|
||||
valueLabel.text = value
|
||||
var formattedValue: String
|
||||
var dataType = FieldStore.entityMapType[field]
|
||||
if dataType == FieldStore.DataType.VALUE:
|
||||
formattedValue = str(value)
|
||||
elif dataType == FieldStore.DataType.ANGLE:
|
||||
formattedValue = str(value) + "°"
|
||||
elif dataType == FieldStore.DataType.PERCENT:
|
||||
formattedValue = "%.1f" % (value * 100) + "%"
|
||||
valueLabel.text = formattedValue
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
@tool
|
||||
extends HBoxContainer
|
||||
class_name ItemShow
|
||||
|
||||
@export var type: ItemStore.ItemType = ItemStore.ItemType.BASEBALL
|
||||
@export var count: int = 0
|
||||
@@ -7,6 +8,6 @@ extends HBoxContainer
|
||||
@onready var avatarTexture: TextureRect = $"%avatar"
|
||||
@onready var countLabel: Label = $"%count"
|
||||
|
||||
func _process(_delta):
|
||||
func _ready():
|
||||
avatarTexture.texture = load("res://resources/items/%s.svg" % ItemStore.idMap[type])
|
||||
countLabel.text = str(count)
|
||||
|
||||
Reference in New Issue
Block a user