新增导出/导入数据界面(从统计界面进入)
This commit is contained in:
@@ -52,18 +52,10 @@ function keyDown.calculator(k)
|
||||
S.val=sub(S.val,1,-2)
|
||||
end
|
||||
if S.val==""then S.val="0"end
|
||||
elseif k=="+"or k=="="and kb.isDown("lshift","rshift")then
|
||||
S.sym="+"
|
||||
S.reg=false
|
||||
elseif k=="-"then
|
||||
S.sym="-"
|
||||
S.reg=false
|
||||
elseif k=="*"or k=="8"and kb.isDown("lshift","rshift")then
|
||||
S.sym="*"
|
||||
S.reg=false
|
||||
elseif k=="/"then
|
||||
S.sym="/"
|
||||
S.reg=false
|
||||
elseif k=="+"or k=="="and kb.isDown("lshift","rshift")then S.sym="+" S.reg=false
|
||||
elseif k=="*"or k=="8"and kb.isDown("lshift","rshift")then S.sym="*" S.reg=false
|
||||
elseif k=="-"then S.sym="-" S.reg=false
|
||||
elseif k=="/"then S.sym="/" S.reg=false
|
||||
elseif k=="return"then
|
||||
if byte(S.val,-1)==101 then S.val=sub(S.val,1,-2)end
|
||||
if S.sym and S.reg then
|
||||
@@ -96,8 +88,16 @@ function keyDown.calculator(k)
|
||||
elseif v==1379e8+2626e4+1379 then
|
||||
S.pass=true
|
||||
SCN.go("debug")
|
||||
elseif v%1==0 and v>=6001 and v<=6012 then
|
||||
love.keypressed("f"..(v-6000))
|
||||
elseif v%1==0 and v>=8001 and v<=8012 then
|
||||
love.keypressed("f"..(v-8000))
|
||||
elseif v==670 then
|
||||
LOG.print("Screen Info:")
|
||||
LOG.print("x y: "..SCR.x.." "..SCR.y)
|
||||
LOG.print("w h: "..SCR.w.." "..SCR.h)
|
||||
LOG.print("W H: "..SCR.W.." "..SCR.H)
|
||||
LOG.print("k: "..math.floor(SCR.k*100)*.01)
|
||||
LOG.print("rad: "..math.floor(SCR.rad*100)*.01)
|
||||
LOG.print("dpi: "..SCR.dpi)
|
||||
end
|
||||
elseif k=="escape"then
|
||||
S.val,S.reg,S.sym="0"
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
function sceneInit.debug()
|
||||
sceneTemp={
|
||||
reset=false,
|
||||
}
|
||||
end
|
||||
function keyDown.debug(key)
|
||||
LOG.print("keyPress: ["..key.."]")
|
||||
end
|
||||
|
||||
WIDGET.init("debug",{
|
||||
WIDGET.newButton({name="scrInfo",x=300,y=120,w=300,h=100,color="green",code=function()
|
||||
LOG.print("Screen Info:")
|
||||
LOG.print("x y: "..SCR.x.." "..SCR.y)
|
||||
LOG.print("w h: "..SCR.w.." "..SCR.h)
|
||||
LOG.print("W H: "..SCR.W.." "..SCR.H)
|
||||
LOG.print("k: "..math.floor(SCR.k*100)*.01)
|
||||
LOG.print("rad: "..math.floor(SCR.rad*100)*.01)
|
||||
LOG.print("dpi: "..SCR.dpi)
|
||||
end}),
|
||||
WIDGET.newButton({name="reset",x=640,y=380,w=240,h=100,color="orange",font=40,
|
||||
code=function()sceneTemp.reset=true end,
|
||||
hide=WIDGET.lnk.STPval("reset")}),
|
||||
WIDGET.newButton({name="reset1",x=340,y=480,w=240,h=100,color="red",font=35,
|
||||
code=function()
|
||||
love.filesystem.remove("unlock.dat")
|
||||
SFX.play("finesseError_long")
|
||||
TEXT.show("rank resetted",640,300,60,"stretch",.4)
|
||||
TEXT.show("effected after restart game",640,360,60,"stretch",.4)
|
||||
TEXT.show("play one game if you regret",640,390,40,"stretch",.4)
|
||||
end,
|
||||
hide=function()return not sceneTemp.reset end}),
|
||||
WIDGET.newButton({name="reset2",x=640,y=480,w=260,h=100,color="red",font=35,
|
||||
code=function()
|
||||
love.filesystem.remove("data.dat")
|
||||
SFX.play("finesseError_long")
|
||||
TEXT.show("game data resetted",640,300,60,"stretch",.4)
|
||||
TEXT.show("effected after restart game",640,360,60,"stretch",.4)
|
||||
TEXT.show("play one game if you regret",640,390,40,"stretch",.4)
|
||||
end,
|
||||
hide=function()return not sceneTemp.reset end}),
|
||||
WIDGET.newButton({name="reset3",x=940,y=480,w=260,h=100,color="red",font=35,
|
||||
code=function()
|
||||
local L=love.filesystem.getDirectoryItems("")
|
||||
for i=1,#L do
|
||||
local s=L[i]
|
||||
if s:sub(-4)==".dat"then
|
||||
love.filesystem.remove(s)
|
||||
end
|
||||
end
|
||||
SFX.play("clear_4")SFX.play("finesseError_long")
|
||||
TEXT.show("all file deleted",640,330,60,"stretch",.4)
|
||||
TEXT.show("effected after restart game",640,390,60,"stretch",.4)
|
||||
SCN.back()
|
||||
end,
|
||||
hide=function()return not sceneTemp.reset end}),
|
||||
WIDGET.newButton({name="back",x=640,y=620,w=200,h=80,font=40,code=WIDGET.lnk.BACK}),
|
||||
})
|
||||
88
parts/scenes/savedata.lua
Normal file
88
parts/scenes/savedata.lua
Normal file
@@ -0,0 +1,88 @@
|
||||
function sceneInit.savedata()
|
||||
sceneTemp={reset=false}
|
||||
end
|
||||
function keyDown.savedata(key)
|
||||
LOG.print("keyPress: ["..key.."]")
|
||||
end
|
||||
|
||||
local NULL={}
|
||||
local function encodeCB(T)
|
||||
love.system.setClipboardText(
|
||||
love.data.encode(
|
||||
"string","base64",
|
||||
love.data.compress(
|
||||
"string","zlib",
|
||||
dumpTable(T)
|
||||
)
|
||||
)
|
||||
)
|
||||
LOG.print(text.exportSuccess)
|
||||
end
|
||||
local function parseCB()
|
||||
local _
|
||||
local s=love.system.getClipboardText()
|
||||
|
||||
--Decode
|
||||
_,s=pcall(love.data.decode,"string","base64",s)
|
||||
if not _ then LOG.print(text.dataCorrupted,COLOR.red)return end
|
||||
_,s=pcall(love.data.decompress,"string","zlib",s)
|
||||
if not _ then LOG.print(text.dataCorrupted,COLOR.red)return end
|
||||
|
||||
s=loadstring(s)
|
||||
if s then
|
||||
setfenv(s,NULL)
|
||||
LOG.print(text.importSuccess,COLOR.green)
|
||||
return s()
|
||||
end
|
||||
end
|
||||
local function HIDE()
|
||||
return not sceneTemp.reset
|
||||
end
|
||||
WIDGET.init("savedata",{
|
||||
WIDGET.newButton({name="exportUnlock", x=190,y=150,w=280,h=100,color="lGreen",font=25,code=function()encodeCB(RANKS)end}),
|
||||
WIDGET.newButton({name="exportData", x=490,y=150,w=280,h=100,color="lGreen",font=25,code=function()encodeCB(STAT)end}),
|
||||
WIDGET.newButton({name="exportSetting", x=790,y=150,w=280,h=100,color="lGreen",font=25,code=function()encodeCB(SETTING)end}),
|
||||
WIDGET.newButton({name="exportVK", x=1090,y=150,w=280,h=100,color="lGreen",font=25,code=function()encodeCB(VK_org)end}),
|
||||
|
||||
WIDGET.newButton({name="importUnlock", x=190,y=300,w=280,h=100,color="lBlue",font=25,code=function()addToTable(parseCB()or NULL,RANKS)end}),
|
||||
WIDGET.newButton({name="importData", x=490,y=300,w=280,h=100,color="lBlue",font=25,code=function()addToTable(parseCB()or NULL,STAT)end}),
|
||||
WIDGET.newButton({name="importSetting", x=790,y=300,w=280,h=100,color="lBlue",font=25,code=function()addToTable(parseCB()or NULL,SETTING)end}),
|
||||
WIDGET.newButton({name="importVK", x=1090,y=300,w=280,h=100,color="lBlue",font=25,code=function()addToTable(parseCB()or NULL,VK_org)end}),
|
||||
|
||||
WIDGET.newButton({name="reset", x=640,y=460,w=280,h=100,color="lRed",font=40,code=function()sceneTemp.reset=true end,hide=function()return sceneTemp.reset end}),
|
||||
WIDGET.newButton({name="resetUnlock", x=340,y=460,w=280,h=100,color="red",
|
||||
code=function()
|
||||
love.filesystem.remove("unlock.dat")
|
||||
SFX.play("finesseError_long")
|
||||
TEXT.show("rank resetted",640,300,60,"stretch",.4)
|
||||
LOG.print("effected after restart game","message")
|
||||
LOG.print("fresh a rank if you regret","message")
|
||||
end,
|
||||
hide=HIDE}),
|
||||
WIDGET.newButton({name="resetData", x=640,y=460,w=280,h=100,color="red",
|
||||
code=function()
|
||||
love.filesystem.remove("data.dat")
|
||||
SFX.play("finesseError_long")
|
||||
TEXT.show("game data resetted",640,300,60,"stretch",.4)
|
||||
LOG.print("effected after restart game","message")
|
||||
LOG.print("play one game if you regret","message")
|
||||
end,
|
||||
hide=HIDE}),
|
||||
WIDGET.newButton({name="resetALL", x=940,y=460,w=280,h=100,color="red",
|
||||
code=function()
|
||||
local L=love.filesystem.getDirectoryItems("")
|
||||
for i=1,#L do
|
||||
local s=L[i]
|
||||
if s:sub(-4)==".dat"then
|
||||
love.filesystem.remove(s)
|
||||
end
|
||||
end
|
||||
SFX.play("clear_4")SFX.play("finesseError_long")
|
||||
TEXT.show("all file deleted",640,330,60,"stretch",.4)
|
||||
LOG.print("effected after restart game","message")
|
||||
SCN.back()
|
||||
end,
|
||||
hide=HIDE}),
|
||||
|
||||
WIDGET.newButton({name="back", x=640,y=620,w=200,h=80,font=40,code=WIDGET.lnk.BACK}),
|
||||
})
|
||||
@@ -93,6 +93,7 @@ function Pnt.stat()
|
||||
end
|
||||
|
||||
WIDGET.init("stat",{
|
||||
WIDGET.newButton({name="path",x=980,y=620,w=250,h=80,font=25,code=function()love.system.openURL(love.filesystem.getSaveDirectory())end,hide=MOBILE}),
|
||||
WIDGET.newButton({name="path",x=1000,y=540,w=250,h=80,font=25,code=function()love.system.openURL(love.filesystem.getSaveDirectory())end,hide=MOBILE}),
|
||||
WIDGET.newButton({name="save",x=1000,y=640,w=250,h=80,font=25,code=WIDGET.lnk.goScene("savedata")}),
|
||||
WIDGET.newButton({name="back",x=640,y=620,w=200,h=80,font=35,code=WIDGET.lnk.BACK}),
|
||||
})
|
||||
Reference in New Issue
Block a user