added a callback to call when loading a file
This commit is contained in:
parent
b25dfaa2de
commit
2d4221ecd2
@ -5,7 +5,11 @@ AssetBundle = {
|
|||||||
files = {}
|
files = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
function AssetBundle:load()
|
function AssetBundle:load(onFileLoading)
|
||||||
|
local onFileLoading = onFileLoading or function(path)
|
||||||
|
print("[AssetBundle]: loading " .. path)
|
||||||
|
end
|
||||||
|
|
||||||
local function enumerate(path)
|
local function enumerate(path)
|
||||||
local tree = {}
|
local tree = {}
|
||||||
|
|
||||||
@ -14,6 +18,7 @@ function AssetBundle:load()
|
|||||||
local newPath = path .. "/" .. v
|
local newPath = path .. "/" .. v
|
||||||
local type = love.filesystem.getInfo(newPath).type
|
local type = love.filesystem.getInfo(newPath).type
|
||||||
if type == "file" then
|
if type == "file" then
|
||||||
|
onFileLoading(newPath)
|
||||||
local data = self.loadFile(newPath)
|
local data = self.loadFile(newPath)
|
||||||
if data:is_some() then
|
if data:is_some() then
|
||||||
tree[self.cutExtension(v)] = data:unwrap()
|
tree[self.cutExtension(v)] = data:unwrap()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user