Save custom mode (#1007)

* first step to save custom game

* localize various settings in custom game

* rename fields to lower cases

* fix many bugs

* fixes #1014
This commit is contained in:
Imple Lee
2023-10-20 01:42:04 +08:00
committed by GitHub
parent 7ac2c282f6
commit 90c428cf44
13 changed files with 240 additions and 158 deletions

View File

@@ -6,6 +6,7 @@ local ins,rem=table.insert,table.remove
local gc_setColor,gc_print=GC.setColor,GC.print
local scene={}
local BAG=CUSTOMGAME_LOCAL.bag
local cur-- Cursor position
@@ -13,7 +14,7 @@ function scene.enter()
cur=#BAG
end
function scene.leave()
saveFile(DATA.copySequence(),'conf/customSequence')
saveFile(DATA.copySequence(BAG),'conf/customSequence')
end
local minoKey={
@@ -75,7 +76,7 @@ function scene.keyDown(key)
scene.widgetList.sequence:scroll(kb.isDown('lshift','rshift') and -1 or 1)
elseif key=='c' and kb.isDown('lctrl','rctrl') or key=='cC' then
if #BAG>0 then
sys.setClipboardText("Techmino SEQ:"..DATA.copySequence())
sys.setClipboardText("Techmino SEQ:"..DATA.copySequence(BAG))
MES.new('check',text.exportSuccess)
end
elseif key=='v' and kb.isDown('lctrl','rctrl') or key=='cV' then
@@ -87,7 +88,9 @@ function scene.keyDown(key)
end
str=str:sub(p+1)
end
if DATA.pasteSequence(str) then
local success,bag=DATA.pasteSequence(str)
if success then
CUSTOMGAME_LOCAL.bag=bag
MES.new('check',text.importSuccess)
cur=#BAG
else
@@ -175,7 +178,7 @@ scene.widgetList={
WIDGET.newSelector{name='sequence',x=1080,y=60,w=200,color='Y',
list={'bag','bagES','his','hisPool','c2','bagP1inf','rnd','mess','reverb','loop','fixed'},
disp=CUSval('sequence'),code=CUSsto('sequence')
disp=CUSTOMGAME_LOCAL:CUSval('sequence'),code=CUSTOMGAME_LOCAL:CUSsto('sequence')
},
WIDGET.newKey{name='Z', x=120,y=460,w=80,font=90,fText=CHAR.mino.Z,code=pressKey(1)},