challenge-editor/scene/start_config_mes.gd

46 lines
1.1 KiB
GDScript3
Raw Normal View History

2024-09-27 11:47:19 +08:00
extends PanelContainer
class_name StartConfigMes
var data:Dictionary
signal click(mes:StartConfigMes,ind:int)
const LOCK = preload("res://res/ui/ui_010_start_config/tuceng359.png")
const SELECTED = preload("res://res/ui/ui_010_start_config/tuceng356.png")
var index:int=0
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
#-1:上锁0解锁未选择1解锁且选择
var state:int=-2:
set(val):
if val!=state:
state=val
match val:
-1:
%btn_icon.show()
%btn_icon.texture=LOCK
%select_label.hide()
%btn.disabled=true
0:
%btn_icon.hide()
%select_label.show()
%btn.disabled=false
1:
%btn_icon.show()
%btn_icon.texture=SELECTED
%select_label.hide()
%btn.disabled=true
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func set_data(_data):
data=_data
%name.text=data["name"]
%intro.text=data["introduction"]
pass
func _on_btn_pressed() -> void:
click.emit(self,index)
pass # Replace with function body.