Added mapping tool, reworked scene structure, and added test data.
This commit is contained in:
@@ -1,7 +1,25 @@
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user