From 7e09d3bf280acaa2ce3baf6613f6df1661060103 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Fri, 6 Nov 2020 16:41:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E8=83=8C=E6=99=AF=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E4=BB=A3=E7=A0=81=E5=92=8C=E7=A8=8B=E5=BA=8F=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/bg.lua | 25 ++++++++++++++++++------- main.lua | 20 ++------------------ 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/Zframework/bg.lua b/Zframework/bg.lua index 9fe65a06..c8d60c27 100644 --- a/Zframework/bg.lua +++ b/Zframework/bg.lua @@ -1,22 +1,33 @@ +local BGlist={} local BG={ - list={}, cur="", - init=NULL, - resize=NULL, + init=nil, + resize=nil, update=NULL, draw=NULL, - event=NULL, + event=nil, discard=NULL, } -function BG.send(data) + +--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) + BGlist[name]=require("parts/backgrounds/"..name) + else + LOG.print("Dangerous file : %SAVE%/parts/backgrounds/"..v) + end +end + +function BG.send(...) if BG.event then - BG.event(data) + BG.event(...) end end function BG.set(background) if background==BG.cur or not SETTING.bg then return end BG.discard() - background=BG.list[background] + background=BGlist[background] if not background then LOG.print("No BG called"..background,"warn") return diff --git a/main.lua b/main.lua index 51e2c33b..f22f03f2 100644 --- a/main.lua +++ b/main.lua @@ -107,11 +107,11 @@ GAME={ }--Global game data PLAYERS={alive={}}--Players data CURMODE=nil--Current mode object +RANKS={sprint_10=0} --Load modules - -require("Zframework")--Load Zframework +require("Zframework") require("parts/list") require("parts/default_data") @@ -139,26 +139,10 @@ for _,v in next,fs.getDirectoryItems("parts/scenes")do end end ---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.list[name]=require("parts/backgrounds/"..name) - else - LOG.print("Dangerous file : %SAVE%/parts/backgrounds/"..v) - end -end - --Load files & settings -RANKS={sprint_10=0} - -if fs.getInfo("keymap.dat")then fs.remove("keymap.dat")end -if fs.getInfo("setting.dat")then fs.remove("setting.dat")end - if fs.getInfo("settings.dat")then FILE.loadSetting() else - -- firstRun=true if MOBILE then SETTING.VKSwitch=true SETTING.swap=false