-
Notifications
You must be signed in to change notification settings - Fork 0
/
Container.gd
52 lines (35 loc) · 990 Bytes
/
Container.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
extends VBoxContainer
@onready var itemList = $ItemList
@onready var interactionText = $InteractionText
@onready var source = $Source
var text = ""
var options = []
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func setSourceText(text):
source.text = text + ":"
func setText(text):
self.text = text
self.interactionText.text = self.text
func hideList():
self.itemList.visible = false
func populateList(options):
self.itemList.clear()
self.options = options
var has_options = false;
if options != null:
if options.size() > 0:
has_options = true
if has_options:
for i in range(options.size()):
if i == 0:
self.itemList.grab_focus()
self.itemList.add_item(options[i].text)
else:
self.itemList.grab_focus()
self.itemList.add_item(">")
self.itemList.select(0)