Moved files into folders
This commit is contained in:
21
DialogSystem/DialogText.gd
Normal file
21
DialogSystem/DialogText.gd
Normal file
@@ -0,0 +1,21 @@
|
||||
class_name DialogText extends Resource
|
||||
|
||||
##Contains raw text for dialog boxes, and allows you to iterate through it line-by-line.
|
||||
|
||||
@export_multiline() var text: String
|
||||
var _content: Array = []
|
||||
|
||||
func get_line_raw(line: int) -> String:
|
||||
if _content.size() == 0 and text.length() > 0:
|
||||
_parse_text()
|
||||
if line >= _content.size():
|
||||
return ""
|
||||
return _content[line]
|
||||
|
||||
func get_line_count() -> int:
|
||||
if _content.size() == 0 and text.length() > 0:
|
||||
_parse_text()
|
||||
return _content.size()
|
||||
|
||||
func _parse_text() -> void:
|
||||
_content = Array(text.split("\n")).filter(func(line): return line.length() > 0)
|
||||
Reference in New Issue
Block a user