Skip to content

Commit

Permalink
progress模块调整
Browse files Browse the repository at this point in the history
框架跟进
  • Loading branch information
MrZ626 committed Oct 8, 2023
1 parent c07d1c2 commit cad10db
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Zenitha
Submodule Zenitha updated 1 files
+7 −0 file.lua
4 changes: 2 additions & 2 deletions assets/game/mode/mino/interior/marathon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ return {
initialize=function()
GAME.newPlayer(1,'mino')
GAME.setMain(1)
playBgm('push',PROGRESS.getMain()==1 and 'simp' or 'base')
playBgm('push',PROGRESS.get('main')==1 and 'simp' or 'base')
end,
settings={mino={
skin='mino_interior',
Expand All @@ -29,7 +29,7 @@ return {
local md=P.modeData
while md.stat.line>=md.lineTarget do
if md.lineTarget<200 then
if PROGRESS.getMain()>=2 and md.lineTarget<=150 and P.isMain then
if PROGRESS.get('main')>=2 and md.lineTarget<=150 and P.isMain then
BGM.set(bgmList['push'].add,'volume',(md.lineTarget/150)^2,2.6)
end
P.settings.dropDelay=dropSpeed[md.lineTarget/10+1]
Expand Down
4 changes: 2 additions & 2 deletions assets/game/mode/mino/interior/sprint.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ return {
initialize=function()
GAME.newPlayer(1,'mino')
GAME.setMain(1)
playBgm('race',PROGRESS.getMain()==1 and 'simp' or 'base')
playBgm('race',PROGRESS.get('main')==1 and 'simp' or 'base')
BG.set('none')
end,
settings={mino={
Expand All @@ -17,7 +17,7 @@ return {
afterClear={
mechLib.mino.sprint.event_afterClear[40],
function(P)
if PROGRESS.getMain()>=2 and P.modeData.stat.line>10 and P.isMain then
if PROGRESS.get('main')>=2 and P.modeData.stat.line>10 and P.isMain then
BGM.set(bgmList['race'].add,'volume',math.min((P.modeData.stat.line-10)/20,1),2.6)
end
end,
Expand Down
12 changes: 9 additions & 3 deletions assets/progress.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ local gc=love.graphics
Sum>=100 → II
Single>=200 or Sum>=350 → III
]]
local prgs={
local prgs=setmetatable({
firstLaunch=true,
main=1,
tutorial='000000',
interiorScore={
Expand All @@ -23,7 +24,11 @@ local prgs={
dig_practice=0,
},
},
}
},{
__index=function(_,k)
error("Attempt to read undefined progress data: "..tostring(k))
end,
})

local function sysInfoFunc()
if not SETTINGS.system.powerInfo then return end
Expand Down Expand Up @@ -113,6 +118,7 @@ function PROGRESS.load()
-- MSG.new('info',"Hash not match")
-- end
end
prgs.firstLaunch=false
else
MSG.new('info',"Load progress failed: "..res)
end
Expand Down Expand Up @@ -329,7 +335,7 @@ function PROGRESS.drawExteriorHeader(h)
end

-- Get
function PROGRESS.getMain() return prgs.main end
function PROGRESS.get(k) return prgs[k] end
function PROGRESS.getBgmUnlocked(name) return prgs.bgmUnlocked[name] end
function PROGRESS.getTutorialPassed(n)
if n then
Expand Down
6 changes: 3 additions & 3 deletions assets/scene/hello.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function scene.enter()
t=0
Zenitha.setClickFX(false)
Zenitha.setDrawCursor(NULL)
if PROGRESS.getMain()>=3 then PROGRESS.applyCoolWaitTemplate() end
if PROGRESS.get('main')>=3 then PROGRESS.applyCoolWaitTemplate() end
end

function scene.update(dt)
Expand All @@ -21,13 +21,13 @@ end

function scene.draw()
TASK.lock('drawBegin')
if PROGRESS.getMain()<=2 then
if PROGRESS.get('main')<=2 then
GC.clear(0,0,0)
if t<1 and t%.26>.13 then
FONT.set(50)
GC.print('_',40,20)
end
elseif PROGRESS.getMain()<=4 then
elseif PROGRESS.get('main')<=4 then
GC.replaceTransform(SCR.xOy_m)
GC.scale(1.6,1)
GC.setLineWidth(19.5)
Expand Down
14 changes: 7 additions & 7 deletions assets/scene/main_in.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ local scene={}
function scene.enter()
consoleClickCount=0
PROGRESS.setEnv('interior')
local visibleButtonName=PROGRESS.getMain()==1 and '1' or '2'
local visibleButtonName=PROGRESS.get('main')==1 and '1' or '2'
for _,v in next,scene.widgetList do
if v.name=='1' or v.name=='2' then
v:setVisible(v.name==visibleButtonName)
elseif v.name=='GameSet' then
v.color=PROGRESS.getMain()<=2 and COLOR.L or COLOR.lD
v.color=PROGRESS.get('main')<=2 and COLOR.L or COLOR.lD
end
end
if PROGRESS.getMain()<=2 and (PROGRESS.getInteriorScore('sprint')>=200 or PROGRESS.getTotalInteriorScore()>=350) then
if PROGRESS.get('main')<=2 and (PROGRESS.getInteriorScore('sprint')>=200 or PROGRESS.getTotalInteriorScore()>=350) then
PROGRESS.transcendTo(3)
elseif PROGRESS.getMain()==1 and (PROGRESS.getTotalInteriorScore()>=150 or PROGRESS.getTutorialPassed()) then
elseif PROGRESS.get('main')==1 and (PROGRESS.getTotalInteriorScore()>=150 or PROGRESS.getTutorialPassed()) then
PROGRESS.transcendTo(2)
end
end

local function sysAction(action)
if action=='back' then
if PROGRESS.getMain()<=2 then
if PROGRESS.get('main')<=2 then
if sureCheck('quit') then PROGRESS.quit() end
else
SCN.back('none')
Expand All @@ -46,7 +46,7 @@ function scene.draw()
GC.replaceTransform(SCR.xOy_m)

-- Progress bar
if PROGRESS.getMain()>=2 then
if PROGRESS.get('main')>=2 then
scoreColor(-520,PROGRESS.getInteriorScore('dig'))
scoreColor(-160,PROGRESS.getInteriorScore('sprint'))
scoreColor(200, PROGRESS.getInteriorScore('marathon'))
Expand Down Expand Up @@ -78,7 +78,7 @@ scene.widgetList={

{name='LangSel',type='button', pos={.5,.5},x=-270,y=320,w=400,h=100,text=CHAR.icon.language, fontSize=70,lineWidth=4,cornerR=0,code=WIDGET.c_goScn('lang_in','none')},
{name='GameSet',type='button', pos={.5,.5},x=270, y=320,w=400,h=100,text=LANG'main_in_settings', fontSize=40,lineWidth=4,cornerR=0,sound_trigger=false,code=function()
if PROGRESS.getMain()<=2 or isCtrlPressed() then
if PROGRESS.get('main')<=2 or isCtrlPressed() then
SFX.play('button_norm')
SCN.go('setting_in','none')
else
Expand Down
2 changes: 1 addition & 1 deletion assets/scene/pause_in.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ scene.widgetList={
{type='button',pos={.5,.5},x=300*0,y=-160,w=260,h=100,lineWidth=4,cornerR=0,fontSize=60,text=CHAR.icon.retry, code=function() sysAction('restart') end},
{type='button',pos={.5,.5},x=300*1,y=-160,w=260,h=100,lineWidth=4,cornerR=0,fontSize=60,text=CHAR.icon.settings,
code=function()
if PROGRESS.getMain()<=2 or isCtrlPressed() then
if PROGRESS.get('main')<=2 or isCtrlPressed() then
sysAction('setting')
else
SFX.play('move_failed')
Expand Down
2 changes: 1 addition & 1 deletion assets/scene/setting_in.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local scene={}

function scene.enter()
local L=scene.widgetList
if PROGRESS.getMain()==1 then
if PROGRESS.get('main')==1 then
L.das.y=250
L.arr.y=350
L.sdarr:setVisible(false)
Expand Down
2 changes: 1 addition & 1 deletion assets/scene/tutorial_in.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function scene.keyDown(key)
end

function scene.draw()
if PROGRESS.getMain()>1 then
if PROGRESS.get('main')>1 then
GC.replaceTransform(SCR.xOy_m)
GC.setColor(1,1,1,.42)
GC.rectangle('fill',-7,-250,4,540)
Expand Down

0 comments on commit cad10db

Please sign in to comment.