40 lines
1.1 KiB
GDScript
40 lines
1.1 KiB
GDScript
class_name FuncTool
|
||
extends Node
|
||
|
||
|
||
|
||
static func cal(event_arr,node,data_arr = {}):
|
||
|
||
#先创建一个先前数据的空数列存储 方便来回加减
|
||
var the_previous = []
|
||
#执行每一个触发条件下的方法名称
|
||
for item in event_arr:
|
||
#调用Func脚本中的方法名称(对应上方)
|
||
var callable = Callable(Func,item["func_name"])
|
||
var arr = []
|
||
#如果方法中写了value 则在数列arr中连续存储对应对象:使用者,全局对象,上一个数值
|
||
if item.has("value"):
|
||
for value in item["value"]:
|
||
match value:
|
||
"User","Node":
|
||
arr.append(node)
|
||
"Scene":
|
||
arr.append(Global.scene)
|
||
"Playe":
|
||
arr.append(Global.playe)
|
||
"selectRoleData":
|
||
arr.append(Global.select_role_data)
|
||
"thePrevious":
|
||
arr.append(the_previous)
|
||
"Select":
|
||
arr.append(Global.select)
|
||
_:
|
||
if data_arr.has(value):
|
||
arr.append(data_arr[value])
|
||
else:
|
||
arr.append(value)
|
||
#逐个执行方法
|
||
the_previous = await callable.callv(arr)
|
||
if the_previous is String and the_previous == "return":
|
||
return
|