-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommand_tips.gd
More file actions
35 lines (27 loc) · 749 Bytes
/
command_tips.gd
File metadata and controls
35 lines (27 loc) · 749 Bytes
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
extends MarginContainer
onready var _list = $MarginContainer/VBoxContainer;
func show_tips(command_substr, command_list, font):
# If the command is blank then hide the tips list
if(command_substr.length() == 0):
hide();
return;
# Clear the tips list
for child in _list.get_children():
child.hide();
child.queue_free();
# Hack to get root parent to size correctly
margin_top = 0;
var command_matches = 0;
for command in command_list:
if(command.begins_with(command_substr)):
var new_label = Label.new();
new_label.set_text(command);
_list.add_child(new_label);
if(font):
new_label.add_font_override("font", font);
command_matches += 1;
if(command_matches == 0):
hide();
else:
show();
update();