整理代码
规范更多全局变量名 语音包/音效包列表声明放到main开头
This commit is contained in:
@@ -258,7 +258,8 @@ function love.keypressed(key,_,isRep)
|
|||||||
devMode=1
|
devMode=1
|
||||||
MES.new('info',"DEBUG ON",.2)
|
MES.new('info',"DEBUG ON",.2)
|
||||||
elseif key=="f11"then
|
elseif key=="f11"then
|
||||||
switchFullscreen()
|
SETTING.fullscreen=not SETTING.fullscreen
|
||||||
|
applyFullscreen()
|
||||||
saveSettings()
|
saveSettings()
|
||||||
elseif not SCN.swapping then
|
elseif not SCN.swapping then
|
||||||
if SCN.keyDown then
|
if SCN.keyDown then
|
||||||
@@ -702,7 +703,7 @@ local Z={}
|
|||||||
|
|
||||||
function Z.setIfPowerInfo(func)showPowerInfo=func end
|
function Z.setIfPowerInfo(func)showPowerInfo=func end
|
||||||
|
|
||||||
--Warning: color and line width is uncertain value, set it in the function.
|
--[Warning] Color and line width is uncertain value, set it in the function.
|
||||||
function Z.setCursor(func)drawCursor=func end
|
function Z.setCursor(func)drawCursor=func end
|
||||||
|
|
||||||
--Change F1~F7 events of devmode (F8 mode)
|
--Change F1~F7 events of devmode (F8 mode)
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ local readThread=coroutine.wrap(function()
|
|||||||
if op==8 then--8=close
|
if op==8 then--8=close
|
||||||
CHN_push(readCHN,8)--close
|
CHN_push(readCHN,8)--close
|
||||||
if type(res)=='string'then
|
if type(res)=='string'then
|
||||||
CHN_push(readCHN,res:sub(3))--Warning: 2 bytes close code at start so :sub(3)
|
CHN_push(readCHN,res:sub(3))--[Warning] 2 bytes close code at start so :sub(3)
|
||||||
else
|
else
|
||||||
CHN_push(readCHN,"WS closed")
|
CHN_push(readCHN,"WS closed")
|
||||||
end
|
end
|
||||||
|
|||||||
8
main.lua
8
main.lua
@@ -28,6 +28,8 @@ MOBILE=SYSTEM=='Android'or SYSTEM=='iOS'
|
|||||||
SAVEDIR=fs.getSaveDirectory()
|
SAVEDIR=fs.getSaveDirectory()
|
||||||
|
|
||||||
--Global Vars & Settings
|
--Global Vars & Settings
|
||||||
|
SFXPACKS={'chiptune'}
|
||||||
|
VOCPACKS={'miya','mono','xiaoya','miku'}
|
||||||
FIRSTLAUNCH=false
|
FIRSTLAUNCH=false
|
||||||
DAILYLAUNCH=false
|
DAILYLAUNCH=false
|
||||||
|
|
||||||
@@ -93,7 +95,7 @@ VK= require'parts.virtualKey'
|
|||||||
BOT= require'parts.bot'
|
BOT= require'parts.bot'
|
||||||
RSlist= require'parts.RSlist'DSCP=RSlist.TRS.centerPos
|
RSlist= require'parts.RSlist'DSCP=RSlist.TRS.centerPos
|
||||||
PLY= require'parts.player'
|
PLY= require'parts.player'
|
||||||
netPLY= require'parts.netPlayer'
|
NETPLY= require'parts.netPlayer'
|
||||||
MODES= require'parts.modes'
|
MODES= require'parts.modes'
|
||||||
|
|
||||||
--Init Zframework
|
--Init Zframework
|
||||||
@@ -282,7 +284,7 @@ SKIN.init{
|
|||||||
}
|
}
|
||||||
|
|
||||||
--Initialize sound libs
|
--Initialize sound libs
|
||||||
SFX.init((function()
|
SFX.init((function()--[Warning] Not loading files here, just get the list of sound needed
|
||||||
local L={}
|
local L={}
|
||||||
for _,v in next,fs.getDirectoryItems('media/effect/chiptune/')do
|
for _,v in next,fs.getDirectoryItems('media/effect/chiptune/')do
|
||||||
if isSafeFile('media/effect/chiptune/'..v,"Dangerous file : %SAVE%/media/effect/chiptune/"..v)then
|
if isSafeFile('media/effect/chiptune/'..v,"Dangerous file : %SAVE%/media/effect/chiptune/"..v)then
|
||||||
@@ -503,7 +505,7 @@ if FIRSTLAUNCH and MOBILE then
|
|||||||
end
|
end
|
||||||
|
|
||||||
--Apply system setting
|
--Apply system setting
|
||||||
applySettings()
|
applyAllSettings()
|
||||||
|
|
||||||
--Load replays
|
--Load replays
|
||||||
for _,fileName in next,fs.getDirectoryItems('replay')do
|
for _,fileName in next,fs.getDirectoryItems('replay')do
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ do
|
|||||||
SFX.play('rotatekick',nil,P:getCenterX()*.15)
|
SFX.play('rotatekick',nil,P:getCenterX()*.15)
|
||||||
end
|
end
|
||||||
|
|
||||||
--[Warning] field spinSeq is a dirty data, TRS put this var into the block.
|
--[Warning] Field spinSeq is a dirty data, TRS put this var into the block.
|
||||||
C.spinSeq=(C.spinSeq or 0)%100*10+d
|
C.spinSeq=(C.spinSeq or 0)%100*10+d
|
||||||
if C.spinSeq<100 then
|
if C.spinSeq<100 then
|
||||||
return end
|
return end
|
||||||
|
|||||||
@@ -13,6 +13,13 @@ local PLAYERS=PLAYERS
|
|||||||
|
|
||||||
|
|
||||||
--System
|
--System
|
||||||
|
function isSafeFile(file,mes)
|
||||||
|
if love.filesystem.getRealDirectory(file)~=SAVEDIR then
|
||||||
|
return true
|
||||||
|
elseif mes then
|
||||||
|
MES.new('warn',mes)
|
||||||
|
end
|
||||||
|
end
|
||||||
function saveStats()
|
function saveStats()
|
||||||
return FILE.save(STAT,'conf/data')
|
return FILE.save(STAT,'conf/data')
|
||||||
end
|
end
|
||||||
@@ -31,28 +38,15 @@ function applyLanguage()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function applySettings()
|
function applyCursor()
|
||||||
love.window.setFullscreen(SETTING.fullscreen)
|
|
||||||
love.audio.setVolume(SETTING.mainVol)
|
|
||||||
love.mouse.setVisible(SETTING.sysCursor)
|
|
||||||
VK.setShape(SETTING.VKSkin)
|
|
||||||
BGM.setVol(SETTING.bgm)
|
|
||||||
SFX.setVol(SETTING.sfx)
|
|
||||||
VOC.setVol(SETTING.voc)
|
|
||||||
applyBlockSatur(SETTING.blockSatur)
|
|
||||||
applyFieldSatur(SETTING.fieldSatur)
|
|
||||||
applyLanguage()
|
|
||||||
end
|
|
||||||
function switchCursor()
|
|
||||||
SETTING.sysCursor=not SETTING.sysCursor
|
|
||||||
love.mouse.setVisible(SETTING.sysCursor)
|
love.mouse.setVisible(SETTING.sysCursor)
|
||||||
end
|
end
|
||||||
function switchFullscreen()
|
function applyFullscreen()
|
||||||
SETTING.fullscreen=not SETTING.fullscreen
|
SETTING.fullscreen=not SETTING.fullscreen
|
||||||
love.window.setFullscreen(SETTING.fullscreen)
|
love.window.setFullscreen(SETTING.fullscreen)
|
||||||
love.resize(gc.getWidth(),gc.getHeight())
|
love.resize(gc.getWidth(),gc.getHeight())
|
||||||
end
|
end
|
||||||
do--function applyXxxSatur(mode)
|
do--function applyBlockSatur,applyFieldSatur(mode)
|
||||||
local saturateValues={
|
local saturateValues={
|
||||||
normal={0,1},
|
normal={0,1},
|
||||||
soft={.2,.7},
|
soft={.2,.7},
|
||||||
@@ -71,12 +65,17 @@ do--function applyXxxSatur(mode)
|
|||||||
SHADER.fieldSatur:send('k',m[2])
|
SHADER.fieldSatur:send('k',m[2])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function isSafeFile(file,mes)
|
function applyAllSettings()
|
||||||
if love.filesystem.getRealDirectory(file)~=SAVEDIR then
|
love.window.setFullscreen(SETTING.fullscreen)
|
||||||
return true
|
love.audio.setVolume(SETTING.mainVol)
|
||||||
elseif mes then
|
VK.setShape(SETTING.VKSkin)
|
||||||
MES.new('warn',mes)
|
BGM.setVol(SETTING.bgm)
|
||||||
end
|
SFX.setVol(SETTING.sfx)
|
||||||
|
VOC.setVol(SETTING.voc)
|
||||||
|
applyBlockSatur(SETTING.blockSatur)
|
||||||
|
applyFieldSatur(SETTING.fieldSatur)
|
||||||
|
applyLanguage()
|
||||||
|
applyCursor()
|
||||||
end
|
end
|
||||||
|
|
||||||
--Royale mode
|
--Royale mode
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
--Static data tables
|
--Static data tables
|
||||||
SFXPACKS={'chiptune'}
|
|
||||||
VOCPACKS={'miya','mono','xiaoya','miku'}
|
|
||||||
BLOCK_NAMES={
|
BLOCK_NAMES={
|
||||||
'Z','S','J','L','T','O','I',
|
'Z','S','J','L','T','O','I',
|
||||||
'Z5','S5','P','Q','F','E',
|
'Z5','S5','P','Q','F','E',
|
||||||
@@ -503,7 +501,7 @@ do--Mod data
|
|||||||
M.color=COLOR[M.color]
|
M.color=COLOR[M.color]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
do--Game tables
|
do--Game data tables
|
||||||
PLAYERS={}--Players data
|
PLAYERS={}--Players data
|
||||||
PLY_ALIVE={}
|
PLY_ALIVE={}
|
||||||
FIELD={}--Field(s) for custom game
|
FIELD={}--Field(s) for custom game
|
||||||
|
|||||||
@@ -19,13 +19,13 @@ return{
|
|||||||
GAME.modeEnv.allowMod=false
|
GAME.modeEnv.allowMod=false
|
||||||
GAME.modeEnv.task=marginTask
|
GAME.modeEnv.task=marginTask
|
||||||
|
|
||||||
local L=TABLE.copy(netPLY.list)
|
local L=TABLE.copy(NETPLY.list)
|
||||||
local N=1
|
local N=1
|
||||||
for i,p in next,L do
|
for i,p in next,L do
|
||||||
if p.uid==USER.uid then
|
if p.uid==USER.uid then
|
||||||
if p.connected then
|
if p.connected then
|
||||||
PLY.newPlayer(1)
|
PLY.newPlayer(1)
|
||||||
PLAYERS[1].sid=netPLY.getSID(USER.uid)
|
PLAYERS[1].sid=NETPLY.getSID(USER.uid)
|
||||||
N=2
|
N=2
|
||||||
end
|
end
|
||||||
table.remove(L,i)
|
table.remove(L,i)
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ function NET.loadSavedData(sections)
|
|||||||
|
|
||||||
TABLE.cover(NET.cloudData.SETTING,SETTING)
|
TABLE.cover(NET.cloudData.SETTING,SETTING)
|
||||||
success=success and saveSettings()
|
success=success and saveSettings()
|
||||||
applySettings()
|
applyAllSettings()
|
||||||
|
|
||||||
TABLE.cover(NET.cloudData.keyMap,KEY_MAP)
|
TABLE.cover(NET.cloudData.keyMap,KEY_MAP)
|
||||||
success=success and FILE.save(KEY_MAP,'conf/key')
|
success=success and FILE.save(KEY_MAP,'conf/key')
|
||||||
@@ -524,10 +524,10 @@ function NET.updateWS_play()
|
|||||||
elseif res.action==2 then--Player join
|
elseif res.action==2 then--Player join
|
||||||
if res.type=='Self'then
|
if res.type=='Self'then
|
||||||
--Enter new room
|
--Enter new room
|
||||||
netPLY.clear()
|
NETPLY.clear()
|
||||||
if d.players then
|
if d.players then
|
||||||
for _,p in next,d.players do
|
for _,p in next,d.players do
|
||||||
netPLY.add{
|
NETPLY.add{
|
||||||
uid=p.uid,
|
uid=p.uid,
|
||||||
username=p.username,
|
username=p.username,
|
||||||
sid=p.sid,
|
sid=p.sid,
|
||||||
@@ -555,7 +555,7 @@ function NET.updateWS_play()
|
|||||||
loadGame('netBattle',true,true)
|
loadGame('netBattle',true,true)
|
||||||
else
|
else
|
||||||
--Load other players
|
--Load other players
|
||||||
netPLY.add{
|
NETPLY.add{
|
||||||
uid=d.uid,
|
uid=d.uid,
|
||||||
username=d.username,
|
username=d.username,
|
||||||
sid=d.sid,
|
sid=d.sid,
|
||||||
@@ -578,7 +578,7 @@ function NET.updateWS_play()
|
|||||||
end
|
end
|
||||||
SCN.back()
|
SCN.back()
|
||||||
else
|
else
|
||||||
netPLY.remove(d.sid)
|
NETPLY.remove(d.sid)
|
||||||
_removePlayer(PLAYERS,d.sid)
|
_removePlayer(PLAYERS,d.sid)
|
||||||
_removePlayer(PLY_ALIVE,d.sid)
|
_removePlayer(PLY_ALIVE,d.sid)
|
||||||
if SCN.cur=='net_game'then
|
if SCN.cur=='net_game'then
|
||||||
@@ -590,9 +590,9 @@ function NET.updateWS_play()
|
|||||||
SCN.socketRead('talk',d)
|
SCN.socketRead('talk',d)
|
||||||
end
|
end
|
||||||
elseif res.action==5 then--Player change settings
|
elseif res.action==5 then--Player change settings
|
||||||
netPLY.setConf(d.uid,d.config)
|
NETPLY.setConf(d.uid,d.config)
|
||||||
elseif res.action==6 then--Player change join mode
|
elseif res.action==6 then--Player change join mode
|
||||||
netPLY.setJoinMode(d.uid,d.mode)
|
NETPLY.setJoinMode(d.uid,d.mode)
|
||||||
elseif res.action==7 then--All Ready
|
elseif res.action==7 then--All Ready
|
||||||
SFX.play('reach',.6)
|
SFX.play('reach',.6)
|
||||||
NET.roomReadyState='allReady'
|
NET.roomReadyState='allReady'
|
||||||
@@ -608,15 +608,15 @@ function NET.updateWS_play()
|
|||||||
for _,p in next,d.result do
|
for _,p in next,d.result do
|
||||||
for _,P in next,PLAYERS do
|
for _,P in next,PLAYERS do
|
||||||
if P.uid==p.uid then
|
if P.uid==p.uid then
|
||||||
netPLY.setStat(p.uid,P.stat)
|
NETPLY.setStat(p.uid,P.stat)
|
||||||
netPLY.setPlace(p.uid,p.place)
|
NETPLY.setPlace(p.uid,p.place)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
netPLY.resetState()
|
NETPLY.resetState()
|
||||||
netPLY.freshPos()
|
NETPLY.freshPos()
|
||||||
NET.roomState.start=false
|
NET.roomState.start=false
|
||||||
if NET.spectate then
|
if NET.spectate then
|
||||||
NET.signal_setMode(2)
|
NET.signal_setMode(2)
|
||||||
@@ -657,10 +657,10 @@ function NET.updateWS_stream()
|
|||||||
if res.type=='Self'then
|
if res.type=='Self'then
|
||||||
NET.seed=d.seed
|
NET.seed=d.seed
|
||||||
NET.spectate=d.spectate
|
NET.spectate=d.spectate
|
||||||
netPLY.setConnect(d.uid)
|
NETPLY.setConnect(d.uid)
|
||||||
for _,p in next,d.connected do
|
for _,p in next,d.connected do
|
||||||
if not p.spectate then
|
if not p.spectate then
|
||||||
netPLY.setConnect(p.uid)
|
NETPLY.setConnect(p.uid)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if d.spectate then
|
if d.spectate then
|
||||||
@@ -677,9 +677,9 @@ function NET.updateWS_stream()
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
if d.spectate then
|
if d.spectate then
|
||||||
netPLY.setJoinMode(d.uid,2)
|
NETPLY.setJoinMode(d.uid,2)
|
||||||
else
|
else
|
||||||
netPLY.setConnect(d.uid)
|
NETPLY.setConnect(d.uid)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif res.action==3 then--Player leave
|
elseif res.action==3 then--Player leave
|
||||||
|
|||||||
@@ -65,13 +65,13 @@ local posLists={
|
|||||||
local posList
|
local posList
|
||||||
local function _placeSort(a,b)return a.place<b.place end
|
local function _placeSort(a,b)return a.place<b.place end
|
||||||
|
|
||||||
local netPLY
|
local NETPLY
|
||||||
|
|
||||||
local nullIndex={
|
local nullIndex={
|
||||||
__index=function(self,k)
|
__index=function(self,k)
|
||||||
MES.traceback()
|
MES.traceback()
|
||||||
MES.new('error',"User not loaded: "..k)
|
MES.new('error',"User not loaded: "..k)
|
||||||
netPLY.add{
|
NETPLY.add{
|
||||||
uid=k,
|
uid=k,
|
||||||
username="Stacker",
|
username="Stacker",
|
||||||
sid=-1,
|
sid=-1,
|
||||||
@@ -96,17 +96,17 @@ local function _freshPos()
|
|||||||
posList=posLists[5]
|
posList=posLists[5]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
netPLY={
|
NETPLY={
|
||||||
list=PLYlist,
|
list=PLYlist,
|
||||||
map=PLYmap,
|
map=PLYmap,
|
||||||
freshPos=_freshPos,
|
freshPos=_freshPos,
|
||||||
}
|
}
|
||||||
|
|
||||||
function netPLY.clear()
|
function NETPLY.clear()
|
||||||
TABLE.cut(PLYlist)
|
TABLE.cut(PLYlist)
|
||||||
TABLE.clear(PLYmap)
|
TABLE.clear(PLYmap)
|
||||||
end
|
end
|
||||||
function netPLY.add(d)
|
function NETPLY.add(d)
|
||||||
local p={
|
local p={
|
||||||
uid=d.uid,
|
uid=d.uid,
|
||||||
username=d.username,
|
username=d.username,
|
||||||
@@ -124,7 +124,7 @@ function netPLY.add(d)
|
|||||||
PLYmap[p.uid]=p
|
PLYmap[p.uid]=p
|
||||||
_freshPos()
|
_freshPos()
|
||||||
end
|
end
|
||||||
function netPLY.remove(sid)
|
function NETPLY.remove(sid)
|
||||||
for i=1,#PLYlist do
|
for i=1,#PLYlist do
|
||||||
if PLYlist[i].sid==sid then
|
if PLYlist[i].sid==sid then
|
||||||
PLYmap[PLYlist[i].uid]=nil
|
PLYmap[PLYlist[i].uid]=nil
|
||||||
@@ -135,14 +135,14 @@ function netPLY.remove(sid)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function netPLY.getCount()return #PLYlist end
|
function NETPLY.getCount()return #PLYlist end
|
||||||
function netPLY.getSID(uid)return PLYmap[uid].sid end
|
function NETPLY.getSID(uid)return PLYmap[uid].sid end
|
||||||
function netPLY.getSelfJoinMode()return PLYmap[USER.uid].mode end
|
function NETPLY.getSelfJoinMode()return PLYmap[USER.uid].mode end
|
||||||
function netPLY.getSelfReady()return PLYmap[USER.uid].mode>0 end
|
function NETPLY.getSelfReady()return PLYmap[USER.uid].mode>0 end
|
||||||
|
|
||||||
function netPLY.setPlayerObj(ply,p)ply.p=p end
|
function NETPLY.setPlayerObj(ply,p)ply.p=p end
|
||||||
function netPLY.setConf(uid,config)PLYmap[uid].config=config end
|
function NETPLY.setConf(uid,config)PLYmap[uid].config=config end
|
||||||
function netPLY.setJoinMode(uid,ready)
|
function NETPLY.setJoinMode(uid,ready)
|
||||||
for _,p in next,PLYlist do
|
for _,p in next,PLYlist do
|
||||||
if p.uid==uid then
|
if p.uid==uid then
|
||||||
if p.mode~=ready then
|
if p.mode~=ready then
|
||||||
@@ -164,16 +164,16 @@ function netPLY.setJoinMode(uid,ready)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function netPLY.setConnect(uid)PLYmap[uid].connected=true end
|
function NETPLY.setConnect(uid)PLYmap[uid].connected=true end
|
||||||
function netPLY.setPlace(uid,place)PLYmap[uid].place=place end
|
function NETPLY.setPlace(uid,place)PLYmap[uid].place=place end
|
||||||
function netPLY.setStat(uid,S)
|
function NETPLY.setStat(uid,S)
|
||||||
PLYmap[uid].stat={
|
PLYmap[uid].stat={
|
||||||
lpm=("%.1f %s"):format(S.row/S.time*60,text.radarData[5]),
|
lpm=("%.1f %s"):format(S.row/S.time*60,text.radarData[5]),
|
||||||
apm=("%.1f %s"):format(S.atk/S.time*60,text.radarData[3]),
|
apm=("%.1f %s"):format(S.atk/S.time*60,text.radarData[3]),
|
||||||
adpm=("%.1f %s"):format((S.atk+S.dig)/S.time*60,text.radarData[2]),
|
adpm=("%.1f %s"):format((S.atk+S.dig)/S.time*60,text.radarData[2]),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
function netPLY.resetState()
|
function NETPLY.resetState()
|
||||||
for i=1,#PLYlist do
|
for i=1,#PLYlist do
|
||||||
PLYlist[i].mode=0
|
PLYlist[i].mode=0
|
||||||
PLYlist[i].connected=false
|
PLYlist[i].connected=false
|
||||||
@@ -181,7 +181,7 @@ function netPLY.resetState()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local selP,mouseX,mouseY
|
local selP,mouseX,mouseY
|
||||||
function netPLY.mouseMove(x,y)
|
function NETPLY.mouseMove(x,y)
|
||||||
selP=nil
|
selP=nil
|
||||||
for i=1,#PLYlist do
|
for i=1,#PLYlist do
|
||||||
local p=PLYlist[i]
|
local p=PLYlist[i]
|
||||||
@@ -193,7 +193,7 @@ function netPLY.mouseMove(x,y)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function netPLY.update()
|
function NETPLY.update()
|
||||||
for i=1,#PLYlist do
|
for i=1,#PLYlist do
|
||||||
local p=PLYlist[i]
|
local p=PLYlist[i]
|
||||||
local t=posList[i]
|
local t=posList[i]
|
||||||
@@ -208,7 +208,7 @@ local stencilW,stencilH
|
|||||||
local function _playerFrameStencil()
|
local function _playerFrameStencil()
|
||||||
gc_rectangle('fill',0,0,stencilW,stencilH)
|
gc_rectangle('fill',0,0,stencilW,stencilH)
|
||||||
end
|
end
|
||||||
function netPLY.draw()
|
function NETPLY.draw()
|
||||||
for i=1,#PLYlist do
|
for i=1,#PLYlist do
|
||||||
local p=PLYlist[i]
|
local p=PLYlist[i]
|
||||||
gc_translate(p.x,p.y)
|
gc_translate(p.x,p.y)
|
||||||
@@ -290,4 +290,4 @@ function netPLY.draw()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return netPLY
|
return NETPLY
|
||||||
|
|||||||
@@ -461,7 +461,7 @@ function PLY.newRemotePlayer(id,mini,ply)
|
|||||||
P.draw=ply_draw.norm
|
P.draw=ply_draw.norm
|
||||||
P:startStreaming()
|
P:startStreaming()
|
||||||
|
|
||||||
netPLY.setPlayerObj(ply,P)
|
NETPLY.setPlayerObj(ply,P)
|
||||||
P.uid=ply.uid
|
P.uid=ply.uid
|
||||||
P.username=ply.username
|
P.username=ply.username
|
||||||
P.sid=ply.sid
|
P.sid=ply.sid
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ local setFont,mStr=FONT.set,GC.mStr
|
|||||||
|
|
||||||
local ins=table.insert
|
local ins=table.insert
|
||||||
|
|
||||||
local SCR,VK,NET,netPLY=SCR,VK,NET,netPLY
|
local SCR,VK,NET,NETPLY=SCR,VK,NET,NETPLY
|
||||||
local PLAYERS,GAME=PLAYERS,GAME
|
local PLAYERS,GAME=PLAYERS,GAME
|
||||||
|
|
||||||
local textBox=WIDGET.newTextBox{name="texts",x=340,y=80,w=600,h=560}
|
local textBox=WIDGET.newTextBox{name="texts",x=340,y=80,w=600,h=560}
|
||||||
@@ -89,9 +89,9 @@ function scene.sceneBack()
|
|||||||
end
|
end
|
||||||
|
|
||||||
scene.mouseDown=NULL
|
scene.mouseDown=NULL
|
||||||
function scene.mouseMove(x,y)netPLY.mouseMove(x,y)end
|
function scene.mouseMove(x,y)NETPLY.mouseMove(x,y)end
|
||||||
function scene.touchDown(x,y)
|
function scene.touchDown(x,y)
|
||||||
if not playing then netPLY.mouseMove(x,y)return end
|
if not playing then NETPLY.mouseMove(x,y)return end
|
||||||
if noTouch then return end
|
if noTouch then return end
|
||||||
|
|
||||||
local t=VK.on(x,y)
|
local t=VK.on(x,y)
|
||||||
@@ -158,7 +158,7 @@ function scene.keyDown(key,isRep)
|
|||||||
end
|
end
|
||||||
elseif not _hideReadyUI()then
|
elseif not _hideReadyUI()then
|
||||||
if key=="space"then
|
if key=="space"then
|
||||||
if netPLY.getSelfJoinMode()==0 then
|
if NETPLY.getSelfJoinMode()==0 then
|
||||||
(kb.isDown("lctrl","rctrl","lalt","ralt")and _setSpectate or _setReady)()
|
(kb.isDown("lctrl","rctrl","lalt","ralt")and _setSpectate or _setReady)()
|
||||||
else
|
else
|
||||||
_setCancel()
|
_setCancel()
|
||||||
@@ -224,7 +224,7 @@ function scene.socketRead(cmd,d)
|
|||||||
lastUpstreamTime=0
|
lastUpstreamTime=0
|
||||||
upstreamProgress=1
|
upstreamProgress=1
|
||||||
resetGameData('n',NET.seed)
|
resetGameData('n',NET.seed)
|
||||||
netPLY.mouseMove(0,0)
|
NETPLY.mouseMove(0,0)
|
||||||
else
|
else
|
||||||
MES.new('warn',"Redundant [Go]")
|
MES.new('warn',"Redundant [Go]")
|
||||||
end
|
end
|
||||||
@@ -269,7 +269,7 @@ function scene.update(dt)
|
|||||||
lastUpstreamTime=PLAYERS[1].alive and P1.frameRun or 1e99
|
lastUpstreamTime=PLAYERS[1].alive and P1.frameRun or 1e99
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
netPLY.update()
|
NETPLY.update()
|
||||||
end
|
end
|
||||||
if newMessageTimer>0 then
|
if newMessageTimer>0 then
|
||||||
newMessageTimer=newMessageTimer-1
|
newMessageTimer=newMessageTimer-1
|
||||||
@@ -296,7 +296,7 @@ function scene.draw()
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
--Users
|
--Users
|
||||||
netPLY.draw()
|
NETPLY.draw()
|
||||||
|
|
||||||
--Ready & Set mark
|
--Ready & Set mark
|
||||||
setFont(50)
|
setFont(50)
|
||||||
@@ -316,7 +316,7 @@ function scene.draw()
|
|||||||
setFont(25)
|
setFont(25)
|
||||||
gc_printf(NET.roomState.roomInfo.name,0,685,1270,'right')
|
gc_printf(NET.roomState.roomInfo.name,0,685,1270,'right')
|
||||||
setFont(40)
|
setFont(40)
|
||||||
gc_print(netPLY.getCount().."/"..NET.roomState.capacity,70,655)
|
gc_print(NETPLY.getCount().."/"..NET.roomState.capacity,70,655)
|
||||||
if NET.roomState.private then
|
if NET.roomState.private then
|
||||||
gc_draw(IMG.lock,30,668)
|
gc_draw(IMG.lock,30,668)
|
||||||
end
|
end
|
||||||
@@ -338,8 +338,8 @@ function scene.draw()
|
|||||||
gc_print("M",430,10)
|
gc_print("M",430,10)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local function _hideF_ingame()return _hideReadyUI()or netPLY.getSelfReady()end
|
local function _hideF_ingame()return _hideReadyUI()or NETPLY.getSelfReady()end
|
||||||
local function _hideF_ingame2()return _hideReadyUI()or not netPLY.getSelfReady()end
|
local function _hideF_ingame2()return _hideReadyUI()or not NETPLY.getSelfReady()end
|
||||||
scene.widgetList={
|
scene.widgetList={
|
||||||
textBox,
|
textBox,
|
||||||
inputBox,
|
inputBox,
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ scene.widgetList={
|
|||||||
local D=_parseCB()
|
local D=_parseCB()
|
||||||
if D then
|
if D then
|
||||||
TABLE.update(D,SETTING)
|
TABLE.update(D,SETTING)
|
||||||
applySettings()
|
applyAllSettings()
|
||||||
saveSettings()
|
saveSettings()
|
||||||
MES.new('check',text.importSuccess)
|
MES.new('check',text.importSuccess)
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ scene.widgetList={
|
|||||||
WIDGET.newSlider{name="reTime", x=330, y=320, w=300,lim=180,unit=10,disp=SETval('reTime'), code=SETsto('reTime'),show=function(S)return(.5+S.disp()*.25).."s"end},
|
WIDGET.newSlider{name="reTime", x=330, y=320, w=300,lim=180,unit=10,disp=SETval('reTime'), code=SETsto('reTime'),show=function(S)return(.5+S.disp()*.25).."s"end},
|
||||||
WIDGET.newSelector{name="RS", x=300, y=420, w=300,color='S', disp=SETval('RS'), code=SETsto('RS'),list={'TRS','SRS','SRS_plus','SRS_X','BiRS','ARS_Z','ASC','ASC_plus','C2','C2_sym','Classic','Classic_plus','None','None_plus'}},
|
WIDGET.newSelector{name="RS", x=300, y=420, w=300,color='S', disp=SETval('RS'), code=SETsto('RS'),list={'TRS','SRS','SRS_plus','SRS_X','BiRS','ARS_Z','ASC','ASC_plus','C2','C2_sym','Classic','Classic_plus','None','None_plus'}},
|
||||||
WIDGET.newSelector{name="menuPos", x=980, y=320, w=300,color='O', disp=SETval('menuPos'), code=SETsto('menuPos'),list={'left','middle','right'}},
|
WIDGET.newSelector{name="menuPos", x=980, y=320, w=300,color='O', disp=SETval('menuPos'), code=SETsto('menuPos'),list={'left','middle','right'}},
|
||||||
WIDGET.newSwitch{name="sysCursor" ,x=1060, y=390, lim=580, disp=SETval('sysCursor'),code=switchCursor},
|
WIDGET.newSwitch{name="sysCursor" ,x=1060, y=390, lim=580, disp=SETval('sysCursor'),code=function()SETTING.sysCursor=not SETTING.sysCursor applyCursor()end},
|
||||||
WIDGET.newSwitch{name="autoPause", x=1060, y=450, lim=580, disp=SETval('autoPause'),code=SETrev('autoPause')},
|
WIDGET.newSwitch{name="autoPause", x=1060, y=450, lim=580, disp=SETval('autoPause'),code=SETrev('autoPause')},
|
||||||
WIDGET.newSwitch{name="autoSave", x=1060, y=500, lim=580, disp=SETval('autoSave'), code=SETrev('autoSave')},
|
WIDGET.newSwitch{name="autoSave", x=1060, y=500, lim=580, disp=SETval('autoSave'), code=SETrev('autoSave')},
|
||||||
WIDGET.newSwitch{name="autoLogin", x=960, y=580, lim=480, disp=SETval('autoLogin'),code=SETrev('autoLogin')},
|
WIDGET.newSwitch{name="autoLogin", x=960, y=580, lim=480, disp=SETval('autoLogin'),code=SETrev('autoLogin')},
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ scene.widgetList={
|
|||||||
WIDGET.newSwitch{name="clickFX", x=950,y=980,lim=360,disp=SETval('clickFX'), code=SETrev('clickFX')},
|
WIDGET.newSwitch{name="clickFX", x=950,y=980,lim=360,disp=SETval('clickFX'), code=SETrev('clickFX')},
|
||||||
WIDGET.newSwitch{name="power", x=950,y=1070,lim=360,disp=SETval('powerInfo'), code=SETrev('powerInfo')},
|
WIDGET.newSwitch{name="power", x=950,y=1070,lim=360,disp=SETval('powerInfo'), code=SETrev('powerInfo')},
|
||||||
WIDGET.newSwitch{name="clean", x=950,y=1160,lim=360,disp=SETval('cleanCanvas'), code=SETrev('cleanCanvas')},
|
WIDGET.newSwitch{name="clean", x=950,y=1160,lim=360,disp=SETval('cleanCanvas'), code=SETrev('cleanCanvas')},
|
||||||
WIDGET.newSwitch{name="fullscreen", x=950,y=1250,lim=360,disp=SETval('fullscreen'), code=switchFullscreen},
|
WIDGET.newSwitch{name="fullscreen", x=950,y=1250,lim=360,disp=SETval('fullscreen'), code=function()SETTING.fullscreen=not SETTING.fullscreen applyFullscreen()end},
|
||||||
WIDGET.newSwitch{name="bg", x=950,y=1340,lim=360,disp=SETval('bg'),
|
WIDGET.newSwitch{name="bg", x=950,y=1340,lim=360,disp=SETval('bg'),
|
||||||
code=function()
|
code=function()
|
||||||
BG.set('none')
|
BG.set('none')
|
||||||
|
|||||||
Reference in New Issue
Block a user