修改BGM模块的初始化log

简单统计启动第一帧各个阶段加载时间
This commit is contained in:
MrZ626
2021-10-25 16:00:56 +08:00
parent 423173413f
commit bd63584207
2 changed files with 17 additions and 1 deletions

View File

@@ -58,7 +58,7 @@ function BGM.init(list)
table.sort(simpList) table.sort(simpList)
function BGM.getList()return simpList end function BGM.getList()return simpList end
local count=#simpList local count=#simpList
LOG(count.." BGM files loaded") LOG(count.." BGM files added")
function BGM.getCount()return count end function BGM.getCount()return count end
local function _load(name) local function _load(name)

View File

@@ -44,12 +44,17 @@ if MOBILE then
love.window.setMode(w,h,f) love.window.setMode(w,h,f)
end end
local _LOADTIMELIST_={}
local _LOADTIME_=TIME()
--Load modules --Load modules
Z=require'Zframework' Z=require'Zframework'
FONT.load('parts/fonts/proportional.ttf') FONT.load('parts/fonts/proportional.ttf')
SCR.setSize(1280,720)--Initialize Screen size SCR.setSize(1280,720)--Initialize Screen size
BGM.setChange(function(name)MES.new('music',text.nowPlaying..name,5)end) BGM.setChange(function(name)MES.new('music',text.nowPlaying..name,5)end)
table.insert(_LOADTIMELIST_,("Load Zframework: %.3fs"):format(TIME()-_LOADTIME_))
--Create shortcuts --Create shortcuts
setFont=FONT.set setFont=FONT.set
getFont=FONT.get getFont=FONT.get
@@ -99,6 +104,8 @@ PLY= require'parts.player'
NETPLY= require'parts.netPlayer' NETPLY= require'parts.netPlayer'
MODES= require'parts.modes' MODES= require'parts.modes'
table.insert(_LOADTIMELIST_,("Load Parts: %.3fs"):format(TIME()-_LOADTIME_))
--Init Zframework --Init Zframework
Z.setIfPowerInfo(function() Z.setIfPowerInfo(function()
return SETTING.powerInfo and LOADED return SETTING.powerInfo and LOADED
@@ -339,6 +346,9 @@ LANG.init('zh',
end end
end)() end)()
) )
table.insert(_LOADTIMELIST_,("Initialize Parts: %.3fs"):format(TIME()-_LOADTIME_))
--Load background files from SOURCE ONLY --Load background files from SOURCE ONLY
for _,v in next,fs.getDirectoryItems('parts/backgrounds')do for _,v in next,fs.getDirectoryItems('parts/backgrounds')do
if isSafeFile('parts/backgrounds/'..v)and v:sub(-3)=='lua'then if isSafeFile('parts/backgrounds/'..v)and v:sub(-3)=='lua'then
@@ -370,6 +380,8 @@ for _,v in next,fs.getDirectoryItems('parts/modes')do
end end
end end
table.insert(_LOADTIMELIST_,("Load Files: %.3fs"):format(TIME()-_LOADTIME_))
--Update data --Update data
do do
local needSave local needSave
@@ -553,3 +565,7 @@ for _,fileName in next,fs.getDirectoryItems('replay')do
table.insert(REPLAY,rep) table.insert(REPLAY,rep)
end end
table.sort(REPLAY,function(a,b)return a.fileName>b.fileName end) table.sort(REPLAY,function(a,b)return a.fileName>b.fileName end)
table.insert(_LOADTIMELIST_,("Initialize Data: %.3fs"):format(TIME()-_LOADTIME_))
for i=1,#_LOADTIMELIST_ do print(_LOADTIMELIST_[i])end