46 lines
1.1 KiB
GDScript
46 lines
1.1 KiB
GDScript
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.
|