简化LOG.print的功能和使用

This commit is contained in:
MrZ626
2021-05-14 11:35:34 +08:00
parent c6115e3417
commit 5697a201ef
25 changed files with 112 additions and 121 deletions

View File

@@ -116,16 +116,16 @@ local function tapBoard(x,y,key)
if checkBoard(b)then
state=2
time=TIME()-startTime
if time<1 then LOG.print("不是人",COLOR.lB)
elseif time<2 then LOG.print("还是人",COLOR.lB)
elseif time<3 then LOG.print("神仙",COLOR.lB)
elseif time<5 then LOG.print("太强了",COLOR.lB)
elseif time<7.5 then LOG.print("很强",COLOR.lB)
elseif time<10 then LOG.print("可以的",COLOR.lB)
elseif time<20 then LOG.print("马上入门了",COLOR.lB)
elseif time<30 then LOG.print("入门不远了",COLOR.lB)
elseif time<60 then LOG.print("多加练习",COLOR.lB)
else LOG.print("第一次玩?加油",COLOR.lB)
if time<1 then LOG.print("不是人")
elseif time<2 then LOG.print("还是人")
elseif time<3 then LOG.print("神仙")
elseif time<5 then LOG.print("太强了")
elseif time<7.5 then LOG.print("很强")
elseif time<10 then LOG.print("可以的")
elseif time<20 then LOG.print("马上入门了")
elseif time<30 then LOG.print("入门不远了")
elseif time<60 then LOG.print("多加练习")
else LOG.print("第一次玩?加油")
end
SFX.play('win')
return

View File

@@ -82,7 +82,7 @@ function scene.keyDown(key)
str=str.."!"
if #MISSION>0 then str=str..DATA.copyMission()end
sys.setClipboardText(str.."!"..DATA.copyBoards().."!")
LOG.print(text.exportSuccess,COLOR.G)
LOG.print(text.exportSuccess,'message')
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),"!")
@@ -98,9 +98,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()
LOG.print(text.importSuccess,COLOR.G)
LOG.print(text.importSuccess,'message')
do return end
::THROW_fail::LOG.print(text.dataCorrupted,COLOR.R)
::THROW_fail::LOG.print(text.dataCorrupted,'error')
elseif key=="escape"then
FILE.save(CUSTOMENV,'conf/customEnv','q')
SCN.back()

View File

@@ -216,21 +216,21 @@ 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))
LOG.print(text.exportSuccess,COLOR.G)
LOG.print(text.exportSuccess,'message')
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
LOG.print(text.pasteWrongPlace)
LOG.print(text.pasteWrongPlace,'warn')
end
str=str:sub(p+1)
end
if DATA.pasteBoard(str,page)then
LOG.print(text.importSuccess,COLOR.G)
LOG.print(text.importSuccess,'message')
else
print(text.dataCorrupted)
LOG.print(text.dataCorrupted,COLOR.R)
LOG.print(text.dataCorrupted,'error')
end
elseif key=="pageup"then
page=max(page-1,1)

View File

@@ -71,22 +71,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())
LOG.print(text.exportSuccess,COLOR.G)
LOG.print(text.exportSuccess,'message')
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
LOG.print(text.pasteWrongPlace)
LOG.print(text.pasteWrongPlace,'warn')
end
str=str:sub(p+1)
end
if DATA.pasteMission(str)then
LOG.print(text.importSuccess,COLOR.G)
LOG.print(text.importSuccess,'message')
cur=#MISSION
else
LOG.print(text.dataCorrupted,COLOR.R)
LOG.print(text.dataCorrupted,'error')
end
elseif key=="escape"then
SCN.back()

View File

@@ -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())
LOG.print(text.exportSuccess,COLOR.G)
LOG.print(text.exportSuccess,'message')
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
LOG.print(text.pasteWrongPlace)
LOG.print(text.pasteWrongPlace,'warn')
end
str=str:sub(p+1)
end
if DATA.pasteSequence(str)then
LOG.print(text.importSuccess,COLOR.G)
LOG.print(text.importSuccess,'message')
cur=#BAG
else
LOG.print(text.dataCorrupted,COLOR.R)
LOG.print(text.dataCorrupted,'error')
end
elseif key=="escape"then
SCN.back()

View File

@@ -6,9 +6,9 @@ local savePW=false
local function login()
local email,password=emailBox:getText(),passwordBox:getText()
if not STRING.simpEmailCheck(email)then
LOG.print(text.wrongEmail)return
LOG.print(text.wrongEmail,'warn')return
elseif #password==0 then
LOG.print(text.noPassword)return
LOG.print(text.noPassword,'warn')return
end
NET.wsconn_user_pswd(email,password)
if savePW then

View File

@@ -83,7 +83,7 @@ function scene.keyDown(key)
NET.signal_quit()
else
lastBackTime=TIME()
LOG.print(text.sureQuit,COLOR.O)
LOG.print(text.sureQuit,'warn')
end
elseif key=="return"then
if inputBox.hide then
@@ -180,7 +180,7 @@ function scene.socketRead(cmd,d)
upstreamProgress=1
resetGameData('n',d.seed)
else
LOG.print("Redundant [Go]",30,COLOR.G)
LOG.print("Redundant [Go]",'warn')
end
elseif cmd=='finish'then
playing=false
@@ -203,7 +203,7 @@ function scene.socketRead(cmd,d)
if res then
DATA.pumpRecording(stream,P.stream)
else
LOG.print("Bad stream from "..P.username.."#"..P.uid)
LOG.print("Bad stream from "..P.username.."#"..P.uid,30)
end
end
end

View File

@@ -31,7 +31,7 @@ scene.widgetList={
SCN.back()
end
else
LOG.print(text.sureQuit,COLOR.O)
LOG.print(text.sureQuit,'warn')
lastLogoutTime=TIME()
end
end},

View File

@@ -74,7 +74,7 @@ function scene.keyDown(k)
elseif k=="return"then
if NET.getlock('fetchRoom')or not NET.roomList[selected]then return end
if NET.roomList[selected].private then
LOG.print("Can't enter private room now")
LOG.print("Can't enter private room now",'message')
return
end
NET.enterRoom(NET.roomList[selected])--,password

View File

@@ -6,13 +6,13 @@ local function register()
local password= WIDGET.active.password:getText()
local password2=WIDGET.active.password2:getText()
if #username==0 then
LOG.print(text.noUsername)return
LOG.print(text.noUsername,'warn')return
elseif not STRING.simpEmailCheck(email)then
LOG.print(text.wrongEmail)return
LOG.print(text.wrongEmail,'warn')return
elseif #password==0 or #password2==0 then
LOG.print(text.noPassword)return
LOG.print(text.noPassword,'warn')return
elseif password~=password2 then
LOG.print(text.diffPassword)return
LOG.print(text.diffPassword,'warn')return
end
NET.register(username,email,password)
end

View File

@@ -10,7 +10,7 @@ local function dumpCB(T)
)
)
)
LOG.print(text.exportSuccess)
LOG.print(text.exportSuccess,'message')
end
local function parseCB()
local _
@@ -18,9 +18,9 @@ local function parseCB()
--Decode
_,s=pcall(love.data.decode,'string','base64',s)
if not _ then LOG.print(text.dataCorrupted,COLOR.R)return end
if not _ then LOG.print(text.dataCorrupted,'error')return end
_,s=pcall(love.data.decompress,'string','zlib',s)
if not _ then LOG.print(text.dataCorrupted,COLOR.R)return end
if not _ then LOG.print(text.dataCorrupted,'error')return end
s=loadstring(s)
if s then

View File

@@ -188,7 +188,7 @@ scene.widgetList={
B.x,B.y,B.r=T[2],T[3],T[4]
end
end
LOG.print(("[ %d ]"):format(defaultSetSelect))
LOG.print(("==[ %d ]=="):format(defaultSetSelect))
defaultSetSelect=defaultSetSelect%5+1
selected=false
end},