Started working on a simple dialog system

This commit is contained in:
2026-03-15 07:11:42 +11:00
parent 84cb13e717
commit 336dd59dbb
6 changed files with 39 additions and 3 deletions

22
DialogText.gd Normal file
View File

@@ -0,0 +1,22 @@
class_name DialogText extends Resource
#contains the raw text info, allows you to iterate through it line-by-line
#only parse text once
@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)