81 lines
2.9 KiB
GDScript
81 lines
2.9 KiB
GDScript
extends Panel
|
|
var node_select1: Node
|
|
var shift: int = 2
|
|
|
|
|
|
func _ready() -> void:
|
|
node_select1 = $table1
|
|
var EMS_G_TABLE: Array
|
|
for i_row in Constants.INPUT_EMS_G.size() + shift + 1:
|
|
var column: Array
|
|
for out_colum in Constants.OUT_EMS_G.size()+shift:
|
|
if out_colum > 1 and i_row ==0:
|
|
column.append(Constants.TableList)
|
|
|
|
elif out_colum > 1 and i_row > 2:
|
|
column.append(Constants.Switch)
|
|
elif (out_colum == 1 and i_row > 2) or (out_colum > 1 and i_row == 2):
|
|
column.append(Constants.SocketStatus)
|
|
else:
|
|
column.append(Constants.TableNode)
|
|
EMS_G_TABLE.append(column)
|
|
|
|
draw_tabl(node_select1, EMS_G_TABLE, EMS_G_TABLE.size())
|
|
|
|
node_select1.get_node2(1, 1).text = 'x3 : OUT'
|
|
node_select1.get_node2(0, 2).text = 'x3 : IN'
|
|
for i in Constants.INPUT_EMS_G.size():
|
|
node_select1.get_node2(0, i+shift+1).text = Constants.INPUT_EMS_G[i]
|
|
|
|
for i in Constants.OUT_EMS_G.size():
|
|
node_select1.get_node2(i+shift, 1).text = Constants.OUT_EMS_G[i]
|
|
|
|
for i in EMS_G_TABLE[0].size()-shift:
|
|
var list = node_select1.get_node2(i+shift, 0)
|
|
for k in Constants.OUT_x128.size():
|
|
list.add_item(Constants.OUT_x128[k])
|
|
|
|
|
|
var columns_min_size: Array
|
|
for i in EMS_G_TABLE[0].size():
|
|
columns_min_size.append(70)
|
|
node_select1.set_columns_min_size(columns_min_size)
|
|
|
|
Network.connect('_yau_receive', Callable(self, '_on_data_received'))
|
|
|
|
func draw_tabl(tbl, row: Array, count_row: int):
|
|
for i_row in count_row:
|
|
tbl.add_row(row[i_row])
|
|
|
|
|
|
func _on_data_received(data_from_yau_07):
|
|
var in_blank: int = data_from_yau_07.decode_u16(Constants.DataIndices.IN_BLANK_PRD)
|
|
var in_imp: int = data_from_yau_07.decode_u16(Constants.DataIndices.IN_IMPULS_PRD)
|
|
var out_blank: int = data_from_yau_07.decode_u16(Constants.DataIndices.OUT_BLANK_PRD)
|
|
var out_imp: int = data_from_yau_07.decode_u16(Constants.DataIndices.OUT_IMPULS_PRD)
|
|
|
|
for i in 16:
|
|
var socket_status = node_select1.get_node2(1, i+shift+1).get_child(0, false)
|
|
if (in_blank & (1 << i) != 0):
|
|
set_frame(socket_status, Constants.Frame.CONSTANT)
|
|
elif (in_imp & (1 << i) != 0):
|
|
set_frame(socket_status, Constants.Frame.VARIABLE)
|
|
else:
|
|
set_frame(socket_status, Constants.Frame.WORK)
|
|
#
|
|
for i in 16:
|
|
var socket_status = node_select1.get_node2(i+shift, 2).get_child(0, false)
|
|
if (out_blank & (1 << i) != 0):
|
|
set_frame(socket_status, Constants.Frame.CONSTANT)
|
|
elif (out_imp & (1 << i) != 0):
|
|
set_frame(socket_status, Constants.Frame.VARIABLE)
|
|
else:
|
|
set_frame(socket_status, Constants.Frame.WORK)
|
|
|
|
|
|
func _process(delta: float) -> void:
|
|
pass
|
|
|
|
|
|
func set_frame(node: Node, val: int): node.set_frame(val)
|