mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 15:01:53 +08:00
31 lines
853 B
GDScript
31 lines
853 B
GDScript
|
|
@tool
|
||
|
|
extends Control
|
||
|
|
class_name SublimateOptionHandler
|
||
|
|
|
||
|
|
signal apply()
|
||
|
|
|
||
|
|
@onready var nameLabel: Label = $%name
|
||
|
|
@onready var applyBtn: Button = $%applyBtn
|
||
|
|
@onready var costItemShow: ItemShow = $%costItem
|
||
|
|
|
||
|
|
var use: SublimateOption;
|
||
|
|
|
||
|
|
func _ready():
|
||
|
|
nameLabel.label_settings = nameLabel.label_settings.duplicate()
|
||
|
|
applyBtn.pressed.connect(
|
||
|
|
func():
|
||
|
|
if UIState.player.useItem({ItemStore.ItemType.DIAMOND: use.cost}):
|
||
|
|
apply.emit()
|
||
|
|
else:
|
||
|
|
UIState.showTip("钻石数量不足!", TipBox.MessageType.ERROR)
|
||
|
|
)
|
||
|
|
rebuildInfo()
|
||
|
|
|
||
|
|
func rebuildInfo():
|
||
|
|
if is_instance_valid(use):
|
||
|
|
nameLabel.label_settings.font_color = CategoryStore.qualityColorMap[use.quality]
|
||
|
|
nameLabel.label_settings.outline_color = CategoryStore.qualityColorMap[use.quality]
|
||
|
|
nameLabel.text = use.displayName
|
||
|
|
applyBtn.text = use.description
|
||
|
|
costItemShow.count = use.cost
|