20 lines
595 B
GDScript3
20 lines
595 B
GDScript3
|
class_name DialogueUtil extends RefCounted
|
||
|
|
||
|
|
||
|
static func get_lines(res: DialogueResource, title: String) -> Array:
|
||
|
var lines = []
|
||
|
var current_line = await res.get_next_dialogue_line(title)
|
||
|
while current_line:
|
||
|
lines.append(current_line)
|
||
|
if current_line.next_id != "end":
|
||
|
current_line = await res.get_next_dialogue_line(current_line.next_id)
|
||
|
else:
|
||
|
break
|
||
|
return lines
|
||
|
|
||
|
# pop os lines
|
||
|
static func generate_lines(content: String) -> Array:
|
||
|
var text = "~ title\n" + content + "\n=> END"
|
||
|
var res = DialogueManager.create_resource_from_text(text)
|
||
|
return await get_lines(res, "title")
|