26 lines
674 B
GDScript
26 lines
674 B
GDScript
extends Resource
|
|
class_name DialogueScene
|
|
|
|
static var baseLoc : String= "res://dialogue/resources/"
|
|
@export var dialogue: Array[Dialogue]
|
|
|
|
func get_scene() -> Array[Dialogue]:
|
|
return self.dialogue
|
|
|
|
func _init(dia : Array[Dialogue]) -> void:
|
|
dialogue = dia
|
|
|
|
static func load_dict(dict : Dictionary) -> DialogueScene:
|
|
var dia : Array[Dialogue]= []
|
|
for d :Dictionary in dict["d"]:
|
|
dia.append(Dialogue.load_dict(d))
|
|
return new(dia)
|
|
|
|
static func load_scene(loc: String) -> DialogueScene:
|
|
var f = FileAccess.open(baseLoc + loc, FileAccess.READ)
|
|
if f != null:
|
|
var ret = DialogueScene.load_dict(JSON.parse_string(f.get_as_text()))
|
|
f.close()
|
|
return ret
|
|
return null
|