Merge branch 'ci-test-jsapi'

This commit is contained in:
MrZ_26
2024-11-03 01:43:54 +08:00
36 changed files with 594 additions and 478 deletions

View File

@@ -330,20 +330,20 @@ local L={
},
cards={-- F0300 - F070F
cardBack= 0xF0300,
clubA= 0xF0301,
club2= 0xF0302,
club3= 0xF0303,
club4= 0xF0304,
club5= 0xF0305,
club6= 0xF0306,
club7= 0xF0307,
club8= 0xF0308,
club9= 0xF0309,
club10= 0xF030A,
clubJ= 0xF030B,
clubC= 0xF030C,
clubQ= 0xF030D,
clubK= 0xF030E,
spadeA= 0xF0301,
spade2= 0xF0302,
spade3= 0xF0303,
spade4= 0xF0304,
spade5= 0xF0305,
spade6= 0xF0306,
spade7= 0xF0307,
spade8= 0xF0308,
spade9= 0xF0309,
spade10= 0xF030A,
spadeJ= 0xF030B,
spadeC= 0xF030C,
spadeQ= 0xF030D,
spadeK= 0xF030E,
heartA= 0xF0401,
heart2= 0xF0402,
heart3= 0xF0403,

View File

@@ -1,3 +1,9 @@
if SYSTEM=='Web' then
return {
update=NULL
}
end
local appId='1288557386700951554'
local ffi=require"ffi"
@@ -133,7 +139,7 @@ if RPC_C then
local function checkIntArg(arg,maxBits,argName,func,maybeNil)
maxBits=math.min(maxBits or 32,52) -- lua number (double) can only store integers < 2^53
local maxVal=2^(maxBits-1) -- assuming signed integers, which, for now, are the only ones in use
local maxVal=2^(maxBits-1) -- assuming signed integers, which, for now, are the only ones in use
assert(type(arg)=="number" and math.floor(arg)==arg
and arg<maxVal and arg>=-maxVal
or (maybeNil and arg==nil),

View File

@@ -949,16 +949,16 @@ end
local combKey={
x=function()
love.system.setClipboardText(inputBox:getText())
CLIPBOARD.set(inputBox:getText())
inputBox:clear()
SFX.play('reach')
end,
c=function()
love.system.setClipboardText(inputBox:getText())
CLIPBOARD.set(inputBox:getText())
SFX.play('reach')
end,
v=function()
inputBox:addText(love.system.getClipboardText())
inputBox:addText(CLIPBOARD.get())
SFX.play('reach')
end,
}

View File

@@ -204,7 +204,7 @@ function scene.update(dt)
end
ct=ct-1
if ct==0 then
local t=love.system.getClipboardText()
local t=CLIPBOARD.get()
if type(t)=='string' then
t=t:lower():match("^s=(%d+)$")
t=t and tonumber(t) and tonumber(t)>0 and tonumber(t)<=8000 and floor(tonumber(t))

View File

@@ -181,7 +181,7 @@ function reset()
time=0
score=0
local t=love.system.getClipboardText()
local t=CLIPBOARD.get()
if type(t)=='string' then
t=t:lower():match("^s=(.+)")
t=t and tonumber(t) and tonumber(t)*2

View File

@@ -188,10 +188,10 @@ function scene.keyDown(key,isRep)
if #CUSTOMGAME_LOCAL.bag>0 then str=str..DATA.copySequence(CUSTOMGAME_LOCAL.bag) end
str=str.."!"
if #CUSTOMGAME_LOCAL.mission>0 then str=str..DATA.copyMission(CUSTOMGAME_LOCAL.mission) end
sys.setClipboardText(str.."!"..DATA.copyBoards(CUSTOMGAME_LOCAL.field).."!")
CLIPBOARD.set(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 str=CLIPBOARD.get()
local args=str:sub((str:find(":") or 0)+1):split("!")
local hasTooHighField=false
repeat

View File

@@ -226,10 +226,10 @@ 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(FIELD[page]))
CLIPBOARD.set("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()
local str=CLIPBOARD.get()
local p=str:find(":")-- ptr*
if p then
if not str:sub(1,p-1):find("Field") then

View File

@@ -68,11 +68,11 @@ 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(MISSION))
CLIPBOARD.set("Techmino Target:"..DATA.copyMission(MISSION))
MES.new('check',text.exportSuccess)
end
elseif key=='v' and kb.isDown('lctrl','rctrl') or key=='cV' then
local str=sys.getClipboardText()
local str=CLIPBOARD.get()
local p=str:find(":")-- ptr*
if p then
if not str:sub(1,p-1):find("Target") then

View File

@@ -1,4 +1,3 @@
local sys=love.system
local kb=love.keyboard
local sin=math.sin
@@ -76,11 +75,11 @@ 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(BAG))
CLIPBOARD.set("Techmino SEQ:"..DATA.copySequence(BAG))
MES.new('check',text.exportSuccess)
end
elseif key=='v' and kb.isDown('lctrl','rctrl') or key=='cV' then
local str=sys.getClipboardText()
local str=CLIPBOARD.get()
local p=str:find(":")-- ptr*
if p then
if not str:sub(1,p-1):find("SEQ") then

View File

@@ -124,7 +124,7 @@ end
local function _copy()
local t=_getList()[listBox.selected]
t=t.title_Org..":\n"..t.content_Org..(t.url and "\n[ "..t.url.." ]\n" or "\n")..text.dictNote
love.system.setClipboardText(t)
CLIPBOARD.set(t)
scene.widgetList.copy.hide=true
MES.new('info',text.copyDone)
end

View File

@@ -14,7 +14,7 @@ local function _submit()
end
end
local function _paste()
local t=love.system.getClipboardText()
local t=CLIPBOARD.get()
if t then
t=STRING.trim(t)
if #t==128 and t:match("[0-9A-Z]+") then

View File

@@ -97,7 +97,7 @@ function scene.keyDown(key)
if rep.available and rep.fileName then
local repStr=loadFile(rep.fileName,'-string')
if repStr then
love.system.setClipboardText(love.data.encode('string','base64',repStr))
CLIPBOARD.set(love.data.encode('string','base64',repStr))
MES.new('info',text.exportSuccess)
else
MES.new('error',text.replayBroken)
@@ -107,7 +107,7 @@ function scene.keyDown(key)
end
end
elseif key=='v' and kb.isDown('lctrl','rctrl') or key=='cV' then
local repStr=love.system.getClipboardText()
local repStr=CLIPBOARD.get()
local res,fileData=pcall(love.data.decode,'string','base64',repStr)
if res then
local fileName=os.date("replay/%Y_%m_%d_%H%M%S_import.rep")

View File

@@ -15,7 +15,7 @@ local function _setPW()
end
end
local function _paste()
local t=love.system.getClipboardText()
local t=CLIPBOARD.get()
if t then
t=STRING.trim(t)
if #t==8 and t:match("[0-9]+") then

View File

@@ -7,12 +7,12 @@ function scene.enter()
end
local function _dumpCB(T)
love.system.setClipboardText(STRING.packText(TABLE.dump(T)))
CLIPBOARD.set(STRING.packText(TABLE.dump(T)))
MES.new('check',text.exportSuccess)
end
local function _parseCB()
local _
local s=love.system.getClipboardText()
local s=CLIPBOARD.get()
-- Decode
s=STRING.unpackText(s)

View File

@@ -136,7 +136,7 @@ scene.widgetList={
},
WIDGET.newKey{name='bg_custom_base64',x=1010,y=1502.5,w=420,h=135,align='M',
code=function()
local okay,data=pcall(love.data.decode,"data","base64",love.system.getClipboardText())
local okay,data=pcall(love.data.decode,"data","base64",CLIPBOARD.get())
if okay and pcall(gc.newImage,data) then
love.filesystem.write('conf/customBG',data)
SETTING.bg='custom'

View File

@@ -164,7 +164,7 @@ scene.widgetList={
textBox,
WIDGET.newButton {name='home',x=1140,y= 90,w=170,h=80,sound='click',font=60,fText=CHAR.key.macHome,code=pressKey('home')},
WIDGET.newButton {name='endd',x=1140,y=190,w=170,h=80,sound='click',font=60,fText=CHAR.key.macEnd ,code=pressKey('end')},
WIDGET.newButton {name='copy',x=1140,y=290,w=170,h=80,sound='click',font=60,fText=CHAR.icon.copy ,code=function()love.system.setClipboardText(table.concat(textBox.texts,'\n'))end,color='lC'},
WIDGET.newButton {name='copy',x=1140,y=290,w=170,h=80,sound='click',font=60,fText=CHAR.icon.copy ,code=function()CLIPBOARD.set(table.concat(textBox.texts,'\n'))end,color='lC'},
logList,