challenge-editor/scene/game_flow_touch.gd
2024-11-15 17:50:30 +08:00

43 lines
1.0 KiB
GDScript

extends MarginContainer
@onready var name_debug: Label = $name_debug
signal touch_click(data:Dictionary)
var data:Dictionary
var scene_id:String
var ind:String
func set_data(_data:Dictionary):
data=_data
name_debug.text=data["name"]
position=Vector2(data["position"][0],data["position"][1])
pass
func update_time():
pass
func judge():
var res:bool=true
if data.has("condition"):
var condition_data:Array=data["condition"]
for i in condition_data.size():
var new_condition_data:Dictionary=condition_data[i].duplicate()
var type:String=new_condition_data["type"]
var _data:Dictionary=new_condition_data["data"]
_data["scene_id"]=data["scene_id"]
_data["touch_id"]=data["name"]
_data["index"]=str(i)
res=res and Global.call_condition_triger(type,_data)
if res:
self.show()
else:
self.hide()
func _on_tool_button_pressed() -> void:
if data.has("triger"):
for i in data["triger"]:
var type=i["type"]
var data=i["data"]
Global.call_triger(type,data)
pass
pass # Replace with function body.