mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-29 21:45:09 +03:00
31 lines
488 B
GDScript3
31 lines
488 B
GDScript3
|
extends Node
|
||
|
|
||
|
var chapters
|
||
|
|
||
|
func _ready():
|
||
|
reload()
|
||
|
|
||
|
func reload():
|
||
|
chapters = []
|
||
|
|
||
|
var dir = Directory.new()
|
||
|
dir.open("res://levels")
|
||
|
dir.list_dir_begin()
|
||
|
|
||
|
var chapter_names = []
|
||
|
|
||
|
while true:
|
||
|
var file = dir.get_next()
|
||
|
if file == "":
|
||
|
break
|
||
|
elif not file.begins_with("."):
|
||
|
chapter_names.append(file)
|
||
|
|
||
|
dir.list_dir_end()
|
||
|
chapter_names.sort()
|
||
|
|
||
|
for c in chapter_names:
|
||
|
var chapter = Chapter.new()
|
||
|
chapter.load("res://levels/%s" % c)
|
||
|
chapters.push_back(chapter)
|