mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
refactor(武器系统): 调整武器数值显示格式和数据结构
统一武器数值显示格式,将浮点数显示为整数或保留两位小数。修改storeType从数组改为字典结构以提高可读性。调整部分武器参数平衡性,包括BigLaser的时间系数和LGBTWeapon的power增量。移除VectorStarWeapon的mincount升级逻辑。为所有武器组件添加debugRebuild标志和默认500点costBeachball值。在FieldShow.gd中新增INTEGER数据类型处理。更新武器描述模板中的数值格式化逻辑。
This commit is contained in:
@@ -6,13 +6,13 @@ class_name Weapon
|
||||
@export var displayName: String = "未命名饲料"
|
||||
@export var quality: WeaponName.Quality = WeaponName.Quality.COMMON
|
||||
@export var typeTopic: WeaponName.TypeTopic = WeaponName.TypeTopic.IMPACT
|
||||
@export var costBeachball: int = 0
|
||||
@export var costBeachball: int = 500
|
||||
@export var store: Dictionary = {
|
||||
"atk": 10
|
||||
}
|
||||
@export var storeType: Array[FieldStore.DataType] = [
|
||||
FieldStore.DataType.VALUE
|
||||
]
|
||||
@export var storeType: Dictionary = {
|
||||
"atk": FieldStore.DataType.VALUE
|
||||
}
|
||||
@export var descriptionTemplate: String = "造成$atk点伤害。"
|
||||
@export var needEnergy: float = 0
|
||||
@export var cooldown: float = 100
|
||||
@@ -73,18 +73,18 @@ func rebuildInfo():
|
||||
descriptionLabel.text = buildDescription()
|
||||
func buildDescription() -> String:
|
||||
var result = descriptionTemplate
|
||||
var i = 0
|
||||
for key in store.keys():
|
||||
var data = store[key]
|
||||
var type = storeType[i]
|
||||
var type = storeType.get(key, FieldStore.DataType.VALUE)
|
||||
if type == FieldStore.DataType.VALUE:
|
||||
data = "%.1f" % data
|
||||
data = "%.2f" % data
|
||||
elif type == FieldStore.DataType.INTEGER:
|
||||
data = "%d" % data
|
||||
elif type == FieldStore.DataType.PERCENT:
|
||||
data = ("%.1f" % (data * 100)) + "%"
|
||||
data = ("%d" % (data * 100)) + "%"
|
||||
elif type == FieldStore.DataType.ANGLE:
|
||||
data = "%.1f°" % data
|
||||
result = result.replace("$" + key, "[color=cyan]%s[/color]" % data)
|
||||
i += 1
|
||||
return "[center]%s[/center]" % result
|
||||
func readStore(key: String, default: Variant = null):
|
||||
return store.get(key, default)
|
||||
|
||||
Reference in New Issue
Block a user