1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-28 06:51:54 +08:00
Files

15 lines
331 B
GDScript
Raw Permalink Normal View History

@tool
extends Button
class_name TextSwitchButton
@export var pressedText: String = "已按下"
@export var unpressedText: String = "未按下"
func _ready():
updateText(button_pressed)
toggle_mode = true
toggled.connect(func(on: bool): updateText(on))
func updateText(on: bool):
text = [unpressedText, pressedText][int(on)]