修改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

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