challenge-editor/scene/start_config_mes.gd
2024-09-27 17:51:20 +08:00

46 lines
1.1 KiB
GDScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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解锁且选择 -2:刚实例出来
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.