mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-30 07:51:54 +08:00
e688f7f0c1
refactor(DirTool): 添加获取无扩展名文件名的方法 feat(WorldManager): 初始化ComponentManager 新增多个子弹资源文件并移动至统一目录 包括ForeverRainbow、ArrowSeven、SunDance、HeavyCrystal和LightGun
23 lines
637 B
GDScript
23 lines
637 B
GDScript
class_name DirTool
|
|
|
|
static func listdir(path: String) -> Array[String]:
|
|
var files: Array[String] = []
|
|
var dir = DirAccess.open(path)
|
|
if !path.ends_with("/"):
|
|
path += "/"
|
|
if dir:
|
|
dir.list_dir_begin()
|
|
var file_name = dir.get_next()
|
|
while file_name != "":
|
|
if file_name != "." and file_name != "..":
|
|
if file_name.get_extension() == "remap":
|
|
file_name = file_name.substr(0, len(file_name) - 6)
|
|
files.append(path + file_name)
|
|
file_name = dir.get_next()
|
|
dir.list_dir_end()
|
|
return files
|
|
else:
|
|
return []
|
|
static func getBasenameWithoutExtension(path: String) -> String:
|
|
return path.get_file().get_basename()
|