整理代码,只在代码中使用的字符串由双引号改为单引号
This commit is contained in:
@@ -2,10 +2,10 @@ local gc_clear=love.graphics.clear
|
||||
local BGs={
|
||||
none={draw=function()gc_clear(.15,.15,.15)end}
|
||||
}
|
||||
local BGlist={"none"}
|
||||
local BGlist={'none'}
|
||||
local BG={
|
||||
cur="none",
|
||||
default="none",
|
||||
cur='none',
|
||||
default='none',
|
||||
init=false,
|
||||
resize=false,
|
||||
update=NULL,
|
||||
|
||||
@@ -44,7 +44,7 @@ function BGM.init(list)
|
||||
end
|
||||
local function load(skip)
|
||||
for i=1,count do
|
||||
local file="media/BGM/"..list[i]..".ogg"
|
||||
local file='media/BGM/'..list[i]..'.ogg'
|
||||
if love.filesystem.getInfo(file)then
|
||||
Sources[list[i]]=love.audio.newSource(file,'stream')
|
||||
Sources[list[i]]:setLooping(true)
|
||||
|
||||
@@ -57,7 +57,7 @@ end
|
||||
function FILE.clear(path)
|
||||
if fs.getRealDirectory(path)~=SAVEDIR or fs.getInfo(path).type~='directory'then return end
|
||||
for _,name in next,fs.getDirectoryItems(path)do
|
||||
name=path.."/"..name
|
||||
name=path..'/'..name
|
||||
if fs.getRealDirectory(name)==SAVEDIR then
|
||||
local t=fs.getInfo(name).type
|
||||
if t=='file'then
|
||||
@@ -67,9 +67,9 @@ function FILE.clear(path)
|
||||
end
|
||||
end
|
||||
function FILE.clear_s(path)
|
||||
if path~=""and(fs.getRealDirectory(path)~=SAVEDIR or fs.getInfo(path).type~='directory')then return end
|
||||
if path~=''and(fs.getRealDirectory(path)~=SAVEDIR or fs.getInfo(path).type~='directory')then return end
|
||||
for _,name in next,fs.getDirectoryItems(path)do
|
||||
name=path.."/"..name
|
||||
name=path..'/'..name
|
||||
if fs.getRealDirectory(name)==SAVEDIR then
|
||||
local t=fs.getInfo(name).type
|
||||
if t=='file'then
|
||||
|
||||
@@ -13,10 +13,10 @@ function IMG.init(list)
|
||||
local loaded=0
|
||||
for k,v in next,list do
|
||||
if type(v)=='string'then
|
||||
IMG[k]=love.graphics.newImage("media/image/"..v)
|
||||
IMG[k]=love.graphics.newImage('media/image/'..v)
|
||||
else
|
||||
for i=1,#v do
|
||||
v[i]=love.graphics.newImage("media/image/"..v[i])
|
||||
v[i]=love.graphics.newImage('media/image/'..v[i])
|
||||
end
|
||||
IMG[k]=v
|
||||
end
|
||||
|
||||
@@ -3,44 +3,44 @@ EDITING=""
|
||||
LOADED=false
|
||||
ERRDATA={}
|
||||
|
||||
require"Zframework.setFont"
|
||||
ADRAW=require"Zframework.aDraw"
|
||||
require'Zframework.setFont'
|
||||
ADRAW=require'Zframework.aDraw'
|
||||
mStr=ADRAW.str
|
||||
mText=ADRAW.simpX
|
||||
mDraw=ADRAW.draw
|
||||
|
||||
SCR= require"Zframework.screen"
|
||||
COLOR= require"Zframework.color"
|
||||
SCN= require"Zframework.scene"
|
||||
WS= require"Zframework.websocket"
|
||||
SCR= require'Zframework.screen'
|
||||
COLOR= require'Zframework.color'
|
||||
SCN= require'Zframework.scene'
|
||||
WS= require'Zframework.websocket'
|
||||
|
||||
LOADLIB=require"Zframework.loadLib"
|
||||
WHEELMOV=require"Zframework.wheelScroll"
|
||||
LOADLIB=require'Zframework.loadLib'
|
||||
WHEELMOV=require'Zframework.wheelScroll'
|
||||
|
||||
JSON= require"Zframework.json"
|
||||
TABLE= require"Zframework.tableExtend"
|
||||
STRING= require"Zframework.stringExtend"
|
||||
JSON= require'Zframework.json'
|
||||
TABLE= require'Zframework.tableExtend'
|
||||
STRING= require'Zframework.stringExtend'
|
||||
|
||||
VIB= require"Zframework.vibrate"
|
||||
SFX= require"Zframework.sfx"
|
||||
VIB= require'Zframework.vibrate'
|
||||
SFX= require'Zframework.sfx'
|
||||
|
||||
LIGHT= require"Zframework.light"
|
||||
DOGC= require"Zframework.doGC"
|
||||
BG= require"Zframework.background"
|
||||
WIDGET= require"Zframework.widget"
|
||||
TEXT= require"Zframework.text"
|
||||
SYSFX= require"Zframework.sysFX"
|
||||
MES= require"Zframework.message"
|
||||
LIGHT= require'Zframework.light'
|
||||
DOGC= require'Zframework.doGC'
|
||||
BG= require'Zframework.background'
|
||||
WIDGET= require'Zframework.widget'
|
||||
TEXT= require'Zframework.text'
|
||||
SYSFX= require'Zframework.sysFX'
|
||||
MES= require'Zframework.message'
|
||||
|
||||
IMG= require"Zframework.image"
|
||||
BGM= require"Zframework.bgm"
|
||||
VOC= require"Zframework.voice"
|
||||
IMG= require'Zframework.image'
|
||||
BGM= require'Zframework.bgm'
|
||||
VOC= require'Zframework.voice'
|
||||
|
||||
LANG= require"Zframework.languages"
|
||||
TASK= require"Zframework.task"
|
||||
FILE= require"Zframework.file"
|
||||
PROFILE=require"Zframework.profile"
|
||||
THEME= require"Zframework.theme"
|
||||
LANG= require'Zframework.languages'
|
||||
TASK= require'Zframework.task'
|
||||
FILE= require'Zframework.file'
|
||||
PROFILE=require'Zframework.profile'
|
||||
THEME= require'Zframework.theme'
|
||||
|
||||
local ms,kb=love.mouse,love.keyboard
|
||||
|
||||
@@ -267,7 +267,7 @@ function love.keypressed(key,_,isRep)
|
||||
MES.new('info',"DEBUG ON",.2)
|
||||
elseif key=="f11"then
|
||||
if kb.isDown("lctrl","rctrl")then
|
||||
_G["\100\114\97\119\70\87\77"]=NULL
|
||||
_G['\100\114\97\119\70\87\77']=NULL
|
||||
else
|
||||
switchFullscreen()
|
||||
end
|
||||
@@ -371,7 +371,7 @@ function love.resize(w,h)
|
||||
if SCN.resize then SCN.resize(w,h)end
|
||||
WIDGET.resize(w,h)
|
||||
|
||||
SHADER.warning:send("w",w*SCR.dpi)
|
||||
SHADER.warning:send('w',w*SCR.dpi)
|
||||
end
|
||||
function love.focus(f)
|
||||
if f then
|
||||
|
||||
@@ -26,7 +26,7 @@ function LANG.init(langList,publicText)--Attention, calling this will destory al
|
||||
end
|
||||
|
||||
--Metatable:__call for table:getTip
|
||||
if type(rawget(L,"getTip"))=='table'then
|
||||
if type(rawget(L,'getTip'))=='table'then
|
||||
setmetatable(L.getTip,tipMeta)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,8 +6,8 @@ local clear,gc_translate=gc.clear,gc.translate
|
||||
local gc_setCanvas,gc_setShader=gc.setCanvas,gc.setShader
|
||||
local gc_setColor,gc_draw=gc.setColor,gc.draw
|
||||
|
||||
local shadowMapShader=gc.newShader("Zframework/light/shadowMap.glsl")--Shader for caculating the 1D shadow map.
|
||||
local lightRenderShader=gc.newShader("Zframework/light/lightRender.glsl")--Shader for rendering blurred lights and shadows.
|
||||
local shadowMapShader=gc.newShader('Zframework/light/shadowMap.glsl')--Shader for caculating the 1D shadow map.
|
||||
local lightRenderShader=gc.newShader('Zframework/light/lightRender.glsl')--Shader for rendering blurred lights and shadows.
|
||||
local Lights={}--Lightsource objects
|
||||
local function move(L,x,y)
|
||||
L.x,L.y=x,y
|
||||
@@ -22,8 +22,8 @@ local function drawLight(L)
|
||||
gc_setCanvas(L.blackCanvas)clear()
|
||||
gc_setCanvas(L.shadowCanvas)clear()
|
||||
gc_setCanvas(L.renderCanvas)clear()
|
||||
lightRenderShader:send("xresolution",s)
|
||||
shadowMapShader:send("yresolution",s)
|
||||
lightRenderShader:send('xresolution',s)
|
||||
shadowMapShader:send('yresolution',s)
|
||||
|
||||
--Get up-left of light
|
||||
local X=L.x-s*.5
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
return function(name,libName)
|
||||
if SYSTEM=="Windows"or SYSTEM=="Linux"then
|
||||
if SYSTEM=='Windows'or SYSTEM=='Linux'then
|
||||
local r1,r2,r3=pcall(require,libName[SYSTEM])
|
||||
if r1 and r2 then
|
||||
return r2
|
||||
else
|
||||
MES.new('error',"Cannot load "..name..": "..(r2 or r3))
|
||||
end
|
||||
elseif SYSTEM=="Android"then
|
||||
elseif SYSTEM=='Android'then
|
||||
local fs=love.filesystem
|
||||
local platform={'arm64-v8a','armeabi-v7a'}
|
||||
|
||||
for i=1,#platform do
|
||||
local soFile,_,_,mes1=fs.read('data',"libAndroid/"..platform[i].."/"..libName.Android)
|
||||
local soFile,_,_,mes1=fs.read('data','libAndroid/'..platform[i]..'/'..libName.Android)
|
||||
if soFile then
|
||||
local success,mes2=fs.write("lib/"..libName.Android,soFile)
|
||||
local success,mes2=fs.write('lib/'..libName.Android,soFile)
|
||||
if success then
|
||||
libFunc,mes2=package.loadlib(SAVEDIR.."/lib/"..libName.Android,libName.libFunc)
|
||||
libFunc,mes2=package.loadlib(SAVEDIR..'/lib/'..libName.Android,libName.libFunc)
|
||||
if libFunc then
|
||||
MES.new('check',name.." lib loaded")
|
||||
break
|
||||
|
||||
@@ -129,10 +129,10 @@ end
|
||||
|
||||
function MES.traceback()
|
||||
local mes=
|
||||
debug.traceback("",1)
|
||||
:gsub(": in function",", in")
|
||||
:gsub(":"," ")
|
||||
:gsub("\t","")
|
||||
debug.traceback('',1)
|
||||
:gsub(': in function',', in')
|
||||
:gsub(':',' ')
|
||||
:gsub('\t','')
|
||||
MES.new('error',mes:sub(
|
||||
mes:find("\n",2)+1,
|
||||
mes:find("\n%[C%], in 'xpcall'")
|
||||
|
||||
@@ -26,7 +26,7 @@ function profile.hooker(event,line,info)
|
||||
_telapsed[f]=_telapsed[f]+dt
|
||||
_tcalled[f]=nil
|
||||
end
|
||||
if event=="tail call"then
|
||||
if event=='tail call'then
|
||||
local prev=getInfo(3,'fnS')
|
||||
profile.hooker('return',line,prev)
|
||||
profile.hooker('call',line,info)
|
||||
|
||||
@@ -5,7 +5,7 @@ local SCR=SCR
|
||||
local scenes={}
|
||||
|
||||
local SCN={
|
||||
cur="NULL",--Current scene name
|
||||
cur='NULL',--Current scene name
|
||||
swapping=false,--If Swapping
|
||||
stat={
|
||||
tar=false, --Swapping target
|
||||
|
||||
@@ -2,8 +2,8 @@ local gc=love.graphics
|
||||
local newFont=gc.setNewFont
|
||||
local setNewFont=gc.setFont
|
||||
local fontCache,currentFontSize={}
|
||||
if love.filesystem.getInfo("font.ttf")then
|
||||
local fontData=love.filesystem.newFile("font.ttf")
|
||||
if love.filesystem.getInfo('font.ttf')then
|
||||
local fontData=love.filesystem.newFile('font.ttf')
|
||||
function setFont(s)
|
||||
if s~=currentFontSize then
|
||||
if not fontCache[s]then
|
||||
|
||||
@@ -13,7 +13,7 @@ function SFX.init(list)
|
||||
local count=#list function SFX.getCount()return count end
|
||||
local function load(skip)
|
||||
for i=1,count do
|
||||
local N="media/SFX/"..list[i]..".ogg"
|
||||
local N='media/SFX/'..list[i]..'.ogg'
|
||||
if love.filesystem.getInfo(N)then
|
||||
Sources[list[i]]={love.audio.newSource(N,'static')}
|
||||
else
|
||||
|
||||
@@ -7,19 +7,19 @@ local themeColor={
|
||||
}
|
||||
|
||||
function THEME.calculate(Y,M,D)
|
||||
if not Y then Y,M,D=os.date("%Y"),os.date("%m"),os.date("%d")end
|
||||
if not Y then Y,M,D=os.date('%Y'),os.date('%m'),os.date('%d')end
|
||||
--Festival calculate within one statement
|
||||
return
|
||||
--Christmas
|
||||
M=="12"and math.abs(D-25)<4 and
|
||||
M=='12'and math.abs(D-25)<4 and
|
||||
'xmas'or
|
||||
|
||||
--Birthday
|
||||
M=="06"and D=="06"and
|
||||
M=='06'and D=='06'and
|
||||
'birth'or
|
||||
|
||||
--Spring festival
|
||||
M<"03"and math.abs((({
|
||||
M<'03'and math.abs((({
|
||||
--Festival days. Jan 26=26, Feb 1=32, etc.
|
||||
24,43,32,22,40,29,49,38,26,45,
|
||||
34,23,41,31,50,39,28,47,36,25,
|
||||
@@ -32,14 +32,14 @@ function THEME.calculate(Y,M,D)
|
||||
'sprfes'or
|
||||
|
||||
--April fool's day
|
||||
M=="04"and D=="01"and
|
||||
M=='04'and D=='01'and
|
||||
'fool'or
|
||||
|
||||
--Z day (Feb./Mar./Apr./May./June. 26)
|
||||
D=="26"and(
|
||||
(M=="01"or M=="02")and'zday1'or
|
||||
(M=="03"or M=="04")and'zday2'or
|
||||
(M=="05"or M=="06")and'zday3'
|
||||
D=='26'and(
|
||||
(M=='01'or M=='02')and'zday1'or
|
||||
(M=='03'or M=='04')and'zday2'or
|
||||
(M=='05'or M=='06')and'zday3'
|
||||
)or
|
||||
|
||||
'classic'
|
||||
@@ -48,7 +48,7 @@ end
|
||||
function THEME.set(theme)
|
||||
if theme=='classic'then
|
||||
BG.setDefault('space')
|
||||
BGM.setDefault("space")
|
||||
BGM.setDefault('space')
|
||||
elseif theme=='xmas'then
|
||||
BG.setDefault('snow')
|
||||
BGM.setDefault('xmas')
|
||||
@@ -58,20 +58,20 @@ function THEME.set(theme)
|
||||
BGM.setDefault('magicblock')
|
||||
elseif theme=='sprfes'then
|
||||
BG.setDefault('firework')
|
||||
BGM.setDefault("spring festival")
|
||||
BGM.setDefault('spring festival')
|
||||
MES.new('info',"★☆新年快乐☆★")
|
||||
elseif theme=='zday1'then
|
||||
BG.setDefault('lanterns')
|
||||
BGM.setDefault("empty")
|
||||
BGM.setDefault('empty')
|
||||
elseif theme=='zday2'then
|
||||
BG.setDefault('lanterns')
|
||||
BGM.setDefault("overzero")
|
||||
BGM.setDefault('overzero')
|
||||
elseif theme=='zday3'then
|
||||
BG.setDefault('lanterns')
|
||||
BGM.setDefault("vacuum")
|
||||
BGM.setDefault('vacuum')
|
||||
elseif theme=='fool'then
|
||||
BG.setDefault('blockrain')
|
||||
BGM.setDefault("how feeling")
|
||||
BGM.setDefault('how feeling')
|
||||
else
|
||||
return
|
||||
end
|
||||
@@ -87,7 +87,7 @@ function THEME.getThemeColor(theme)
|
||||
end
|
||||
|
||||
function THEME.fresh()
|
||||
THEME.set(THEME.calculate(os.date("%Y"),os.date("%m"),os.date("%d")))
|
||||
THEME.set(THEME.calculate(os.date('%Y'),os.date('%m'),os.date('%d')))
|
||||
end
|
||||
|
||||
return THEME
|
||||
@@ -15,9 +15,9 @@ function VOC.init(list)
|
||||
|
||||
local count=#list function VOC.getCount()return count end
|
||||
local function loadVoiceFile(N,vocName)
|
||||
local fileName="media/VOICE/"..SETTING.cv.."/"..vocName..".ogg"
|
||||
local fileName='media/VOICE/'..SETTING.cv..'/'..vocName..'.ogg'
|
||||
if love.filesystem.getInfo(fileName)then
|
||||
bank[vocName]={love.audio.newSource(fileName,"static")}
|
||||
bank[vocName]={love.audio.newSource(fileName,'static')}
|
||||
table.insert(Source[N],vocName)
|
||||
return true
|
||||
end
|
||||
@@ -41,7 +41,7 @@ function VOC.init(list)
|
||||
Source[list[i]]={}
|
||||
|
||||
local n=0
|
||||
repeat n=n+1 until not loadVoiceFile(list[i],list[i].."_"..n)
|
||||
repeat n=n+1 until not loadVoiceFile(list[i],list[i]..'_'..n)
|
||||
|
||||
if n==1 then
|
||||
if not loadVoiceFile(list[i],list[i])then
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
local host=
|
||||
-- "127.0.0.1"
|
||||
-- "192.168.114.102"
|
||||
"krakens.tpddns.cn"
|
||||
-- "game.techmino.org"
|
||||
local port="10026"
|
||||
local path="/tech/socket/v1"
|
||||
-- '127.0.0.1'
|
||||
-- '192.168.114.102'
|
||||
'krakens.tpddns.cn'
|
||||
-- 'game.techmino.org'
|
||||
local port='10026'
|
||||
local path='/tech/socket/v1'
|
||||
|
||||
local debugMode=""--S:send, R:receive, M=mark
|
||||
local debugMode=''--S:send, R:receive, M=mark
|
||||
|
||||
local wsThread=[[
|
||||
-- lua + LÖVE threading websocket client
|
||||
@@ -18,8 +18,8 @@ local triggerCHN,sendCHN,readCHN,threadName=...
|
||||
local CHN_demand,CHN_getCount=triggerCHN.demand,triggerCHN.getCount
|
||||
local CHN_push,CHN_pop=triggerCHN.push,triggerCHN.pop
|
||||
|
||||
local SOCK=require"socket".tcp()
|
||||
local JSON=require"Zframework.json"
|
||||
local SOCK=require'socket'.tcp()
|
||||
local JSON=require'Zframework.json'
|
||||
|
||||
do--Connect
|
||||
local host=CHN_demand(sendCHN)
|
||||
@@ -33,38 +33,38 @@ do--Connect
|
||||
if err then CHN_push(readCHN,err)return end
|
||||
|
||||
--WebSocket handshake
|
||||
if not body then body=""end
|
||||
if not body then body=''end
|
||||
SOCK:send(
|
||||
"GET "..path.." HTTP/1.1\r\n"..
|
||||
"Host: "..host..":"..port.."\r\n"..
|
||||
"Connection: Upgrade\r\n"..
|
||||
"Upgrade: websocket\r\n"..
|
||||
"Content-Type: application/json\r\n"..
|
||||
"Content-Length: "..#body.."\r\n"..
|
||||
"Sec-WebSocket-Version: 13\r\n"..
|
||||
"Sec-WebSocket-Key: osT3F7mvlojIvf3/8uIsJQ==\r\n\r\n"..--secKey
|
||||
'GET '..path..' HTTP/1.1\r\n'..
|
||||
'Host: '..host..':'..port..'\r\n'..
|
||||
'Connection: Upgrade\r\n'..
|
||||
'Upgrade: websocket\r\n'..
|
||||
'Content-Type: application/json\r\n'..
|
||||
'Content-Length: '..#body..'\r\n'..
|
||||
'Sec-WebSocket-Version: 13\r\n'..
|
||||
'Sec-WebSocket-Key: osT3F7mvlojIvf3/8uIsJQ==\r\n\r\n'..--secKey
|
||||
body
|
||||
)
|
||||
|
||||
--First line of HTTP
|
||||
res,err=SOCK:receive("*l")
|
||||
res,err=SOCK:receive('*l')
|
||||
if not res then CHN_push(readCHN,err)return end
|
||||
local code,ctLen
|
||||
code=res:find(" ")
|
||||
code=res:find(' ')
|
||||
code=res:sub(code+1,code+3)
|
||||
|
||||
--Get body length from headers and remove headers
|
||||
repeat
|
||||
res,err=SOCK:receive("*l")
|
||||
res,err=SOCK:receive('*l')
|
||||
if not res then CHN_push(readCHN,err)return end
|
||||
if not ctLen and res:find("length")then
|
||||
ctLen=tonumber(res:match("%d+"))
|
||||
if not ctLen and res:find('length')then
|
||||
ctLen=tonumber(res:match('%d+'))
|
||||
end
|
||||
until res==""
|
||||
until res==''
|
||||
|
||||
--Result
|
||||
if ctLen then
|
||||
if code=="101"then
|
||||
if code=='101'then
|
||||
CHN_push(readCHN,'success')
|
||||
else
|
||||
res,err=SOCK:receive(ctLen)
|
||||
@@ -94,7 +94,7 @@ local _send do
|
||||
local mask_str=char(unpack(mask_key))
|
||||
|
||||
function _send(op,message)
|
||||
]]..(debugMode:find'S'and""or"--")..[[print((">> %s[%d]:%s"):format(threadName,#message,message))
|
||||
]]..(debugMode:find'S'and''or'--')..[[print((">> %s[%d]:%s"):format(threadName,#message,message))
|
||||
--Message type
|
||||
SOCK:send(char(bor(0x80,op)))
|
||||
|
||||
@@ -115,7 +115,7 @@ local _send do
|
||||
end
|
||||
return SOCK:send(char(unpack(msgbyte)))
|
||||
else
|
||||
SOCK:send("\128"..mask_str)
|
||||
SOCK:send('\128'..mask_str)
|
||||
return 0
|
||||
end
|
||||
end
|
||||
@@ -162,7 +162,7 @@ while true do--Running
|
||||
if s then
|
||||
res=s
|
||||
elseif p then--UNF head
|
||||
]]..(debugMode:find'R'and""or"--")..[[print(("<< %s[%d/%d]:%s"):format(threadName,#p,length,#p<50 and p or p:sub(1,50)))
|
||||
]]..(debugMode:find'R'and''or'--')..[[print(("<< %s[%d/%d]:%s"):format(threadName,#p,length,#p<50 and p or p:sub(1,50)))
|
||||
UFF=true
|
||||
sBuffer=sBuffer..p
|
||||
length=length-#p
|
||||
@@ -174,11 +174,11 @@ while true do--Running
|
||||
else
|
||||
local s,e,p=SOCK:receive(length)
|
||||
if s then
|
||||
]]..(debugMode:find'R'and""or"--")..[[print(("<< %s(%d):%s"):format(threadName,length,#s<50 and s or s:sub(1,50)))
|
||||
]]..(debugMode:find'R'and''or'--')..[[print(("<< %s(%d):%s"):format(threadName,length,#s<50 and s or s:sub(1,50)))
|
||||
sBuffer=sBuffer..s
|
||||
length=length-#s
|
||||
elseif p then
|
||||
]]..(debugMode:find'R'and""or"--")..[[print(("<< %s(%d):%s"):format(threadName,length,#p<50 and p or p:sub(1,50)))
|
||||
]]..(debugMode:find'R'and''or'--')..[[print(("<< %s(%d):%s"):format(threadName,length,#p<50 and p or p:sub(1,50)))
|
||||
sBuffer=sBuffer..p
|
||||
length=length-#p
|
||||
end
|
||||
@@ -189,7 +189,7 @@ while true do--Running
|
||||
break
|
||||
end
|
||||
end
|
||||
]]..(debugMode:find'R'and""or"--")..[[print(("<< %s[(%d)]:%s"):format(threadName,#res,#res<800 and res or res:sub(1,150).."\n...\n"..res:sub(-150)))
|
||||
]]..(debugMode:find'R'and''or'--')..[[print(("<< %s[(%d)]:%s"):format(threadName,#res,#res<800 and res or res:sub(1,150).."\n...\n"..res:sub(-150)))
|
||||
|
||||
--React
|
||||
if op==8 then--8=close
|
||||
@@ -203,21 +203,21 @@ while true do--Running
|
||||
elseif op==0 then--0=continue
|
||||
lBuffer=lBuffer..res
|
||||
if fin then
|
||||
]]..(debugMode:find'M'and""or"--")..[[print("FIN=1 (c")
|
||||
]]..(debugMode:find'M'and''or'--')..[[print("FIN=1 (c")
|
||||
CHN_push(readCHN,lBuffer)
|
||||
lBuffer=""
|
||||
else
|
||||
]]..(debugMode:find'M'and""or"--")..[[print("FIN=0 (c")
|
||||
]]..(debugMode:find'M'and''or'--')..[[print("FIN=0 (c")
|
||||
end
|
||||
else
|
||||
CHN_push(readCHN,op)
|
||||
if fin then
|
||||
]]..(debugMode:find'M'and""or"--")..[[print("OP: "..op.."\tFIN=1")
|
||||
]]..(debugMode:find'M'and''or'--')..[[print("OP: "..op.."\tFIN=1")
|
||||
CHN_push(readCHN,res)
|
||||
else
|
||||
]]..(debugMode:find'M'and""or"--")..[[print("OP: "..op.."\tFIN=0")
|
||||
]]..(debugMode:find'M'and''or'--')..[[print("OP: "..op.."\tFIN=0")
|
||||
sBuffer=res
|
||||
]]..(debugMode:find'M'and""or"--")..[[print("START pack: "..res)
|
||||
]]..(debugMode:find'M'and''or'--')..[[print("START pack: "..res)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
216
main.lua
216
main.lua
@@ -24,7 +24,7 @@ local fs=love.filesystem
|
||||
TIME=love.timer.getTime
|
||||
YIELD=coroutine.yield
|
||||
SYSTEM=love.system.getOS()
|
||||
MOBILE=SYSTEM=="Android"or SYSTEM=="iOS"
|
||||
MOBILE=SYSTEM=='Android'or SYSTEM=='iOS'
|
||||
SAVEDIR=fs.getSaveDirectory()
|
||||
|
||||
--Global Vars & Settings
|
||||
@@ -38,14 +38,14 @@ love.keyboard.setTextInput(false)
|
||||
love.mouse.setVisible(false)
|
||||
|
||||
--Load modules
|
||||
require"Zframework"
|
||||
require'Zframework'
|
||||
SCR.setSize(1280,720)--Initialize Screen size
|
||||
|
||||
--Delete all naked files (from too old version)
|
||||
FILE.clear("")
|
||||
FILE.clear('')
|
||||
|
||||
--Create directories
|
||||
for _,v in next,{"conf","record","replay","cache","lib"}do
|
||||
for _,v in next,{'conf','record','replay','cache','lib'}do
|
||||
local info=fs.getInfo(v)
|
||||
if not info then
|
||||
fs.createDirectory(v)
|
||||
@@ -57,30 +57,30 @@ end
|
||||
|
||||
--Load shader files from SOURCE ONLY
|
||||
SHADER={}
|
||||
for _,v in next,fs.getDirectoryItems("parts/shaders")do
|
||||
if fs.getRealDirectory("parts/shaders/"..v)~=SAVEDIR then
|
||||
for _,v in next,fs.getDirectoryItems('parts/shaders')do
|
||||
if fs.getRealDirectory('parts/shaders/'..v)~=SAVEDIR then
|
||||
local name=v:sub(1,-6)
|
||||
SHADER[name]=love.graphics.newShader("parts/shaders/"..name..".glsl")
|
||||
SHADER[name]=love.graphics.newShader('parts/shaders/'..name..'.glsl')
|
||||
end
|
||||
end
|
||||
|
||||
require"parts.list"
|
||||
require"parts.globalTables"
|
||||
require"parts.gametoolfunc"
|
||||
require'parts.list'
|
||||
require'parts.globalTables'
|
||||
require'parts.gametoolfunc'
|
||||
|
||||
FREEROW= require"parts.freeRow"
|
||||
DATA= require"parts.data"
|
||||
FREEROW= require'parts.freeRow'
|
||||
DATA= require'parts.data'
|
||||
|
||||
TEXTURE= require"parts.texture"
|
||||
SKIN= require"parts.skin"
|
||||
USERS= require"parts.users"
|
||||
NET= require"parts.net"
|
||||
VK= require"parts.virtualKey"
|
||||
AIFUNC= require"parts.ai"
|
||||
AIBUILDER= require"parts.AITemplate"
|
||||
PLY= require"parts.player"
|
||||
netPLY= require"parts.netPlayer"
|
||||
MODES= require"parts.modes"
|
||||
TEXTURE= require'parts.texture'
|
||||
SKIN= require'parts.skin'
|
||||
USERS= require'parts.users'
|
||||
NET= require'parts.net'
|
||||
VK= require'parts.virtualKey'
|
||||
AIFUNC= require'parts.ai'
|
||||
AIBUILDER= require'parts.AITemplate'
|
||||
PLY= require'parts.player'
|
||||
netPLY= require'parts.netPlayer'
|
||||
MODES= require'parts.modes'
|
||||
|
||||
--Initialize field[1]
|
||||
FIELD[1]=DATA.newBoard()
|
||||
@@ -96,69 +96,69 @@ if SETTING.fullscreen then love.window.setFullscreen(true)end
|
||||
|
||||
--Initialize image libs
|
||||
IMG.init{
|
||||
lock="mess/lock.png",
|
||||
dialCircle="mess/dialCircle.png",
|
||||
dialNeedle="mess/dialNeedle.png",
|
||||
lifeIcon="mess/life.png",
|
||||
badgeIcon="mess/badge.png",
|
||||
ctrlSpeedLimit="mess/ctrlSpeedLimit.png",
|
||||
speedLimit="mess/speedLimit.png",--Not used, for future C2-mode
|
||||
pay1="mess/pay1.png",
|
||||
pay2="mess/pay2.png",
|
||||
lock='mess/lock.png',
|
||||
dialCircle='mess/dialCircle.png',
|
||||
dialNeedle='mess/dialNeedle.png',
|
||||
lifeIcon='mess/life.png',
|
||||
badgeIcon='mess/badge.png',
|
||||
ctrlSpeedLimit='mess/ctrlSpeedLimit.png',
|
||||
speedLimit='mess/speedLimit.png',--Not used, for future C2-mode
|
||||
pay1='mess/pay1.png',
|
||||
pay2='mess/pay2.png',
|
||||
|
||||
nakiCH="characters/nakiharu.png",
|
||||
miyaCH="characters/miya.png",
|
||||
miyaF1="characters/miya_f1.png",
|
||||
miyaF2="characters/miya_f2.png",
|
||||
miyaF3="characters/miya_f3.png",
|
||||
miyaF4="characters/miya_f4.png",
|
||||
electric="characters/electric.png",
|
||||
hbm="characters/hbm.png",
|
||||
nakiCH='characters/nakiharu.png',
|
||||
miyaCH='characters/miya.png',
|
||||
miyaF1='characters/miya_f1.png',
|
||||
miyaF2='characters/miya_f2.png',
|
||||
miyaF3='characters/miya_f3.png',
|
||||
miyaF4='characters/miya_f4.png',
|
||||
electric='characters/electric.png',
|
||||
hbm='characters/hbm.png',
|
||||
|
||||
lanterns={
|
||||
"lanterns/1.png",
|
||||
"lanterns/2.png",
|
||||
"lanterns/3.png",
|
||||
"lanterns/4.png",
|
||||
"lanterns/5.png",
|
||||
"lanterns/6.png",
|
||||
'lanterns/1.png',
|
||||
'lanterns/2.png',
|
||||
'lanterns/3.png',
|
||||
'lanterns/4.png',
|
||||
'lanterns/5.png',
|
||||
'lanterns/6.png',
|
||||
},
|
||||
}
|
||||
SKIN.init{
|
||||
"crystal_scf",
|
||||
"matte_mrz",
|
||||
"contrast_mrz",
|
||||
"polkadots_scf",
|
||||
"toy_scf",
|
||||
"smooth_mrz",
|
||||
"simple_scf",
|
||||
"glass_scf",
|
||||
"penta_scf",
|
||||
"bubble_scf",
|
||||
"minoes_scf",
|
||||
"pure_mrz",
|
||||
"bright_scf",
|
||||
"glow_mrz",
|
||||
"plastic_mrz",
|
||||
"paper_mrz",
|
||||
"yinyang_scf",
|
||||
"cartooncup_earety",
|
||||
"jelly_miya",
|
||||
"brick_notypey",
|
||||
"gem_notypey",
|
||||
"classic",
|
||||
"ball_shaw",
|
||||
"retro_notypey",
|
||||
"textbone_mrz",
|
||||
"coloredbone_mrz",
|
||||
"wtf",
|
||||
'crystal_scf',
|
||||
'matte_mrz',
|
||||
'contrast_mrz',
|
||||
'polkadots_scf',
|
||||
'toy_scf',
|
||||
'smooth_mrz',
|
||||
'simple_scf',
|
||||
'glass_scf',
|
||||
'penta_scf',
|
||||
'bubble_scf',
|
||||
'minoes_scf',
|
||||
'pure_mrz',
|
||||
'bright_scf',
|
||||
'glow_mrz',
|
||||
'plastic_mrz',
|
||||
'paper_mrz',
|
||||
'yinyang_scf',
|
||||
'cartooncup_earety',
|
||||
'jelly_miya',
|
||||
'brick_notypey',
|
||||
'gem_notypey',
|
||||
'classic',
|
||||
'ball_shaw',
|
||||
'retro_notypey',
|
||||
'textbone_mrz',
|
||||
'coloredbone_mrz',
|
||||
'wtf',
|
||||
}
|
||||
|
||||
--Initialize sound libs
|
||||
SFX.init((function()
|
||||
local L={}
|
||||
for _,v in next,fs.getDirectoryItems("media/SFX")do
|
||||
if fs.getRealDirectory("media/SFX/"..v)~=SAVEDIR then
|
||||
for _,v in next,fs.getDirectoryItems('media/SFX')do
|
||||
if fs.getRealDirectory('media/SFX/'..v)~=SAVEDIR then
|
||||
table.insert(L,v:sub(1,-5))
|
||||
else
|
||||
MES.new('warn',"Dangerous file : %SAVE%/media/SFX/"..v)
|
||||
@@ -168,8 +168,8 @@ SFX.init((function()
|
||||
end)())
|
||||
BGM.init((function()
|
||||
local L={}
|
||||
for _,v in next,fs.getDirectoryItems("media/BGM")do
|
||||
if fs.getRealDirectory("media/BGM/"..v)~=SAVEDIR then
|
||||
for _,v in next,fs.getDirectoryItems('media/BGM')do
|
||||
if fs.getRealDirectory('media/BGM/'..v)~=SAVEDIR then
|
||||
table.insert(L,v:sub(1,-5))
|
||||
else
|
||||
MES.new('warn',"Dangerous file : %SAVE%/media/BGM/"..v)
|
||||
@@ -178,26 +178,26 @@ BGM.init((function()
|
||||
return L
|
||||
end)())
|
||||
VOC.init{
|
||||
"zspin","sspin","lspin","jspin","tspin","ospin","ispin",
|
||||
"single","double","triple","techrash",
|
||||
"mini","b2b","b3b",
|
||||
"perfect_clear","half_clear",
|
||||
"win","lose","bye",
|
||||
"test","happy","doubt","sad","egg",
|
||||
"welcome_voc",
|
||||
'zspin','sspin','lspin','jspin','tspin','ospin','ispin',
|
||||
'single','double','triple','techrash',
|
||||
'mini','b2b','b3b',
|
||||
'perfect_clear','half_clear',
|
||||
'win','lose','bye',
|
||||
'test','happy','doubt','sad','egg',
|
||||
'welcome_voc',
|
||||
}
|
||||
|
||||
--Initialize language lib
|
||||
LANG.init(
|
||||
{
|
||||
require"parts.language.lang_zh",
|
||||
require"parts.language.lang_zh2",
|
||||
require"parts.language.lang_yygq",
|
||||
require"parts.language.lang_en",
|
||||
require"parts.language.lang_fr",
|
||||
require"parts.language.lang_es",
|
||||
require"parts.language.lang_pt",
|
||||
require"parts.language.lang_symbol",
|
||||
require'parts.language.lang_zh',
|
||||
require'parts.language.lang_zh2',
|
||||
require'parts.language.lang_yygq',
|
||||
require'parts.language.lang_en',
|
||||
require'parts.language.lang_fr',
|
||||
require'parts.language.lang_es',
|
||||
require'parts.language.lang_pt',
|
||||
require'parts.language.lang_symbol',
|
||||
--1. Add language file to LANG folder;
|
||||
--2. Require it;
|
||||
--3. Add a button in parts/scenes/setting_lang.lua;
|
||||
@@ -213,26 +213,26 @@ LANG.init(
|
||||
}
|
||||
)
|
||||
--Load background files from SOURCE ONLY
|
||||
for _,v in next,fs.getDirectoryItems("parts/backgrounds")do
|
||||
if fs.getRealDirectory("parts/backgrounds/"..v)~=SAVEDIR then
|
||||
if v:sub(-3)=="lua"then
|
||||
for _,v in next,fs.getDirectoryItems('parts/backgrounds')do
|
||||
if fs.getRealDirectory('parts/backgrounds/'..v)~=SAVEDIR then
|
||||
if v:sub(-3)=='lua'then
|
||||
local name=v:sub(1,-5)
|
||||
BG.add(name,require("parts.backgrounds."..name))
|
||||
BG.add(name,require('parts.backgrounds.'..name))
|
||||
end
|
||||
end
|
||||
end
|
||||
--Load scene files from SOURCE ONLY
|
||||
for _,v in next,fs.getDirectoryItems("parts/scenes")do
|
||||
if fs.getRealDirectory("parts/scenes/"..v)~=SAVEDIR then
|
||||
for _,v in next,fs.getDirectoryItems('parts/scenes')do
|
||||
if fs.getRealDirectory('parts/scenes/'..v)~=SAVEDIR then
|
||||
local sceneName=v:sub(1,-5)
|
||||
SCN.add(sceneName,require("parts.scenes."..sceneName))
|
||||
SCN.add(sceneName,require('parts.scenes.'..sceneName))
|
||||
LANG.addScene(sceneName)
|
||||
end
|
||||
end
|
||||
--Load mode files
|
||||
for i=1,#MODES do
|
||||
local m=MODES[i]--Mode template
|
||||
local M=require("parts.modes."..m.name)--Mode file
|
||||
local M=require('parts.modes.'..m.name)--Mode file
|
||||
for k,v in next,m do M[k]=v end
|
||||
MODES[m.name],MODES[i]=M
|
||||
end
|
||||
@@ -246,7 +246,7 @@ do
|
||||
needSave=true
|
||||
end
|
||||
if STAT.version<1302 then
|
||||
FILE.clear_s("")
|
||||
FILE.clear_s('')
|
||||
end
|
||||
if STAT.version<1405 then
|
||||
fs.remove('conf/user')
|
||||
@@ -282,14 +282,14 @@ do
|
||||
RANKS[v]=RANKS[k]
|
||||
RANKS[k]=nil
|
||||
end
|
||||
k="record/"..k
|
||||
if fs.getInfo(k..".dat")then
|
||||
fs.write("record/"..v..".rec",fs.read(k..".dat"))
|
||||
fs.remove(k..".dat")
|
||||
k='record/'..k
|
||||
if fs.getInfo(k..'.dat')then
|
||||
fs.write('record/'..v..'.rec',fs.read(k..'.dat'))
|
||||
fs.remove(k..'.dat')
|
||||
end
|
||||
if fs.getInfo(k..".rec")then
|
||||
fs.write("record/"..v..".rec",fs.read(k..".rec"))
|
||||
fs.remove(k..".rec")
|
||||
if fs.getInfo(k..'.rec')then
|
||||
fs.write('record/'..v..'.rec',fs.read(k..'.rec'))
|
||||
fs.remove(k..'.rec')
|
||||
end
|
||||
end
|
||||
if not RANKS.sprint_10l then
|
||||
@@ -309,7 +309,7 @@ end
|
||||
LANG.set(SETTING.lang)
|
||||
VK.setShape(SETTING.VKSkin)
|
||||
--Load replays
|
||||
for _,fileName in next,fs.getDirectoryItems("replay")do
|
||||
for _,fileName in next,fs.getDirectoryItems('replay')do
|
||||
if fileName:sub(12,12):match("[a-zA-Z]")then
|
||||
local date,mode,version,player,seed,setting,mod
|
||||
local fileData=fs.read('replay/'..fileName)
|
||||
|
||||
Reference in New Issue
Block a user