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:
@@ -1,6 +1,63 @@
|
||||
local gc,kb,sys=love.graphics,love.keyboard,love.system
|
||||
local floor=math.floor
|
||||
local CUSTOMENV=CUSTOMENV
|
||||
|
||||
CUSTOMGAME_LOCAL={
|
||||
field={},
|
||||
bag={},
|
||||
mission={},
|
||||
customenv={},
|
||||
CUSval=function(self,k) return function() return self.customenv[k] end end,
|
||||
CUSrev=function(self,k) return function() self.customenv[k]=not self.customenv[k] end end,
|
||||
CUSsto=function(self,k) return function(i) self.customenv[k]=i end end,
|
||||
}
|
||||
local function CUSval(k) return CUSTOMGAME_LOCAL:CUSval(k) end
|
||||
local function CUSrev(k) return CUSTOMGAME_LOCAL:CUSrev(k) end
|
||||
local function CUSsto(k) return CUSTOMGAME_LOCAL:CUSsto(k) end
|
||||
local function apply_locals()
|
||||
FIELD=CUSTOMGAME_LOCAL.field
|
||||
BAG=CUSTOMGAME_LOCAL.bag
|
||||
MISSION=CUSTOMGAME_LOCAL.mission
|
||||
CUSTOMENV=CUSTOMGAME_LOCAL.customenv
|
||||
end
|
||||
do -- Initialize fields, sequence, missions, gameEnv for cutsom game
|
||||
local fieldData=loadFile('conf/customBoards','-string -canSkip')
|
||||
local fieldReinit=false
|
||||
if not fieldData then
|
||||
fieldReinit=true
|
||||
else
|
||||
fieldData=STRING.split(fieldData,"!")
|
||||
for i=1,#fieldData do
|
||||
local success,F=DATA.pasteBoard(fieldData[i])
|
||||
if not success then
|
||||
fieldReinit=true
|
||||
break
|
||||
end
|
||||
CUSTOMGAME_LOCAL.field[i]=F
|
||||
end
|
||||
end
|
||||
if fieldReinit then
|
||||
CUSTOMGAME_LOCAL.field={DATA.newBoard()}
|
||||
end
|
||||
local sequenceData=loadFile('conf/customSequence','-string -canSkip')
|
||||
if sequenceData then
|
||||
local success,bag=DATA.pasteSequence(sequenceData)
|
||||
if success then
|
||||
CUSTOMGAME_LOCAL.bag=bag
|
||||
end
|
||||
end
|
||||
local missionData=loadFile('conf/customMissions','-string -canSkip')
|
||||
if missionData then
|
||||
local success,mission=DATA.pasteMission(missionData)
|
||||
if success then
|
||||
CUSTOMGAME_LOCAL.mission=mission
|
||||
end
|
||||
end
|
||||
local customData=loadFile('conf/customEnv','-canSkip')
|
||||
if customData and customData['version']==VERSION.code then
|
||||
TABLE.complete(customData,CUSTOMGAME_LOCAL.customenv)
|
||||
end
|
||||
TABLE.complete(require"parts.customEnv0",CUSTOMGAME_LOCAL.customenv)
|
||||
end
|
||||
|
||||
local sList={
|
||||
visible={"show","easy","slow","medium","fast","none"},
|
||||
@@ -27,96 +84,114 @@ local scene={}
|
||||
|
||||
function scene.enter()
|
||||
destroyPlayers()
|
||||
BG.set(CUSTOMENV.bg)
|
||||
BGM.play(CUSTOMENV.bgm)
|
||||
BG.set(CUSTOMGAME_LOCAL.customenv.bg)
|
||||
BGM.play(CUSTOMGAME_LOCAL.customenv.bgm)
|
||||
modUsed=usingMod()
|
||||
end
|
||||
function scene.leave()
|
||||
saveFile(CUSTOMENV,'conf/customEnv')
|
||||
saveFile(CUSTOMGAME_LOCAL.customenv,'conf/customEnv')
|
||||
BGM.play()
|
||||
end
|
||||
|
||||
local function _play(mode)
|
||||
if CUSTOMENV.opponent~="X" then
|
||||
if CUSTOMENV.opponent:sub(1,2)=='CC' then
|
||||
if CUSTOMENV.sequence=='fixed' then
|
||||
if CUSTOMGAME_LOCAL.customenv.opponent~="X" then
|
||||
if CUSTOMGAME_LOCAL.customenv.opponent:sub(1,2)=='CC' then
|
||||
if CUSTOMGAME_LOCAL.customenv.sequence=='fixed' then
|
||||
MES.new('error',text.cc_fixed)
|
||||
return
|
||||
end
|
||||
if CUSTOMENV.holdMode=='swap' then
|
||||
if CUSTOMGAME_LOCAL.customenv.holdMode=='swap' then
|
||||
MES.new('error',text.cc_swap)
|
||||
return
|
||||
end
|
||||
end
|
||||
if #BAG>0 then
|
||||
for _=1,#BAG do
|
||||
if BAG[_]>7 then
|
||||
if #CUSTOMGAME_LOCAL.bag>0 then
|
||||
for _=1,#CUSTOMGAME_LOCAL.bag do
|
||||
if CUSTOMGAME_LOCAL.bag[_]>7 then
|
||||
MES.new('error',text.ai_prebag)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
if #MISSION>0 then
|
||||
if #CUSTOMGAME_LOCAL.mission>0 then
|
||||
MES.new('error',text.ai_mission)
|
||||
return
|
||||
end
|
||||
end
|
||||
saveFile(CUSTOMENV,'conf/customEnv')
|
||||
saveFile(CUSTOMGAME_LOCAL.customenv,'conf/customEnv')
|
||||
apply_locals()
|
||||
loadGame('custom_'..mode,true)
|
||||
end
|
||||
|
||||
function scene.keyDown(key,isRep)
|
||||
if isRep then return true end
|
||||
if key=='return' and kb.isDown('lctrl','lalt') or key=='play1' or key=='play2' then
|
||||
if (key=='play2' or kb.isDown('lalt')) and #FIELD[1]>0 then
|
||||
if (key=='play2' or kb.isDown('lalt')) and #CUSTOMGAME_LOCAL.field[1]>0 then
|
||||
_play('puzzle')
|
||||
elseif key=='play1' or kb.isDown('lctrl') then
|
||||
_play('clear')
|
||||
end
|
||||
elseif key=='f' then
|
||||
apply_locals()
|
||||
SCN.go('custom_field','swipeD')
|
||||
elseif key=='s' then
|
||||
apply_locals()
|
||||
SCN.go('custom_sequence','swipeD')
|
||||
elseif key=='m' then
|
||||
apply_locals()
|
||||
SCN.go('custom_mission','swipeD')
|
||||
elseif key=='delete' then
|
||||
if tryReset() then
|
||||
TABLE.cut(FIELD)TABLE.cut(BAG)TABLE.cut(MISSION)
|
||||
FIELD[1]=DATA.newBoard()
|
||||
TABLE.clear(CUSTOMENV)
|
||||
TABLE.complete(require"parts.customEnv0",CUSTOMENV)
|
||||
TABLE.cut(CUSTOMGAME_LOCAL.field)TABLE.cut(CUSTOMGAME_LOCAL.bag)TABLE.cut(CUSTOMGAME_LOCAL.mission)
|
||||
CUSTOMGAME_LOCAL.field[1]=DATA.newBoard()
|
||||
TABLE.clear(CUSTOMGAME_LOCAL.customenv)
|
||||
TABLE.complete(require"parts.customEnv0",CUSTOMGAME_LOCAL.customenv)
|
||||
for _,W in next,scene.widgetList do W:reset() end
|
||||
saveFile(DATA.copyMission(),'conf/customMissions')
|
||||
saveFile(DATA.copyBoards(),'conf/customBoards')
|
||||
saveFile(DATA.copySequence(),'conf/customSequence')
|
||||
saveFile(CUSTOMENV,'conf/customEnv')
|
||||
saveFile(DATA.copyMission(CUSTOMGAME_LOCAL.mission),'conf/customMissions')
|
||||
saveFile(DATA.copyBoards(CUSTOMGAME_LOCAL.field),'conf/customBoards')
|
||||
saveFile(DATA.copySequence(CUSTOMGAME_LOCAL.bag),'conf/customSequence')
|
||||
saveFile(CUSTOMGAME_LOCAL.customenv,'conf/customEnv')
|
||||
SFX.play('finesseError',.7)
|
||||
BG.set(CUSTOMENV.bg)
|
||||
BGM.play(CUSTOMENV.bgm)
|
||||
BG.set(CUSTOMGAME_LOCAL.customenv.bg)
|
||||
BGM.play(CUSTOMGAME_LOCAL.customenv.bgm)
|
||||
end
|
||||
elseif key=='f1' then
|
||||
SCN.go('mod','swipeD')
|
||||
elseif key=='c' and kb.isDown('lctrl','rctrl') or key=='cC' then
|
||||
local str="Techmino Quest:"..DATA.copyQuestArgs().."!"
|
||||
if #BAG>0 then str=str..DATA.copySequence() end
|
||||
local str="Techmino Quest:"..DATA.copyQuestArgs(CUSTOMGAME_LOCAL.customenv).."!"
|
||||
if #CUSTOMGAME_LOCAL.bag>0 then str=str..DATA.copySequence(CUSTOMGAME_LOCAL.bag) end
|
||||
str=str.."!"
|
||||
if #MISSION>0 then str=str..DATA.copyMission() end
|
||||
sys.setClipboardText(str.."!"..DATA.copyBoards().."!")
|
||||
if #CUSTOMGAME_LOCAL.mission>0 then str=str..DATA.copyMission(CUSTOMGAME_LOCAL.mission) end
|
||||
sys.setClipboardText(str.."!"..DATA.copyBoards(CUSTOMGAME_LOCAL.field).."!")
|
||||
MES.new('check',text.exportSuccess)
|
||||
elseif key=='v' and kb.isDown('lctrl','rctrl') or key=='cV' then
|
||||
local str=sys.getClipboardText()
|
||||
local args=str:sub((str:find(":") or 0)+1):split("!")
|
||||
repeat
|
||||
if #args<4 then break end-- goto THROW_fail
|
||||
if not (
|
||||
DATA.pasteQuestArgs(args[1]) and
|
||||
DATA.pasteSequence(args[2]) and
|
||||
DATA.pasteMission(args[3])
|
||||
) then break end-- goto THROW_fail
|
||||
TABLE.cut(FIELD)
|
||||
FIELD[1]=DATA.newBoard()
|
||||
local success,env=DATA.pasteQuestArgs(args[1])
|
||||
if not success then break end-- goto THROW_fail
|
||||
TABLE.cover(env,CUSTOMGAME_LOCAL.customenv)
|
||||
|
||||
local success,bag=DATA.pasteSequence(args[2])
|
||||
if not success then break end-- goto THROW_fail
|
||||
CUSTOMGAME_LOCAL.bag=bag
|
||||
|
||||
local success,mission=DATA.pasteMission(args[3])
|
||||
if not success then break end-- goto THROW_fail
|
||||
CUSTOMGAME_LOCAL.mission=mission
|
||||
|
||||
TABLE.cut(CUSTOMGAME_LOCAL.field)
|
||||
CUSTOMGAME_LOCAL.field[1]=DATA.newBoard()
|
||||
for i=4,#args do
|
||||
if args[i]:find("%S") and not DATA.pasteBoard(args[i],i-3) and i<#args then break end-- goto THROW_fail
|
||||
if args[i]:find("%S") then
|
||||
local success,F=DATA.pasteBoard(args[i])
|
||||
if success then
|
||||
CUSTOMGAME_LOCAL.field[i-3]=F
|
||||
else
|
||||
if i<#args then break end-- goto THROW_fail
|
||||
end
|
||||
end
|
||||
end
|
||||
MES.new('check',text.importSuccess)
|
||||
return
|
||||
@@ -133,20 +208,20 @@ function scene.draw()
|
||||
setFont(30)
|
||||
|
||||
-- Sequence
|
||||
if #MISSION>0 then
|
||||
gc.setColor(1,CUSTOMENV.missionKill and 0 or 1,floor(TIME()*6.26)%2)
|
||||
gc.print("#"..#MISSION,70,220)
|
||||
if #CUSTOMGAME_LOCAL.mission>0 then
|
||||
gc.setColor(1,CUSTOMGAME_LOCAL.customenv.missionKill and 0 or 1,floor(TIME()*6.26)%2)
|
||||
gc.print("#"..#CUSTOMGAME_LOCAL.mission,70,220)
|
||||
end
|
||||
|
||||
-- Field content
|
||||
if #FIELD[1]>0 then
|
||||
if #CUSTOMGAME_LOCAL.field[1]>0 then
|
||||
gc.push('transform')
|
||||
gc.translate(330,240)
|
||||
gc.scale(.5)
|
||||
gc.setColor(1,1,1)
|
||||
gc.setLineWidth(3)
|
||||
gc.rectangle('line',-2,-2,304,604)
|
||||
local F=FIELD[1]
|
||||
local F=CUSTOMGAME_LOCAL.field[1]
|
||||
local cross=TEXTURE.puzzleMark[-1]
|
||||
local texture=SKIN.lib[SETTING.skinSet]
|
||||
for y=1,#F do for x=1,10 do
|
||||
@@ -158,19 +233,19 @@ function scene.draw()
|
||||
end
|
||||
end end
|
||||
gc.pop()
|
||||
if #FIELD>1 then
|
||||
if #CUSTOMGAME_LOCAL.field>1 then
|
||||
gc.setColor(1,1,floor(TIME()*6.26)%2)
|
||||
gc.print("+"..#FIELD-1,490,220)
|
||||
gc.print("+"..#CUSTOMGAME_LOCAL.field-1,490,220)
|
||||
end
|
||||
end
|
||||
|
||||
-- Sequence
|
||||
if #BAG>0 then
|
||||
if #CUSTOMGAME_LOCAL.bag>0 then
|
||||
gc.setColor(1,1,floor(TIME()*6.26)%2)
|
||||
gc.print("#"..#BAG,615,220)
|
||||
gc.print("#"..#CUSTOMGAME_LOCAL.bag,615,220)
|
||||
end
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.print(CUSTOMENV.sequence,610,250)
|
||||
gc.print(CUSTOMGAME_LOCAL.customenv.sequence,610,250)
|
||||
|
||||
-- Mod indicator
|
||||
if modUsed then
|
||||
@@ -193,8 +268,8 @@ scene.widgetList={
|
||||
WIDGET.newKey{name='field', x=450,y=180,w=240,h=80,color='A',font=25,code=pressKey'f'},
|
||||
WIDGET.newKey{name='sequence', x=730,y=180,w=240,h=80,color='W',font=25,code=pressKey's'},
|
||||
|
||||
WIDGET.newText{name='noMsn', x=50, y=220,align='L',color='H',hideF=function() return MISSION[1] end},
|
||||
WIDGET.newText{name='defSeq', x=610,y=220,align='L',color='H',hideF=function() return BAG[1] end},
|
||||
WIDGET.newText{name='noMsn', x=50, y=220,align='L',color='H',hideF=function() return CUSTOMGAME_LOCAL.mission[1] end},
|
||||
WIDGET.newText{name='defSeq', x=610,y=220,align='L',color='H',hideF=function() return CUSTOMGAME_LOCAL.bag[1] end},
|
||||
|
||||
-- Selectors
|
||||
WIDGET.newSelector{name='opponent', x=170,y=330,w=260,color='R',list=sList.opponent, disp=CUSval('opponent'), code=CUSsto('opponent')},
|
||||
@@ -219,7 +294,7 @@ scene.widgetList={
|
||||
WIDGET.newButton{name='copy', x=1070,y=300,w=310,h=70,color='lR',font=25,code=pressKey'cC'},
|
||||
WIDGET.newButton{name='paste', x=1070,y=380,w=310,h=70,color='lB',font=25,code=pressKey'cV'},
|
||||
WIDGET.newButton{name='play_clear', x=1070,y=460,w=310,h=70,color='lY',font=35,code=pressKey'play1'},
|
||||
WIDGET.newButton{name='play_puzzle', x=1070,y=540,w=310,h=70,color='lM',font=35,code=pressKey'play2',hideF=function() return #FIELD[1]==0 end},
|
||||
WIDGET.newButton{name='play_puzzle', x=1070,y=540,w=310,h=70,color='lM',font=35,code=pressKey'play2',hideF=function() return #CUSTOMGAME_LOCAL.field[1]==0 end},
|
||||
WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=pressKey'escape'},
|
||||
|
||||
-- Ruleset
|
||||
@@ -235,15 +310,15 @@ scene.widgetList={
|
||||
WIDGET.newSwitch{name='bone', x=1170,y=970, lim=250,disp=CUSval('bone'), code=CUSrev('bone')},
|
||||
|
||||
-- Next & Hold
|
||||
WIDGET.newSelector{name='holdMode', x=310, y=890, w=300,color='lY',list=sList.holdMode,disp=CUSval('holdMode'),code=CUSsto('holdMode'),hideF=function() return CUSTOMENV.holdCount==0 end},
|
||||
WIDGET.newSelector{name='holdMode', x=310, y=890, w=300,color='lY',list=sList.holdMode,disp=CUSval('holdMode'),code=CUSsto('holdMode'),hideF=function() return CUSTOMGAME_LOCAL.customenv.holdCount==0 end},
|
||||
WIDGET.newSlider{name='nextCount', x=140, y=960, lim=130,w=180,axis={0,6,1},disp=CUSval('nextCount'),code=CUSsto('nextCount')},
|
||||
WIDGET.newSlider{name='holdCount', x=140, y=1030,lim=130,w=180,axis={0,6,1},disp=CUSval('holdCount'),code=CUSsto('holdCount')},
|
||||
WIDGET.newSwitch{name='infHold', x=560, y=960, lim=200, disp=CUSval('infHold'),code=CUSrev('infHold'),hideF=function() return CUSTOMENV.holdCount==0 end},
|
||||
WIDGET.newSwitch{name='phyHold', x=560, y=1030,lim=200, disp=CUSval('phyHold'),code=CUSrev('phyHold'),hideF=function() return CUSTOMENV.holdCount==0 end},
|
||||
WIDGET.newSwitch{name='infHold', x=560, y=960, lim=200, disp=CUSval('infHold'),code=CUSrev('infHold'),hideF=function() return CUSTOMGAME_LOCAL.customenv.holdCount==0 end},
|
||||
WIDGET.newSwitch{name='phyHold', x=560, y=1030,lim=200, disp=CUSval('phyHold'),code=CUSrev('phyHold'),hideF=function() return CUSTOMGAME_LOCAL.customenv.holdCount==0 end},
|
||||
|
||||
-- BG & BGM
|
||||
WIDGET.newSelector{name='bg', x=840, y=1100,w=250,color='Y',list=BG.getList(),disp=CUSval('bg'),code=function(i) CUSTOMENV.bg=i BG.set(i) end},
|
||||
WIDGET.newSelector{name='bgm', x=1120,y=1100,w=250,color='Y',list=BGM.getList(),disp=CUSval('bgm'),code=function(i) CUSTOMENV.bgm=i BGM.play(i) end},
|
||||
WIDGET.newSelector{name='bg', x=840, y=1100,w=250,color='Y',list=BG.getList(),disp=CUSval('bg'),code=function(i) CUSTOMGAME_LOCAL.customenv.bg=i BG.set(i) end},
|
||||
WIDGET.newSelector{name='bgm', x=1120,y=1100,w=250,color='Y',list=BGM.getList(),disp=CUSval('bgm'),code=function(i) CUSTOMGAME_LOCAL.customenv.bgm=i BGM.play(i) end},
|
||||
}
|
||||
|
||||
return scene
|
||||
|
||||
@@ -4,7 +4,7 @@ local kb=love.keyboard
|
||||
local max,min,floor=math.max,math.min,math.floor
|
||||
local ins,rem=table.insert,table.remove
|
||||
|
||||
local FIELD=FIELD
|
||||
local FIELD=CUSTOMGAME_LOCAL.field
|
||||
local scene={}
|
||||
|
||||
local curPen
|
||||
@@ -125,7 +125,7 @@ function scene.enter()
|
||||
page=1
|
||||
end
|
||||
function scene.leave()
|
||||
saveFile(DATA.copyBoards(),'conf/customBoards')
|
||||
saveFile(DATA.copyBoards(FIELD),'conf/customBoards')
|
||||
end
|
||||
|
||||
function scene.mouseMove(x,y)
|
||||
@@ -226,7 +226,7 @@ function scene.keyDown(key)
|
||||
SFX.play('clear_4',.8)
|
||||
SFX.play('fall',.8)
|
||||
elseif key=='c' and kb.isDown('lctrl','rctrl') or key=='cC' then
|
||||
sys.setClipboardText("Techmino Field:"..DATA.copyBoard(page))
|
||||
sys.setClipboardText("Techmino Field:"..DATA.copyBoard(FIELD[page]))
|
||||
MES.new('check',text.exportSuccess)
|
||||
elseif key=='v' and kb.isDown('lctrl','rctrl') or key=='cV' then
|
||||
local str=sys.getClipboardText()
|
||||
@@ -237,7 +237,9 @@ function scene.keyDown(key)
|
||||
end
|
||||
str=str:sub(p+1)
|
||||
end
|
||||
if DATA.pasteBoard(str,page) then
|
||||
local success,F=DATA.pasteBoard(str)
|
||||
if success then
|
||||
FIELD[page]=F
|
||||
MES.new('check',text.importSuccess)
|
||||
else
|
||||
MES.new('error',text.dataCorrupted)
|
||||
|
||||
@@ -5,6 +5,7 @@ local floor,sin=math.floor,math.sin
|
||||
local ins,rem=table.insert,table.remove
|
||||
|
||||
local scene={}
|
||||
local MISSION=CUSTOMGAME_LOCAL.mission
|
||||
|
||||
local input-- Input buffer
|
||||
local cur-- Cursor position
|
||||
@@ -14,7 +15,7 @@ function scene.enter()
|
||||
cur=#MISSION
|
||||
end
|
||||
function scene.leave()
|
||||
saveFile(DATA.copyMission(),'conf/customMissions')
|
||||
saveFile(DATA.copyMission(MISSION),'conf/customMissions')
|
||||
end
|
||||
|
||||
local ENUM_MISSION=ENUM_MISSION
|
||||
@@ -67,7 +68,7 @@ function scene.keyDown(key)
|
||||
end
|
||||
elseif key=='c' and kb.isDown('lctrl','rctrl') or key=='cC' then
|
||||
if #MISSION>0 then
|
||||
sys.setClipboardText("Techmino Target:"..DATA.copyMission())
|
||||
sys.setClipboardText("Techmino Target:"..DATA.copyMission(MISSION))
|
||||
MES.new('check',text.exportSuccess)
|
||||
end
|
||||
elseif key=='v' and kb.isDown('lctrl','rctrl') or key=='cV' then
|
||||
@@ -79,7 +80,9 @@ function scene.keyDown(key)
|
||||
end
|
||||
str=str:sub(p+1)
|
||||
end
|
||||
if DATA.pasteMission(str) then
|
||||
local success,mission=DATA.pasteMission(str)
|
||||
if success then
|
||||
CUSTOMGAME_LOCAL.mission=mission
|
||||
MES.new('check',text.importSuccess)
|
||||
cur=#MISSION
|
||||
else
|
||||
@@ -222,7 +225,7 @@ scene.widgetList={
|
||||
WIDGET.newKey{name='reset', x=1000,y=640,w=90, color='lY',font=50,code=pressKey'delete', fText=CHAR.icon.trash},
|
||||
WIDGET.newButton{name='copy', x=1140,y=440,w=170,h=80,color='lR',font=50,code=pressKey'cC', fText=CHAR.icon.export,hideF=function() return #MISSION==0 end},
|
||||
WIDGET.newButton{name='paste', x=1140,y=540,w=170,h=80,color='lB',font=50,code=pressKey'cV', fText=CHAR.icon.import},
|
||||
WIDGET.newSwitch{name='mission',x=1150,y=340,lim=280,disp=CUSval('missionKill'),code=CUSrev('missionKill')},
|
||||
WIDGET.newSwitch{name='mission',x=1150,y=340,lim=280,disp=CUSTOMGAME_LOCAL:CUSval('missionKill'),code=CUSTOMGAME_LOCAL:CUSrev('missionKill')},
|
||||
|
||||
WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene},
|
||||
}
|
||||
|
||||
@@ -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)},
|
||||
|
||||
@@ -106,7 +106,7 @@ scene.widgetList={
|
||||
WIDGET.newSelector{name='eventSet', x=1050,y=760,w=340,color='H',list=sList.eventSet,disp=ROOMval('eventSet'),code=ROOMval('eventSet')},
|
||||
|
||||
-- Next & Hold
|
||||
WIDGET.newSelector{name='holdMode', x=310, y=890, w=300,color='lY',list=sList.holdMode,disp=ROOMval('holdMode'),code=ROOMval('holdMode'),hideF=function() return CUSTOMENV.holdCount==0 end},
|
||||
WIDGET.newSelector{name='holdMode', x=310, y=890, w=300,color='lY',list=sList.holdMode,disp=ROOMval('holdMode'),code=ROOMval('holdMode'),hideF=function() return ROOMENV.holdCount==0 end},
|
||||
WIDGET.newSlider{name='nextCount', x=140, y=960, lim=130,w=200,axis={0,6,1},disp=ROOMval('nextCount'),code=ROOMsto('nextCount')},
|
||||
WIDGET.newSlider{name='holdCount', x=140, y=1030,lim=130,w=200,axis={0,6,1},disp=ROOMval('holdCount'),code=ROOMsto('holdCount')},
|
||||
WIDGET.newSwitch{name='infHold', x=560, y=960, lim=200, disp=ROOMval('infHold'),code=ROOMrev('infHold'),hideF=function() return ROOMENV.holdCount==0 end},
|
||||
|
||||
@@ -138,13 +138,13 @@ function scene.keyDown(key,isRep)
|
||||
SCN.swapTo('game','none')
|
||||
end
|
||||
elseif key=='p' then
|
||||
if (GAME.result or GAME.replaying) and #PLAYERS==1 then
|
||||
if (GAME.result or GAME.replaying) and GAME.initPlayerCount==1 then
|
||||
resetGameData('r')
|
||||
PLAYERS[1]:startStreaming(GAME.rep)
|
||||
SCN.swapTo('game','none')
|
||||
end
|
||||
elseif key=='o' then
|
||||
if (GAME.result or GAME.replaying) and #PLAYERS==1 and not GAME.saved then
|
||||
if (GAME.result or GAME.replaying) and GAME.initPlayerCount==1 and not GAME.saved then
|
||||
if DATA.saveReplay() then
|
||||
GAME.saved=true
|
||||
SFX.play('connected')
|
||||
@@ -359,8 +359,8 @@ scene.widgetList={
|
||||
fShade=GC.DO{70,70,{'setCL',1,1,1,.4},{'draw',GC.DO{70,70,{'setCL',1,1,1,1},{'fRRPol',37,35,32,3,6},{'fRRPol',25,35,32,3,6}}}},
|
||||
hideF=function() return PLAYERS[1].frameRun<=180 end,
|
||||
},
|
||||
WIDGET.newKey{name='replay', x=865,y=165,w=200,h=40,font=25,code=pressKey'p',hideF=function() return not (GAME.result or GAME.replaying) or #PLAYERS>1 end},
|
||||
WIDGET.newKey{name='save', x=1075,y=165,w=200,h=40,font=25,code=pressKey'o',hideF=function() return not (GAME.result or GAME.replaying) or #PLAYERS>1 or GAME.saved end},
|
||||
WIDGET.newKey{name='replay', x=865,y=165,w=200,h=40,font=25,code=pressKey'p',hideF=function() return not (GAME.result or GAME.replaying) or GAME.initPlayerCount>1 end},
|
||||
WIDGET.newKey{name='save', x=1075,y=165,w=200,h=40,font=25,code=pressKey'o',hideF=function() return not (GAME.result or GAME.replaying) or GAME.initPlayerCount>1 or GAME.saved end},
|
||||
}
|
||||
|
||||
return scene
|
||||
|
||||
@@ -52,6 +52,9 @@ local function _playRep(fileName)
|
||||
DATA.pumpRecording(rep.data,GAME.rep)
|
||||
|
||||
loadGame(rep.mode,true)
|
||||
if rep.private and GAME.curMode.loadPrivate then
|
||||
GAME.curMode.loadPrivate(rep.private)
|
||||
end
|
||||
resetGameData('r')
|
||||
PLAYERS[1].username=rep.player
|
||||
PLAYERS[1]:startStreaming(GAME.rep)
|
||||
|
||||
Reference in New Issue
Block a user