godot-psd-training/UI/psl/key_switch.gd

28 lines
540 B
GDScript3
Raw Normal View History

2024-04-19 17:48:20 +08:00
extends VBoxContainer
@export var keySwitchHasKey:bool
@export var lightText:String
@export var keyText:String
2024-04-22 15:32:19 +08:00
signal clickKeySwitchSignal(openLight:bool,keySwitch)
2024-04-19 17:48:20 +08:00
func _ready() -> void:
$Light/MarginContainer/Label.text=lightText
if keySwitchHasKey:
$Key.visible = true
$Key/MarginContainer/Label.text=keyText
else:
$Key.visible = false
2024-04-22 15:32:19 +08:00
func shouHandleKey() -> void:
$Key/Key.visible = true
$Key/Right_Rotate.visible = true
func hideHandleKey() -> void:
$Key/Key.visible = false
$Key/Right_Rotate.visible = false