MES模块增加更多图标,调整使用方法
This commit is contained in:
@@ -352,7 +352,7 @@ do--function DATA.saveRecording()
|
||||
--Filtering modes that cannot be saved
|
||||
for _,v in next,noRecList do
|
||||
if GAME.curModeName:find(v)then
|
||||
MES.new('warn',"Cannot save recording of this mode now!")
|
||||
MES.new('error',"Cannot save recording of this mode now!")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
@@ -127,7 +127,7 @@ function freshDate(mode)
|
||||
STAT.date=date
|
||||
STAT.todayTime=0
|
||||
if not mode:find'q'then
|
||||
MES.new(text.newDay)
|
||||
MES.new('info',text.newDay)
|
||||
end
|
||||
return true
|
||||
end
|
||||
@@ -141,10 +141,10 @@ function legalGameTime()--Check if today's playtime is legal
|
||||
if STAT.todayTime<14400 then
|
||||
return true
|
||||
elseif STAT.todayTime<21600 then
|
||||
MES.new(text.playedLong)
|
||||
MES.new('warn',text.playedLong)
|
||||
return true
|
||||
else
|
||||
MES.new(text.playedTooMuch)
|
||||
MES.new('error',text.playedTooMuch)
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,7 +16,7 @@ return{
|
||||
load=function()
|
||||
PLY.newPlayer(1)
|
||||
if SETTING.sfx_spawn==0 then
|
||||
MES.new(text.switchSpawnSFX)
|
||||
MES.new('warn',text.switchSpawnSFX)
|
||||
end
|
||||
end,
|
||||
mesDisp=function(P)
|
||||
|
||||
@@ -97,9 +97,9 @@ end
|
||||
local function _closeMessage(message)
|
||||
local mes=JSON.decode(message:sub(3))
|
||||
if mes then
|
||||
MES.new(("%s [%s] %s"):format(text.wsClose,mes.type or"unknown type",mes.reason or""))
|
||||
MES.new('info',("%s [%s] %s"):format(text.wsClose,mes.type or"unknown type",mes.reason or""))
|
||||
else
|
||||
MES.new(text.wsClose)
|
||||
MES.new('info',text.wsClose)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -249,13 +249,13 @@ function NET.uploadSave()
|
||||
{section=6,data=STRING.packTable(FILE.load('conf/vkSave1'))},
|
||||
{section=7,data=STRING.packTable(FILE.load('conf/vkSave2'))},
|
||||
}..'}}')
|
||||
MES.new("Uploading")
|
||||
MES.new('info',"Uploading")
|
||||
end
|
||||
end
|
||||
function NET.downloadSave()
|
||||
if NET.lock('downloadSave',10)then
|
||||
WS.send('user','{"action":3,"data":{"sections":[1,2,3,4,5,6,7]}}')
|
||||
MES.new("Downloading")
|
||||
MES.new('info',"Downloading")
|
||||
end
|
||||
end
|
||||
function NET.loadSavedData(sections)
|
||||
@@ -295,7 +295,7 @@ function NET.loadSavedData(sections)
|
||||
FILE.save(NET.cloudData.vkSave1,'conf/vkSave1','q')
|
||||
FILE.save(NET.cloudData.vkSave2,'conf/vkSave2','q')
|
||||
else
|
||||
MES.new(text.versionNotMatch,1)
|
||||
MES.new('error',text.versionNotMatch,1)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -414,22 +414,22 @@ function NET.updateWS_app()
|
||||
end
|
||||
end
|
||||
if VERSION.code<res.newestCode then
|
||||
MES.new(text.oldVersion:gsub("$1",res.newestName),3)
|
||||
MES.new('warn',text.oldVersion:gsub("$1",res.newestName),3)
|
||||
end
|
||||
MES.new(res.notice,5)
|
||||
MES.new('info',res.notice,5)
|
||||
NET.tryLogin(true)
|
||||
elseif res.action==0 then--Broadcast
|
||||
MES.new(res.data.message,5)
|
||||
MES.new('info',res.data.message,5)
|
||||
elseif res.action==1 then--Get notice
|
||||
--?
|
||||
elseif res.action==2 then--Register
|
||||
if res.type=='Self'or res.type=='Server'then
|
||||
MES.new(res.data.message,5)
|
||||
MES.new('info',res.data.message,5)
|
||||
if SCN.cur=='register'then
|
||||
SCN.back()
|
||||
end
|
||||
else
|
||||
MES.new(res.reason or"Registration failed",5)
|
||||
MES.new('warn',res.reason or"Registration failed",5)
|
||||
end
|
||||
NET.unlock('register')
|
||||
elseif res.action==3 then--Get player counts
|
||||
@@ -466,24 +466,24 @@ function NET.updateWS_user()
|
||||
FILE.save(USER,'conf/user','q')
|
||||
if SCN.cur=='login'then SCN.back()end
|
||||
end
|
||||
MES.new(text.loginSuccessed)
|
||||
MES.new('check',text.loginSuccessed)
|
||||
|
||||
--Get self infos
|
||||
NET.getUserInfo(USER.uid)
|
||||
NET.unlock('wsc_user')
|
||||
elseif res.action==0 then--Get accessToken
|
||||
NET.accessToken=res.accessToken
|
||||
MES.new(text.accessSuccessed)
|
||||
MES.new('check',text.accessSuccessed)
|
||||
NET.wsconn_play()
|
||||
elseif res.action==1 then--Get userInfo
|
||||
USERS.updateUserData(res.data)
|
||||
elseif res.action==2 then--Upload successed
|
||||
NET.unlock('uploadSave')
|
||||
MES.new(text.exportSuccess)
|
||||
MES.new('check',text.exportSuccess)
|
||||
elseif res.action==3 then--Download successed
|
||||
NET.unlock('downloadSave')
|
||||
NET.loadSavedData(res.data.sections)
|
||||
MES.new(text.importSuccess)
|
||||
MES.new('check',text.importSuccess)
|
||||
end
|
||||
else
|
||||
WS.alert('user')
|
||||
@@ -724,17 +724,17 @@ function NET.updateWS_manage()
|
||||
local res=_parse(message)
|
||||
if res then
|
||||
if res.type=='Connect'then
|
||||
MES.new("Manage connected")
|
||||
MES.new('check',"Manage connected")
|
||||
elseif res.action==0 then
|
||||
MES.new("success")
|
||||
MES.new('check',"success")
|
||||
elseif res.action==9 then
|
||||
MES.new("success")
|
||||
MES.new('check',"success")
|
||||
elseif res.action==10 then
|
||||
MES.new(TABLE.dump(res.data))
|
||||
MES.new('info',TABLE.dump(res.data))
|
||||
elseif res.action==11 then
|
||||
MES.new(TABLE.dump(res.data))
|
||||
MES.new('info',TABLE.dump(res.data))
|
||||
elseif res.action==12 then
|
||||
MES.new(TABLE.dump(res.data))
|
||||
MES.new('info',TABLE.dump(res.data))
|
||||
end
|
||||
else
|
||||
WS.alert('manage')
|
||||
|
||||
@@ -116,16 +116,16 @@ local function tapBoard(x,y,key)
|
||||
if checkBoard(b)then
|
||||
state=2
|
||||
time=TIME()-startTime
|
||||
if time<1 then MES.new("不是人")
|
||||
elseif time<2 then MES.new("还是人")
|
||||
elseif time<3 then MES.new("神仙")
|
||||
elseif time<5 then MES.new("太强了")
|
||||
elseif time<7.5 then MES.new("很强")
|
||||
elseif time<10 then MES.new("可以的")
|
||||
elseif time<20 then MES.new("马上入门了")
|
||||
elseif time<30 then MES.new("入门不远了")
|
||||
elseif time<60 then MES.new("多加练习")
|
||||
else MES.new("第一次玩?加油")
|
||||
if time<1 then MES.new(false,"不是人")
|
||||
elseif time<2 then MES.new(false,"还是人")
|
||||
elseif time<3 then MES.new(false,"神仙")
|
||||
elseif time<5 then MES.new(false,"太强了")
|
||||
elseif time<7.5 then MES.new(false,"很强")
|
||||
elseif time<10 then MES.new(false,"可以的")
|
||||
elseif time<20 then MES.new(false,"马上入门了")
|
||||
elseif time<30 then MES.new(false,"入门不远了")
|
||||
elseif time<60 then MES.new(false,"多加练习")
|
||||
else MES.new(false,"第一次玩?加油")
|
||||
end
|
||||
SFX.play('win')
|
||||
return
|
||||
|
||||
@@ -298,9 +298,27 @@ local commands={}do
|
||||
code=error,
|
||||
description="Manually crash the game",
|
||||
}
|
||||
commands.message={
|
||||
code=function(str)MES.new('warn',str,6)end,
|
||||
description="Show a warn message",
|
||||
commands.mes={
|
||||
code=function(arg)
|
||||
if
|
||||
arg=='check'or
|
||||
arg=='info'or
|
||||
arg=='warn'or
|
||||
arg=='error'
|
||||
then
|
||||
MES.new(arg,"Test message",6)
|
||||
else
|
||||
log{C.A,"Show a message on the up-left corner"}
|
||||
log""
|
||||
log{C.A,"Usage: mes <check|info|warn|error> [message]"}
|
||||
end
|
||||
end,
|
||||
description="Show a message",
|
||||
details={
|
||||
"Show a message on the up-left corner",
|
||||
"",
|
||||
"Usage: mes <check|info|warn|error> [message]",
|
||||
},
|
||||
}
|
||||
commands.warn={
|
||||
code=function(str)MES.new('warn',str,6)end,
|
||||
|
||||
@@ -51,13 +51,13 @@ function scene.keyDown(key)
|
||||
if key=="return"or key=="return2"then
|
||||
if CUSTOMENV.opponent~="X"then
|
||||
if CUSTOMENV.opponent:sub(1,2)=='CC'and CUSTOMENV.sequence=="fixed"then
|
||||
MES.new(text.ai_fixed)
|
||||
MES.new('error',text.ai_fixed)
|
||||
return
|
||||
elseif #BAG>0 then
|
||||
MES.new(text.ai_prebag)
|
||||
MES.new('error',text.ai_prebag)
|
||||
return
|
||||
elseif #MISSION>0 then
|
||||
MES.new(text.ai_mission)
|
||||
MES.new('error',text.ai_mission)
|
||||
return
|
||||
end
|
||||
end
|
||||
@@ -95,7 +95,7 @@ function scene.keyDown(key)
|
||||
str=str.."!"
|
||||
if #MISSION>0 then str=str..DATA.copyMission()end
|
||||
sys.setClipboardText(str.."!"..DATA.copyBoards().."!")
|
||||
MES.new(text.exportSuccess)
|
||||
MES.new('check',text.exportSuccess)
|
||||
elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then
|
||||
local str=sys.getClipboardText()
|
||||
local args=STRING.split(str:sub((str:find(":")or 0)+1),"!")
|
||||
@@ -111,9 +111,9 @@ function scene.keyDown(key)
|
||||
if args[i]:find("%S")and not DATA.pasteBoard(args[i],i-3)and i<#args then goto THROW_fail end
|
||||
end
|
||||
freshMiniFieldVisible()
|
||||
MES.new(text.importSuccess)
|
||||
MES.new('check',text.importSuccess)
|
||||
do return end
|
||||
::THROW_fail::MES.new(text.dataCorrupted)
|
||||
::THROW_fail::MES.new('error',text.dataCorrupted)
|
||||
elseif key=="escape"then
|
||||
FILE.save(CUSTOMENV,'conf/customEnv','q')
|
||||
SCN.back()
|
||||
|
||||
@@ -216,20 +216,20 @@ function scene.keyDown(key)
|
||||
SFX.play('fall',.8)
|
||||
elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then
|
||||
sys.setClipboardText("Techmino Field:"..DATA.copyBoard(page))
|
||||
MES.new(text.exportSuccess)
|
||||
MES.new('check',text.exportSuccess)
|
||||
elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then
|
||||
local str=sys.getClipboardText()
|
||||
local p=str:find(":")--ptr*
|
||||
if p then
|
||||
if not str:sub(1,p-1):find("Field")then
|
||||
MES.new(text.pasteWrongPlace)
|
||||
MES.new('error',text.pasteWrongPlace)
|
||||
end
|
||||
str=str:sub(p+1)
|
||||
end
|
||||
if DATA.pasteBoard(str,page)then
|
||||
MES.new(text.importSuccess)
|
||||
MES.new('check',text.importSuccess)
|
||||
else
|
||||
MES.new(text.dataCorrupted)
|
||||
MES.new('error',text.dataCorrupted)
|
||||
end
|
||||
elseif key=="pageup"then
|
||||
page=max(page-1,1)
|
||||
|
||||
@@ -3,7 +3,6 @@ local kb=love.keyboard
|
||||
|
||||
local int,sin=math.floor,math.sin
|
||||
local ins,rem=table.insert,table.remove
|
||||
local sub=string.sub
|
||||
|
||||
local scene={}
|
||||
|
||||
@@ -71,22 +70,22 @@ function scene.keyDown(key)
|
||||
elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then
|
||||
if #MISSION>0 then
|
||||
sys.setClipboardText("Techmino Target:"..DATA.copyMission())
|
||||
MES.new(text.exportSuccess)
|
||||
MES.new('check',text.exportSuccess)
|
||||
end
|
||||
elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then
|
||||
local str=sys.getClipboardText()
|
||||
local p=str:find(":")--ptr*
|
||||
if p then
|
||||
if not str:sub(1,p-1):find("Target")then
|
||||
MES.new(text.pasteWrongPlace)
|
||||
MES.new('error',text.pasteWrongPlace)
|
||||
end
|
||||
str=str:sub(p+1)
|
||||
end
|
||||
if DATA.pasteMission(str)then
|
||||
MES.new(text.importSuccess)
|
||||
MES.new('check',text.importSuccess)
|
||||
cur=#MISSION
|
||||
else
|
||||
MES.new(text.dataCorrupted)
|
||||
MES.new('error',text.dataCorrupted)
|
||||
end
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
|
||||
@@ -85,22 +85,22 @@ function scene.keyDown(key)
|
||||
elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then
|
||||
if #BAG>0 then
|
||||
sys.setClipboardText("Techmino SEQ:"..DATA.copySequence())
|
||||
MES.new(text.exportSuccess)
|
||||
MES.new('check',text.exportSuccess)
|
||||
end
|
||||
elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then
|
||||
local str=sys.getClipboardText()
|
||||
local p=str:find(":")--ptr*
|
||||
if p then
|
||||
if not str:sub(1,p-1):find("SEQ")then
|
||||
MES.new(text.pasteWrongPlace)
|
||||
MES.new('error',text.pasteWrongPlace)
|
||||
end
|
||||
str=str:sub(p+1)
|
||||
end
|
||||
if DATA.pasteSequence(str)then
|
||||
MES.new(text.importSuccess)
|
||||
MES.new('check',text.importSuccess)
|
||||
cur=#BAG
|
||||
else
|
||||
MES.new(text.dataCorrupted)
|
||||
MES.new('error',text.dataCorrupted)
|
||||
end
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
|
||||
@@ -6,9 +6,9 @@ local savePW=false
|
||||
local function login()
|
||||
local email,password=emailBox:getText(),passwordBox:getText()
|
||||
if not STRING.simpEmailCheck(email)then
|
||||
MES.new(text.wrongEmail)return
|
||||
MES.new('error',text.wrongEmail)return
|
||||
elseif #password==0 then
|
||||
MES.new(text.noPassword)return
|
||||
MES.new('error',text.noPassword)return
|
||||
end
|
||||
NET.wsconn_user_pswd(email,password)
|
||||
if savePW then
|
||||
|
||||
@@ -67,7 +67,7 @@ function scene.keyDown(key)
|
||||
NET.tryLogin(false)
|
||||
else
|
||||
NET.wsconn_app()
|
||||
MES.new(text.wsConnecting)
|
||||
MES.new('info',text.wsConnecting)
|
||||
SFX.play('connect')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -35,7 +35,7 @@ local function _quit()
|
||||
NET.signal_quit()
|
||||
else
|
||||
lastBackTime=TIME()
|
||||
MES.new(text.sureQuit)
|
||||
MES.new('info',text.sureQuit)
|
||||
end
|
||||
end
|
||||
local function _switchChat()
|
||||
|
||||
@@ -32,7 +32,7 @@ scene.widgetList={
|
||||
SCN.back()
|
||||
end
|
||||
else
|
||||
MES.new(text.sureQuit)
|
||||
MES.new('info',text.sureQuit)
|
||||
lastLogoutTime=TIME()
|
||||
end
|
||||
end},
|
||||
|
||||
@@ -85,7 +85,7 @@ scene.widgetList={
|
||||
ROOMENV.capacity=i
|
||||
WIDGET.active.capacity.color=COLOR.lY
|
||||
else
|
||||
MES.new('warn',"没有权限 Permission Denied")
|
||||
MES.new('error',"没有权限 Permission Denied")
|
||||
WIDGET.active.capacity.color=COLOR.R
|
||||
end
|
||||
end},
|
||||
|
||||
@@ -61,8 +61,8 @@ function scene.keyDown(k)
|
||||
elseif k=="return"then
|
||||
if NET.getlock('fetchRoom')or not NET.roomList[selected]then return end
|
||||
local R=NET.roomList[selected]
|
||||
if R.roomInfo.version~=VERSION.short then MES.new('warn',"Version doesn't match")return end
|
||||
if R.private then MES.new('warn',"Can't enter private room now")return end
|
||||
if R.roomInfo.version~=VERSION.short then MES.new('error',"Version doesn't match")return end
|
||||
if R.private then MES.new('error',"Can't enter private room now")return end
|
||||
NET.enterRoom(R)--,password
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,13 +6,13 @@ local function register()
|
||||
local password= WIDGET.active.password:getText()
|
||||
local password2=WIDGET.active.password2:getText()
|
||||
if #username==0 then
|
||||
MES.new(text.noUsername)return
|
||||
MES.new('error',text.noUsername)return
|
||||
elseif not STRING.simpEmailCheck(email)then
|
||||
MES.new(text.wrongEmail)return
|
||||
MES.new('error',text.wrongEmail)return
|
||||
elseif #password==0 or #password2==0 then
|
||||
MES.new(text.noPassword)return
|
||||
MES.new('error',text.noPassword)return
|
||||
elseif password~=password2 then
|
||||
MES.new(text.diffPassword)return
|
||||
MES.new('error',text.diffPassword)return
|
||||
end
|
||||
NET.register(username,email,password)
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@ local scene={}
|
||||
|
||||
local function dumpCB(T)
|
||||
love.system.setClipboardText(STRING.packText(TABLE.dump(T)))
|
||||
MES.new(text.exportSuccess)
|
||||
MES.new('check',text.exportSuccess)
|
||||
end
|
||||
local function parseCB()
|
||||
local _
|
||||
@@ -10,7 +10,7 @@ local function parseCB()
|
||||
|
||||
--Decode
|
||||
s=STRING.unpackText(s)
|
||||
if not s then MES.new(text.dataCorrupted)return end
|
||||
if not s then MES.new('error',text.dataCorrupted)return end
|
||||
|
||||
s=loadstring(s)
|
||||
if s then
|
||||
@@ -32,9 +32,9 @@ scene.widgetList={
|
||||
if D then
|
||||
TABLE.update(D,RANKS)
|
||||
FILE.save(RANKS,'conf/unlock')
|
||||
MES.new(text.importSuccess)
|
||||
MES.new('check',text.importSuccess)
|
||||
else
|
||||
MES.new(text.dataCorrupted)
|
||||
MES.new('error',text.dataCorrupted)
|
||||
end
|
||||
end},
|
||||
WIDGET.newButton{name="data", x=490,y=390,w=280,h=100,color='lR',
|
||||
@@ -43,9 +43,9 @@ scene.widgetList={
|
||||
if D and D.version==STAT.version then
|
||||
TABLE.update(D,STAT)
|
||||
FILE.save(STAT,'conf/data')
|
||||
MES.new(text.importSuccess)
|
||||
MES.new('check',text.importSuccess)
|
||||
else
|
||||
MES.new(text.dataCorrupted)
|
||||
MES.new('error',text.dataCorrupted)
|
||||
end
|
||||
end},
|
||||
WIDGET.newButton{name="setting", x=790,y=390,w=280,h=100,color='lR',
|
||||
@@ -54,9 +54,9 @@ scene.widgetList={
|
||||
if D then
|
||||
TABLE.update(D,SETTING)
|
||||
FILE.save(SETTING,'conf/settings')
|
||||
MES.new(text.importSuccess)
|
||||
MES.new('check',text.importSuccess)
|
||||
else
|
||||
MES.new(text.dataCorrupted)
|
||||
MES.new('error',text.dataCorrupted)
|
||||
end
|
||||
end},
|
||||
WIDGET.newButton{name="vk", x=1090,y=390,w=280,h=100,color='lR',
|
||||
@@ -65,9 +65,9 @@ scene.widgetList={
|
||||
if D then
|
||||
TABLE.update(D,VK_org)
|
||||
FILE.save(VK_org,'conf/virtualkey')
|
||||
MES.new(text.importSuccess)
|
||||
MES.new('check',text.importSuccess)
|
||||
else
|
||||
MES.new(text.dataCorrupted)
|
||||
MES.new('error',text.dataCorrupted)
|
||||
end
|
||||
end},
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ local function load1()
|
||||
if D then
|
||||
TABLE.update(D,VK_org)
|
||||
else
|
||||
MES.new(text.noFile)
|
||||
MES.new('error',text.noFile)
|
||||
end
|
||||
end
|
||||
local function save2()
|
||||
@@ -27,7 +27,7 @@ local function load2()
|
||||
if D then
|
||||
TABLE.update(D,VK_org)
|
||||
else
|
||||
MES.new(text.noFile)
|
||||
MES.new('error',text.noFile)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -188,7 +188,7 @@ scene.widgetList={
|
||||
B.x,B.y,B.r=T[2],T[3],T[4]
|
||||
end
|
||||
end
|
||||
MES.new(("==[ %d ]=="):format(defaultSetSelect))
|
||||
MES.new('check',("==[ %d ]=="):format(defaultSetSelect))
|
||||
defaultSetSelect=defaultSetSelect%5+1
|
||||
selected=false
|
||||
end},
|
||||
|
||||
@@ -35,7 +35,7 @@ function scene.keyDown(key)
|
||||
if backCounter==0 then
|
||||
SCN.back()
|
||||
else
|
||||
MES.new(backCounter)
|
||||
MES.new('info',backCounter)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user