新增导出/导入数据界面(从统计界面进入)
This commit is contained in:
@@ -50,8 +50,8 @@ return{
|
||||
ranks={"D","C","B","A","S"},
|
||||
|
||||
needRestart="Effective after restart",
|
||||
copySuccess="Copied successfully",
|
||||
pasteSuccess="Pasted successfully",
|
||||
exportSuccess="Export successfully",
|
||||
importSuccess="Import successfully",
|
||||
dataCorrupted="Data corrupted",
|
||||
VKTchW="Touch Weight",
|
||||
VKOrgW="Origin Weight",
|
||||
@@ -421,6 +421,7 @@ return{
|
||||
},
|
||||
stat={
|
||||
path="Open Data Folder",
|
||||
save="Data Management",
|
||||
},
|
||||
music={
|
||||
title="Music Room",
|
||||
@@ -528,13 +529,21 @@ return{
|
||||
pong={
|
||||
reset="Restart",
|
||||
},
|
||||
debug={
|
||||
copyLog="Copy Log",
|
||||
scrInfo="Screen Info",
|
||||
savedata={
|
||||
exportUnlock="Export progress",
|
||||
exportData="Export statistics",
|
||||
exportSetting="Export settings",
|
||||
exportVK="Export virtualkey layout",
|
||||
|
||||
importUnlock="Import progress",
|
||||
importData="Import statistics",
|
||||
importSetting="Import settings",
|
||||
importVK="Import virtualkey layout",
|
||||
|
||||
reset="RESET?",
|
||||
reset1="Reset ranks",
|
||||
reset2="Reset data",
|
||||
reset3="Reset all",
|
||||
resetUnlock="Reset ranks",
|
||||
resetData="Reset data",
|
||||
resetALL="Reset all",
|
||||
},
|
||||
},
|
||||
modes={
|
||||
|
||||
@@ -52,8 +52,8 @@ return{
|
||||
getRank="Rang: ",
|
||||
|
||||
needRestart="Fonctionnera dès la prochaine partie",
|
||||
copySuccess="Copié avec succès",
|
||||
pasteSuccess="Collé avec succès",
|
||||
-- exportSuccess="Export successfully",
|
||||
-- importSuccess="Import successfully",
|
||||
dataCorrupted="Données corrompues",
|
||||
VKTchW="Poids du toucher",
|
||||
VKOrgW="Pois d'origine",
|
||||
@@ -417,6 +417,7 @@ return{
|
||||
},
|
||||
stat={
|
||||
path="Ouvrir dossier des données",
|
||||
-- save="Data Management",
|
||||
},
|
||||
music={
|
||||
title="Salon musical",
|
||||
@@ -530,13 +531,21 @@ return{
|
||||
his="History",
|
||||
qq="QQ du créateur",
|
||||
},
|
||||
debug={
|
||||
copyLog="Copier logs",
|
||||
scrInfo="Montrer les infos de l'écran",
|
||||
savedata={
|
||||
-- exportUnlock="Export Unlock",
|
||||
-- exportData="Export Data",
|
||||
-- exportSetting="Export Setting",
|
||||
-- exportVK="Export VK",
|
||||
|
||||
-- importUnlock="Import Unlock",
|
||||
-- importData="Import Data",
|
||||
-- importSetting="Import Setting",
|
||||
-- importVK="Import VK",
|
||||
|
||||
reset="Réinitialiser ?",
|
||||
reset1="Réinitialiser les rangs",
|
||||
reset2="Réinitialiser les données",
|
||||
reset3="Tout réinitialiser",
|
||||
resetUnlock="Réinitialiser les rangs",
|
||||
resetData="Réinitialiser les données",
|
||||
resetALL="Tout réinitialiser",
|
||||
},
|
||||
},
|
||||
modes={
|
||||
|
||||
@@ -52,8 +52,8 @@ return{
|
||||
getRank="Rango obtenido:",
|
||||
|
||||
needRestart="Reinicia Techmino para que los cambios tengan efecto.",
|
||||
copySuccess="Copiado con éxito al Portapapeles",
|
||||
pasteSuccess="Pegado con éxito",
|
||||
-- exportSuccess="Export successfully",
|
||||
-- importSuccess="Import successfully",
|
||||
dataCorrupted="Los datos están corruptos.",
|
||||
VKTchW="Sens. al toque",
|
||||
VKOrgW="Sens. al origen",
|
||||
@@ -422,6 +422,7 @@ return{
|
||||
},
|
||||
stat={
|
||||
path="Abrir carpeta del juego",
|
||||
-- save="Data Management",
|
||||
},
|
||||
music={
|
||||
title="Sala de Música",
|
||||
@@ -529,13 +530,21 @@ return{
|
||||
pong={
|
||||
reset="Reiniciar",
|
||||
},
|
||||
debug={
|
||||
copyLog="Copiar Reporte",
|
||||
scrInfo="Mostrar inf. de pant.",
|
||||
savedata={
|
||||
-- exportUnlock="Export Unlock",
|
||||
-- exportData="Export Data",
|
||||
-- exportSetting="Export Setting",
|
||||
-- exportVK="Export VK",
|
||||
|
||||
-- importUnlock="Import Unlock",
|
||||
-- importData="Import Data",
|
||||
-- importSetting="Import Setting",
|
||||
-- importVK="Import VK",
|
||||
|
||||
reset="¿Reiniciar?",
|
||||
reset1="Reiniciar rangos",
|
||||
reset2="Reiniciar datos",
|
||||
reset3="Reiniciar todo",
|
||||
resetUnlock="Reiniciar rangos",
|
||||
resetData="Reiniciar datos",
|
||||
resetALL="Reiniciar todo",
|
||||
},
|
||||
},
|
||||
modes={
|
||||
|
||||
@@ -49,8 +49,8 @@ return{
|
||||
recSavingError="x!:",
|
||||
|
||||
needRestart="!!*#R#*!!",
|
||||
copySuccess="~$~",
|
||||
pasteSuccess="~v~",
|
||||
exportSuccess="~Out~",
|
||||
importSuccess="~In~",
|
||||
dataCorrupted="XXXXX",
|
||||
VKTchW="Tch↓",
|
||||
VKOrgW="Org↓",
|
||||
@@ -372,7 +372,8 @@ return{
|
||||
down="↓",
|
||||
},
|
||||
stat={
|
||||
path="_$_",
|
||||
path="%$%",
|
||||
save="%0101%",
|
||||
},
|
||||
music={
|
||||
title="(~~~~)",
|
||||
|
||||
@@ -51,8 +51,8 @@ return{
|
||||
ranks={"D","C","B","A","S"},
|
||||
|
||||
needRestart="重新开始以生效",
|
||||
copySuccess="已复制到剪切板",
|
||||
pasteSuccess="粘贴成功",
|
||||
exportSuccess="导出成功",
|
||||
importSuccess="导入成功",
|
||||
dataCorrupted="数据损坏",
|
||||
VKTchW="触摸点权重",
|
||||
VKOrgW="原始点权重",
|
||||
@@ -433,6 +433,7 @@ return{
|
||||
},
|
||||
stat={
|
||||
path="打开存储目录",
|
||||
save="用户档案管理",
|
||||
},
|
||||
login={
|
||||
title="登录/注册",
|
||||
@@ -530,13 +531,21 @@ return{
|
||||
pong={
|
||||
reset="重置",
|
||||
},
|
||||
debug={
|
||||
copyLog="复制日志",
|
||||
scrInfo="输出屏幕信息",
|
||||
savedata={
|
||||
exportUnlock="导出地图进度",
|
||||
exportData="导出统计数据",
|
||||
exportSetting="导出设置",
|
||||
exportVK="导出虚拟按键布局",
|
||||
|
||||
importUnlock="导入地图进度",
|
||||
importData="导入统计数据",
|
||||
importSetting="导入设置",
|
||||
importVK="导入虚拟按键布局",
|
||||
|
||||
reset="重置?",
|
||||
reset1="重置解锁/等级",
|
||||
reset2="重置统计",
|
||||
reset3="清空所有数据",
|
||||
resetUnlock="重置解锁/等级",
|
||||
resetData="重置统计",
|
||||
resetALL="清空所有数据",
|
||||
},
|
||||
},
|
||||
modes={
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
local sys,fs=love.filesystem,love.filesystem
|
||||
local fs=love.filesystem
|
||||
|
||||
local files={
|
||||
data= fs.newFile("data.dat"),
|
||||
@@ -35,9 +35,6 @@ function FILE.delRecord(N)
|
||||
fs.remove(N..".dat")
|
||||
end
|
||||
|
||||
function FILE.exportUnlock()
|
||||
sys.setClipboardText(dumpTable(RANKS))
|
||||
end
|
||||
function FILE.loadUnlock()
|
||||
local F=files.unlock
|
||||
if F:open("r")then
|
||||
@@ -61,9 +58,6 @@ function FILE.saveUnlock()
|
||||
end
|
||||
end
|
||||
|
||||
function FILE.exportUnlock()
|
||||
sys.setClipboardText(dumpTable(STAT))
|
||||
end
|
||||
function FILE.loadData()
|
||||
local F=files.data
|
||||
if F:open("r")then
|
||||
@@ -90,9 +84,6 @@ function FILE.saveData()
|
||||
end
|
||||
end
|
||||
|
||||
function FILE.exportSetting()
|
||||
sys.setClipboardText(dumpTable(SETTING))
|
||||
end
|
||||
function FILE.loadSetting()
|
||||
local F=files.setting
|
||||
if F:open("r")then
|
||||
@@ -139,9 +130,6 @@ function FILE.saveKeyMap()
|
||||
end
|
||||
end
|
||||
|
||||
function FILE.exportVK()
|
||||
sys.setClipboardText(dumpTable(VK_org))
|
||||
end
|
||||
function FILE.loadVK()
|
||||
local F=files.VK
|
||||
if F:open("r")then
|
||||
|
||||
@@ -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