checheche/Robo-Bus-A31-HMI/common/gui/details.gd
2024-12-06 21:22:11 +08:00

47 lines
1.1 KiB
GDScript

extends BaseDataControl
var post = Vector2()
var button_text = ""
var button2_text = ""
#0 没有做任何选择 1装备 2丢弃
signal complete(ret)
func data_update():
# self.visible = true
%RichTextLabel.text = data
$details.global_position = post
# print($details.global_position)
$details.global_position.x = clampi($details.global_position.x,0,size.x-$details.size.x)
$details.global_position.y = clampi($details.global_position.y,0,size.y-$details.size.y)
# print($details.global_position,Vector2(size.x-$details.size.x,size.y-$details.size.y))
if button_text == "":
%Button.visible = false
else:
%Button.visible = true
%Button.text = button_text
if button2_text == "":
%Button2.visible = false
else:
%Button2.visible = true
%Button2.text = button2_text
func end():
complete.emit(0)
func _on_color_rect_on_click(node):
$AnimationPlayer.play("end")
pass # Replace with function body.
func _on_button_pressed():
complete.emit(1)
$AnimationPlayer.play("end")
pass # Replace with function body.
func _on_button_2_pressed():
complete.emit(2)
$AnimationPlayer.play("end")
pass # Replace with function body.