-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdemo_scene.gd
62 lines (39 loc) · 1.54 KB
/
demo_scene.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
extends Control
var a:Array[Array]
# Called when the node enters the scene tree for the first time.
func _ready():
if $Table.auto_reload:
a.append(["This", "data", "loaded", "on"])
a.append(["the", "_ready", "func"])
$Table.table = a
else:
$auto_reload_test_btn.disabled = true
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta):
$index_input.max_value = $Table.table.size() - 1
func _on_add_btn_pressed():
var array_long:Array = ["This", "Array", "is", "to", "long"]
var array_short:Array = ["And this", "is to", "short"]
$Table.add_row(array_long)
$Table.add_row(array_short)
func _on_remove_last_btn_pressed():
if $Table.remove_last_row():
print("Last row was removed")
else:
print("Last row was not removed")
func _on_remove_row_at_btn_pressed():
$Table.remove_row_at($index_input.value)
func _on_table_click_cell_data(cell:String):
print("This is the Text of the selected cell: ", cell)
func _on_table_click_row(row:Array):
print("This is the selected row: ", row)
func _on_table_click_cell_pos(pos:Vector2i):
print("This is the Vector2i of the selected cell: ", pos)
func _on_table_click_row_index(index:int):
print("This is the selected row index: ", index)
func _on_auto_reload_test_btn_pressed() -> void:
a.append(["Spawn", "a", "new", "line"])
func _on_table_double_click(pos: Vector2i, key:Key) -> void:
print("This is the Vector2i of the double clicked cell: ", pos)
print("And the cell value ist: ", $Table.table[pos.y][pos.x])
print("The pressed key was: ", key)