50 lines
1.4 KiB
GDScript
50 lines
1.4 KiB
GDScript
@tool
|
|
extends MarginContainer
|
|
@onready var name_label: Label = %NameLabel
|
|
@onready var activation_label: Label = %ActivationLabel
|
|
@onready var texture_rect_bg: TextureRect = $TextureRectBg
|
|
@onready var texture_rect_item: TextureRect = %TextureRectItem
|
|
|
|
#@export
|
|
@export var IsActivation = false:
|
|
set(value):
|
|
IsActivation = value
|
|
if Engine.is_editor_hint():
|
|
update()
|
|
@export var Name = "":
|
|
set(value):
|
|
Name = value
|
|
if Engine.is_editor_hint():
|
|
update()
|
|
@export var ActivationText = "":
|
|
set(value):
|
|
ActivationText = value
|
|
if Engine.is_editor_hint():
|
|
update()
|
|
@export var TextureItem : Texture2D:
|
|
set(value):
|
|
TextureItem = value
|
|
if Engine.is_editor_hint():
|
|
update()
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready() -> void:
|
|
update()
|
|
pass # Replace with function body.
|
|
|
|
func update():
|
|
%NameLabel.text = Name
|
|
%TextureRectItem.texture = TextureItem
|
|
if IsActivation:
|
|
%ActivationLabel.text = ActivationText
|
|
%ActivationLabel.modulate = Color("2ec84a")
|
|
%NameLabel.modulate = Color("120B2A")
|
|
$TextureRectBg.texture = preload("res://pad_hmi_ui/information/function_bg_high.png")
|
|
else:
|
|
%ActivationLabel.text = "未连接"
|
|
%ActivationLabel.modulate = Color("ef4141")
|
|
%NameLabel.modulate = Color("2a233f")
|
|
$TextureRectBg.texture = preload("res://pad_hmi_ui/information/function_bg.png")
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta: float) -> void:
|
|
pass
|