背景模块使用方法微调
This commit is contained in:
@@ -9,16 +9,9 @@ local BG={
|
|||||||
discard=NULL,
|
discard=NULL,
|
||||||
}
|
}
|
||||||
|
|
||||||
--Load Background files from SOURCE ONLY
|
function BG.add(name,bg)
|
||||||
for _,v in next,love.filesystem.getDirectoryItems("parts/backgrounds")do
|
BGlist[name]=bg
|
||||||
if love.filesystem.getRealDirectory("parts/backgrounds/"..v)~=SAVEDIR then
|
|
||||||
local name=v:sub(1,-5)
|
|
||||||
BGlist[name]=require("parts/backgrounds/"..name)
|
|
||||||
else
|
|
||||||
LOG.print("Dangerous file : %SAVE%/parts/backgrounds/"..v)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function BG.send(...)
|
function BG.send(...)
|
||||||
if BG.event then
|
if BG.event then
|
||||||
BG.event(...)
|
BG.event(...)
|
||||||
|
|||||||
12
main.lua
12
main.lua
@@ -130,7 +130,17 @@ AIFUNC= require("parts/ai")
|
|||||||
MODES= require("parts/modes")
|
MODES= require("parts/modes")
|
||||||
TICK= require("parts/tick")
|
TICK= require("parts/tick")
|
||||||
|
|
||||||
--Load Scene files from SOURCE ONLY
|
--Load background files from SOURCE ONLY
|
||||||
|
for _,v in next,love.filesystem.getDirectoryItems("parts/backgrounds")do
|
||||||
|
if love.filesystem.getRealDirectory("parts/backgrounds/"..v)~=SAVEDIR then
|
||||||
|
local name=v:sub(1,-5)
|
||||||
|
BG.add(name,require("parts/backgrounds/"..name))
|
||||||
|
else
|
||||||
|
LOG.print("Dangerous file : %SAVE%/parts/backgrounds/"..v)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--Load scene files from SOURCE ONLY
|
||||||
for _,v in next,fs.getDirectoryItems("parts/scenes")do
|
for _,v in next,fs.getDirectoryItems("parts/scenes")do
|
||||||
if fs.getRealDirectory("parts/scenes/"..v)~=SAVEDIR then
|
if fs.getRealDirectory("parts/scenes/"..v)~=SAVEDIR then
|
||||||
require("parts/scenes/"..v:sub(1,-5))
|
require("parts/scenes/"..v:sub(1,-5))
|
||||||
|
|||||||
Reference in New Issue
Block a user