From 7075d7d5b2cab9a46fdd009f2879ccb8ae8f12b9 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sun, 13 Jun 2021 02:06:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E6=97=B6=E4=BD=BF=E7=94=A8=E6=9C=AA?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=9A=84MES=E6=A8=A1=E5=9D=97=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2LOG=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/bgm.lua | 2 +- Zframework/file.lua | 12 +++--- Zframework/init.lua | 31 +++++++------- Zframework/json.lua | 8 ++-- Zframework/loadLib.lua | 14 +++---- Zframework/log.lua | 64 ----------------------------- Zframework/message.lua | 70 ++++++++++++++++++++++++++++++++ Zframework/profile.lua | 4 +- Zframework/scene.lua | 4 +- Zframework/sfx.lua | 2 +- Zframework/theme.lua | 12 +++--- Zframework/voice.lua | 2 +- Zframework/websocket.lua | 2 +- Zframework/widget.lua | 4 +- main.lua | 4 +- parts/data.lua | 4 +- parts/gametoolfunc.lua | 12 +++--- parts/modes/blind_wtf.lua | 2 +- parts/net.lua | 44 ++++++++++---------- parts/player/init.lua | 2 +- parts/player/seqGenerators.lua | 2 +- parts/scenes/app_15p.lua | 20 ++++----- parts/scenes/customGame.lua | 12 +++--- parts/scenes/custom_field.lua | 8 ++-- parts/scenes/custom_mission.lua | 8 ++-- parts/scenes/custom_sequence.lua | 8 ++-- parts/scenes/login.lua | 4 +- parts/scenes/main.lua | 2 +- parts/scenes/net_game.lua | 4 +- parts/scenes/net_league.lua | 2 +- parts/scenes/net_menu.lua | 4 +- parts/scenes/net_newRoom.lua | 2 +- parts/scenes/net_rooms.lua | 4 +- parts/scenes/register.lua | 8 ++-- parts/scenes/savedata.lua | 20 ++++----- parts/scenes/setting_touch.lua | 6 +-- parts/scenes/test.lua | 2 +- parts/skin.lua | 2 +- 38 files changed, 211 insertions(+), 206 deletions(-) delete mode 100644 Zframework/log.lua create mode 100644 Zframework/message.lua diff --git a/Zframework/bgm.lua b/Zframework/bgm.lua index 3b238766..f24325ec 100644 --- a/Zframework/bgm.lua +++ b/Zframework/bgm.lua @@ -50,7 +50,7 @@ function BGM.init(list) Sources[list[i]]:setLooping(true) Sources[list[i]]:setVolume(0) else - LOG.print("No BGM file: "..list[i],5,'warn') + MES.new("No BGM file: "..list[i],5) end if not skip and i~=count then coroutine.yield() diff --git a/Zframework/file.lua b/Zframework/file.lua index e64b6cbb..103c0c94 100644 --- a/Zframework/file.lua +++ b/Zframework/file.lua @@ -21,7 +21,7 @@ function FILE.load(name) return s end end - LOG.print(name.." "..text.loadError,'error') + MES.new(name.." "..text.loadError) end end function FILE.save(data,name,mode) @@ -30,13 +30,13 @@ function FILE.save(data,name,mode) if mode:find'l'then data=TABLE.dump(data) if not data then - LOG.print(name.." "..text.saveError.."dump error",'error') + MES.new(name.." "..text.saveError.."dump error") return end else data=JSON.encode(data) if not data then - LOG.print(name.." "..text.saveError.."json error",'error') + MES.new(name.." "..text.saveError.."json error") return end end @@ -50,11 +50,11 @@ function FILE.save(data,name,mode) F:flush()F:close() if success then if not mode:find'q'then - LOG.print(text.saveDone,'message') + MES.new(text.saveDone) end else - LOG.print(text.saveError..(mes or"unknown error"),'error') - LOG.print(debug.traceback(),'error') + MES.new(text.saveError..(mes or"unknown error")) + MES.new(debug.traceback()) end end function FILE.clear(path) diff --git a/Zframework/init.lua b/Zframework/init.lua index a96d8a7e..7e3a3ba8 100644 --- a/Zframework/init.lua +++ b/Zframework/init.lua @@ -11,7 +11,6 @@ ADRAW=require"Zframework.aDraw" SCR= require"Zframework.screen" COLOR= require"Zframework.color" -LOG= require"Zframework.log" SCN= require"Zframework.scene" WS= require"Zframework.websocket" @@ -31,6 +30,7 @@ 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" @@ -208,7 +208,7 @@ local function noDevkeyPressed(key) if key=="f1"then PROFILE.switch() elseif key=="f2"then - LOG.print(("System:%s[%s]\nluaVer:%s\njitVer:%s\njitVerNum:%s"):format(SYSTEM,jit.arch,_VERSION,jit.version,jit.version_num),'message') + MES.new(("System:%s[%s]\nluaVer:%s\njitVer:%s\njitVerNum:%s"):format(SYSTEM,jit.arch,_VERSION,jit.version,jit.version_num)) elseif key=="f3"then for _=1,8 do local P=PLY_ALIVE[rnd(#PLY_ALIVE)] @@ -218,7 +218,7 @@ local function noDevkeyPressed(key) end end elseif key=="f4"and not kb.isDown("lalt","ralt")then - LOG.copy() + MES.new.copy() elseif key=="f5"then print(WIDGET.isFocus()or"no widget selected") elseif key=="f6"then @@ -226,15 +226,15 @@ local function noDevkeyPressed(key) elseif key=="f7"and love._openConsole then love._openConsole() elseif key=="f8"then - devMode=nil LOG.print("DEBUG OFF",.2) + devMode=nil MES.new("DEBUG OFF",.2) elseif key=="f9"then - devMode=1 LOG.print("DEBUG 1") + devMode=1 MES.new("DEBUG 1") elseif key=="f10"then - devMode=2 LOG.print("DEBUG 2") + devMode=2 MES.new("DEBUG 2") elseif key=="f11"then - devMode=3 LOG.print("DEBUG 3") + devMode=3 MES.new("DEBUG 3") elseif key=="f12"then - devMode=4 LOG.print("DEBUG 4") + devMode=4 MES.new("DEBUG 4") elseif devMode==2 then local W=WIDGET.sel if W then @@ -263,7 +263,7 @@ function love.keypressed(key) return elseif key=="f8"then devMode=1 - LOG.print("DEBUG ON",.2) + MES.new("DEBUG ON",.2) elseif key=="f11"then if kb.isDown("lctrl","rctrl")then _G["\100\114\97\119\70\87\77"]=NULL @@ -294,13 +294,13 @@ end function love.joystickadded(JS) ins(joysticks,JS) - LOG.print("Joystick added",'message') + MES.new("Joystick added") end function love.joystickremoved(JS) local i=TABLE.find(joysticks,JS) if i then rem(joysticks,i) - LOG.print("Joystick removed",'message') + MES.new("Joystick removed") end end local keyMirror={ @@ -359,7 +359,7 @@ function love.lowmemory() if TIME()-lastGCtime>6.26 then collectgarbage() lastGCtime=TIME() - LOG.print("[auto GC] low MEM 设备内存过低",'warn') + MES.new("[auto GC] low MEM 设备内存过低") end end function love.resize(w,h) @@ -519,7 +519,7 @@ function love.run() local love=love local VOC,BG,SYSFX=VOC,BG,SYSFX - local TASK,LOG,TEXT=TASK,LOG,TEXT + local TASK,TEXT=TASK,TEXT local TEXTURE,TIME=TEXTURE,TIME local SETTING,VERSION=SETTING,VERSION @@ -570,7 +570,7 @@ function love.run() if SCN.update then SCN.update(dt)end if SCN.swapping then SCN.swapUpdate()end TEXT.update() - LOG.update(dt) + MES.update(dt) --DRAW if not MINI()then @@ -597,9 +597,8 @@ function love.run() gc_setColor(1,1,1) gc_draw(ms.isDown(1)and cursor_holdImg or cursorImg,mx,my,nil,nil,nil,8,8) end - gc_replaceTransform(SCR.xOy_ul) - LOG.draw() gc_replaceTransform(SCR.origin) + MES.draw() --Draw power info. if SETTING.powerInfo then gc_setColor(1,1,1) diff --git a/Zframework/json.lua b/Zframework/json.lua index 230dc276..7124c72d 100644 --- a/Zframework/json.lua +++ b/Zframework/json.lua @@ -118,8 +118,8 @@ function json.encode(val) local a,b=pcall(encode,val) if a then return b - elseif LOG then - LOG.print(text.jsonError..": "..(b or"uknErr"),'warn') + elseif MES.new then + MES.new(text.jsonError..": "..(b or"uknErr")) end end @@ -348,8 +348,8 @@ function json.decode(str) local a,b=pcall(decode,str) if a then return b - elseif LOG then - LOG.print(text.jsonError..": "..(b or"uknErr"),'warn') + elseif MES.new then + MES.new(text.jsonError..": "..(b or"uknErr")) end end return json \ No newline at end of file diff --git a/Zframework/loadLib.lua b/Zframework/loadLib.lua index 97ebaa25..80a9a337 100644 --- a/Zframework/loadLib.lua +++ b/Zframework/loadLib.lua @@ -4,7 +4,7 @@ return function(name,libName) if r1 and r2 then return r2 else - LOG.print("Cannot load "..name..": "..(r2 or r3),'warn') + MES.new("Cannot load "..name..": "..(r2 or r3)) end elseif SYSTEM=="Android"then local fs=love.filesystem @@ -17,25 +17,25 @@ return function(name,libName) if success then libFunc,mes2=package.loadlib(SAVEDIR.."/lib/"..libName.Android,libName.libFunc) if libFunc then - LOG.print(name.." lib loaded",'message') + MES.new(name.." lib loaded") break else - LOG.print("Cannot load "..name..": "..mes2,'error') + MES.new("Cannot load "..name..": "..mes2) end else - LOG.print(("Write %s-%s to saving failed: %s"):format(name,platform[i],mes2),'error') + MES.new(("Write %s-%s to saving failed: %s"):format(name,platform[i],mes2)) end else - LOG.print(("Read %s-%s to saving failed: %s"):format(name,platform[i],mes1),'error') + MES.new(("Read %s-%s to saving failed: %s"):format(name,platform[i],mes1)) end end if not libFunc then - LOG.print("Cannot load "..name,'error') + MES.new("Cannot load "..name) return end return libFunc() else - LOG.print("No "..name.." for "..SYSTEM,'error') + MES.new("No "..name.." for "..SYSTEM) return end return true diff --git a/Zframework/log.lua b/Zframework/log.lua deleted file mode 100644 index c60d1833..00000000 --- a/Zframework/log.lua +++ /dev/null @@ -1,64 +0,0 @@ -local utf8=require"utf8" -local gc=love.graphics -local gc_setColor,gc_print=gc.setColor,gc.print -local int,min=math.floor,math.min -local ins,rem=table.insert,table.remove -local setFont=setFont - -local mesList={} -local mesHistory={ - "Version: "..VERSION.string, - os.date("Launched at %Y/%m/%d %H:%M"), -} -local LOG={} -function LOG.update(dt) - if mesList[1]then - for i=#mesList,1,-1 do - local M=mesList[i] - if M.blink>0 then - M.blink=M.blink-1 - else - M.time=M.time-dt - if M.time<=0 then - rem(mesList,i) - end - end - end - end -end -function LOG.draw() - if mesList[1]then - setFont(20) - for i=1,#mesList do - local M=mesList[i] - M.rgba[4]=M.blink>0 and int(M.blink/3)%2 or min(M.time*60/26,1) - gc_setColor(M.rgba) - gc_print(M.text,10+(20-min(M.time*60,20))^1.5/4,25*i) - end - end -end -function LOG.print(text,T)--text,type/time - local color=COLOR.Z - local his,time - if T=='message'then - color=COLOR.N - his,time=true,4 - elseif T=='warn'then - color=COLOR.Y - his,time=true,4 - elseif T=='error'then - color=COLOR.R - his,time=true,5 - elseif type(T)=='number'then - time=T - end - text=tostring(text) - assert(utf8.len(text),"Error UTF-8 coding") - if his then ins(mesHistory,SCN.cur..": "..text)end - ins(mesList,{text=text,rgba={color[1],color[2],color[3],nil},blink=30,time=time or 3}) -end -function LOG.copy() - love.system.setClipboardText(table.concat(mesHistory,"\n")) - LOG.print("Log copied",'message') -end -return LOG \ No newline at end of file diff --git a/Zframework/message.lua b/Zframework/message.lua new file mode 100644 index 00000000..f283969b --- /dev/null +++ b/Zframework/message.lua @@ -0,0 +1,70 @@ +local gc=love.graphics +local gc_push,gc_pop=gc.push,gc.pop +local gc_replaceTransform=gc.replaceTransform +local gc_translate,gc_setColor,gc_draw=gc.translate,gc.setColor,gc.draw + +local ins,rem=table.insert,table.remove + +local mesList={} + +local MES={} + +function MES.new(...) + local icon,str,time=... + if type(icon)~='userdata'then + icon,str,time=false,icon,str + else + end + local t=gc.newText(getFont(30),str) + local w=math.max(t:getWidth()+(icon and 45 or 5),200) + local L={w+20,48, + {'setCL',.5,.5,.5,.7}, + {'fRect',0,0,w+20,48}, + {'setCL',.9,.9,.9}, + {'setLW',2}, + {'dRect',1,1,w+18,46}, + {'setCL',1,1,1}, + } + if icon then + ins(L,{'draw',icon,4,4,nil,40/icon:getWidth(),40/icon:getHeight()}) + end + ins(L,{'draw',t,icon and 50 or 10,2}) + + ins(mesList,{ + startTime=.5, + endTime=.5, + time=time or 3, + canvas=DOGC(L), + }) +end + +function MES.update(dt) + for i=#mesList,1,-1 do + local m=mesList[i] + if m.startTime>0 then + m.startTime=m.startTime-dt + elseif m.time>0 then + m.time=m.time-dt + elseif m.endTime>0 then + m.endTime=m.endTime-dt + else + rem(mesList,i) + end + end +end + +function MES.draw() + gc_push('transform') + if #mesList>0 then + gc_translate(0,25) + for i=1,#mesList do + local m=mesList[i] + gc_setColor(1,1,1,2*(m.endTime-m.startTime)) + gc_draw(m.canvas,40-80*(m.endTime+m.startTime)) + gc_translate(0,52) + end + gc_replaceTransform(SCR.xOy) + end + gc_pop() +end +return MES \ No newline at end of file diff --git a/Zframework/profile.lua b/Zframework/profile.lua index df443f2f..11837f67 100644 --- a/Zframework/profile.lua +++ b/Zframework/profile.lua @@ -141,10 +141,10 @@ function profile.switch() profile.stop() love.system.setClipboardText(PROFILE.report()) PROFILE.reset() - LOG.print("profile report copied!",'message') + MES.new("profile report copied!") else PROFILE.start() - LOG.print("profile start!",'message') + MES.new("profile start!") end switch=not switch end diff --git a/Zframework/scene.lua b/Zframework/scene.lua index 5f7558d6..bd084b09 100644 --- a/Zframework/scene.lua +++ b/Zframework/scene.lua @@ -150,7 +150,7 @@ function SCN.swapTo(tar,style)--Parallel scene swapping, cannot back S.time,S.mid,S.draw=s[1],s[2],s[3] end else - LOG.print("No Scene: "..tar,'warn') + MES.new("No Scene: "..tar) end end function SCN.go(tar,style)--Normal scene swapping, can back @@ -158,7 +158,7 @@ function SCN.go(tar,style)--Normal scene swapping, can back SCN.push() SCN.swapTo(tar,style) else - LOG.print("No Scene: "..tar,'warn') + MES.new("No Scene: "..tar) end end function SCN.back() diff --git a/Zframework/sfx.lua b/Zframework/sfx.lua index 20163104..1a095f68 100644 --- a/Zframework/sfx.lua +++ b/Zframework/sfx.lua @@ -17,7 +17,7 @@ function SFX.init(list) if love.filesystem.getInfo(N)then Sources[list[i]]={love.audio.newSource(N,'static')} else - LOG.print("No SFX file: "..N,.1) + MES.new("No SFX file: "..N,.1) end if not skip and i~=count then coroutine.yield() diff --git a/Zframework/theme.lua b/Zframework/theme.lua index 27edf2cc..5cdcc750 100644 --- a/Zframework/theme.lua +++ b/Zframework/theme.lua @@ -52,18 +52,18 @@ function THEME.set(theme) elseif theme=='xmas'then BG.setDefault('snow') BGM.setDefault('xmas') - LOG.print("==============") - LOG.print("Merry Christmas!") - LOG.print("==============") + MES.new("==============") + MES.new("Merry Christmas!") + MES.new("==============") elseif theme=='birth'then BG.setDefault('firework') BGM.setDefault('magicblock') elseif theme=='sprfes'then BG.setDefault('firework') BGM.setDefault("spring festival") - LOG.print(" ★☆☆★") - LOG.print("新年快乐!") - LOG.print(" ★☆☆★") + MES.new(" ★☆☆★") + MES.new("新年快乐!") + MES.new(" ★☆☆★") elseif theme=='zday1'then BG.setDefault('lanterns') BGM.setDefault("empty") diff --git a/Zframework/voice.lua b/Zframework/voice.lua index 23cf24f1..48868c3c 100644 --- a/Zframework/voice.lua +++ b/Zframework/voice.lua @@ -45,7 +45,7 @@ function VOC.init(list) if n==1 then if not loadVoiceFile(list[i],list[i])then - LOG.print("No VOICE file: "..list[i],.1) + MES.new("No VOICE file: "..list[i],.1) end end if not Source[list[i]][1]then Source[list[i]]=nil end diff --git a/Zframework/websocket.lua b/Zframework/websocket.lua index 7825c7ff..aa1f0864 100644 --- a/Zframework/websocket.lua +++ b/Zframework/websocket.lua @@ -349,7 +349,7 @@ function WS.update(dt) ws.pongTimer=1 else ws.status='dead' - LOG.print(text.wsFailed..": "..(mes=="timeout"and text.netTimeout or mes),'warn') + MES.new(text.wsFailed..": "..(mes=="timeout"and text.netTimeout or mes)) end end elseif ws.status=='running'then diff --git a/Zframework/widget.lua b/Zframework/widget.lua index fbad7292..3a444a09 100644 --- a/Zframework/widget.lua +++ b/Zframework/widget.lua @@ -617,7 +617,7 @@ function selector:reset() self.selText=self.list[i] else self.hide=true - LOG.print("Selector "..self.name.." dead, disp= "..tostring(V),'warn') + MES.new("Selector "..self.name.." dead, disp= "..tostring(V)) end end function selector:isAbove(x,y) @@ -771,7 +771,7 @@ function inputBox:addText(str) if type(str)=='string'then self.value=self.value..str else - LOG.print("inputBox "..self.name.." dead, addText("..type(str)..")",'warn') + MES.new("inputBox "..self.name.." dead, addText("..type(str)..")") end end function inputBox:clear() diff --git a/main.lua b/main.lua index 9013e537..f3030b38 100644 --- a/main.lua +++ b/main.lua @@ -161,7 +161,7 @@ SFX.init((function() if fs.getRealDirectory("media/SFX/"..v)~=SAVEDIR then table.insert(L,v:sub(1,-5)) else - LOG.print("Dangerous file : %SAVE%/media/SFX/"..v,'warn') + MES.new("Dangerous file : %SAVE%/media/SFX/"..v) end end return L @@ -172,7 +172,7 @@ BGM.init((function() if fs.getRealDirectory("media/BGM/"..v)~=SAVEDIR then table.insert(L,v:sub(1,-5)) else - LOG.print("Dangerous file : %SAVE%/media/BGM/"..v,'warn') + MES.new("Dangerous file : %SAVE%/media/BGM/"..v) end end return L diff --git a/parts/data.lua b/parts/data.lua index 2d862f9f..33b29030 100644 --- a/parts/data.lua +++ b/parts/data.lua @@ -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 - LOG.print("Cannot save recording of this mode now!",'warn') + MES.new("Cannot save recording of this mode now!") return end end @@ -376,7 +376,7 @@ do--function DATA.saveRecording() FILE.save(REPLAY,'conf/replay') return true else - LOG.print("Save failed: File already exists",'error') + MES.new("Save failed: File already exists") end end end diff --git a/parts/gametoolfunc.lua b/parts/gametoolfunc.lua index a58c5d1f..0276e875 100644 --- a/parts/gametoolfunc.lua +++ b/parts/gametoolfunc.lua @@ -127,7 +127,7 @@ function freshDate(mode) STAT.date=date STAT.todayTime=0 if not mode:find'q'then - LOG.print(text.newDay,'message') + MES.new(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 - LOG.print(text.playedLong,'warn') + MES.new(text.playedLong) return true else - LOG.print(text.playedTooMuch,'warn') + MES.new(text.playedTooMuch) return false end end @@ -484,7 +484,7 @@ do--function resetGameData(args) end end else - LOG.print("Wrong task type",'warn') + MES.new("Wrong task type") end end BG.set(GAME.modeEnv.bg) @@ -574,8 +574,8 @@ do--function drawSelfProfile() --Draw avatar gc_setLineWidth(2) - gc_setColor(.3,.3,.3,.8)gc_rectangle('fill',-300,0,300,80) - gc_setColor(1,1,1)gc_rectangle('line',-300,0,300,80) + gc_setColor(.3,.3,.3,.8)gc_rectangle('fill',0,0,-300,80) + gc_setColor(1,1,1)gc_rectangle('line',0,0,-300,80) gc_rectangle('line',-73,7,66,66,2) gc_draw(selfAvatar,-72,8,nil,.5) diff --git a/parts/modes/blind_wtf.lua b/parts/modes/blind_wtf.lua index 71bd66cc..2c98cc21 100644 --- a/parts/modes/blind_wtf.lua +++ b/parts/modes/blind_wtf.lua @@ -16,7 +16,7 @@ return{ load=function() PLY.newPlayer(1) if SETTING.sfx_spawn==0 then - LOG.print(text.switchSpawnSFX,'warn') + MES.new(text.switchSpawnSFX) end end, mesDisp=function(P) diff --git a/parts/net.lua b/parts/net.lua index 241520b1..b4a27fad 100644 --- a/parts/net.lua +++ b/parts/net.lua @@ -78,7 +78,7 @@ local function _parse(res) if mesType[res.type]then return res else - LOG.print( + MES.new( "Error ws-mes type:"..( res.type and( res.reason and @@ -97,9 +97,9 @@ end local function _closeMessage(message) local mes=JSON.decode(message:sub(3)) if mes then - LOG.print(("%s [%s] %s"):format(text.wsClose,mes.type or"unknown type",mes.reason or""),'error') + MES.new(("%s [%s] %s"):format(text.wsClose,mes.type or"unknown type",mes.reason or"")) else - LOG.print(text.wsClose,'error') + MES.new(text.wsClose) end end @@ -122,7 +122,7 @@ local function pumpStream(d) if res then DATA.pumpRecording(stream,P.stream) else - LOG.print("Bad stream from "..P.username.."#"..P.uid,.2) + MES.new("Bad stream from "..P.username.."#"..P.uid,.2) end break 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'))}, }..'}}') - LOG.print("Uploading") + MES.new("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]}}') - LOG.print("Downloading") + MES.new("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 - LOG.print(text.versionNotMatch,1) + MES.new(text.versionNotMatch,1) end end @@ -414,22 +414,22 @@ function NET.updateWS_app() end end if VERSION.code0 then - LOG.print(text.ai_prebag,'warn') + MES.new(text.ai_prebag) return elseif #MISSION>0 then - LOG.print(text.ai_mission,'warn') + MES.new(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().."!") - LOG.print(text.exportSuccess,'message') + MES.new(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() - LOG.print(text.importSuccess,'message') + MES.new(text.importSuccess) do return end - ::THROW_fail::LOG.print(text.dataCorrupted,'error') + ::THROW_fail::MES.new(text.dataCorrupted) elseif key=="escape"then FILE.save(CUSTOMENV,'conf/customEnv','q') SCN.back() diff --git a/parts/scenes/custom_field.lua b/parts/scenes/custom_field.lua index ff4e9be1..1cb8ac92 100644 --- a/parts/scenes/custom_field.lua +++ b/parts/scenes/custom_field.lua @@ -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)) - LOG.print(text.exportSuccess,'message') + MES.new(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 - LOG.print(text.pasteWrongPlace,'warn') + MES.new(text.pasteWrongPlace) end str=str:sub(p+1) end if DATA.pasteBoard(str,page)then - LOG.print(text.importSuccess,'message') + MES.new(text.importSuccess) else - LOG.print(text.dataCorrupted,'error') + MES.new(text.dataCorrupted) end elseif key=="pageup"then page=max(page-1,1) diff --git a/parts/scenes/custom_mission.lua b/parts/scenes/custom_mission.lua index f1becb62..3cf1e80c 100644 --- a/parts/scenes/custom_mission.lua +++ b/parts/scenes/custom_mission.lua @@ -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,'message') + MES.new(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 - LOG.print(text.pasteWrongPlace,'warn') + MES.new(text.pasteWrongPlace) end str=str:sub(p+1) end if DATA.pasteMission(str)then - LOG.print(text.importSuccess,'message') + MES.new(text.importSuccess) cur=#MISSION else - LOG.print(text.dataCorrupted,'error') + MES.new(text.dataCorrupted) end elseif key=="escape"then SCN.back() diff --git a/parts/scenes/custom_sequence.lua b/parts/scenes/custom_sequence.lua index 1f0286ec..82456f7e 100644 --- a/parts/scenes/custom_sequence.lua +++ b/parts/scenes/custom_sequence.lua @@ -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,'message') + MES.new(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 - LOG.print(text.pasteWrongPlace,'warn') + MES.new(text.pasteWrongPlace) end str=str:sub(p+1) end if DATA.pasteSequence(str)then - LOG.print(text.importSuccess,'message') + MES.new(text.importSuccess) cur=#BAG else - LOG.print(text.dataCorrupted,'error') + MES.new(text.dataCorrupted) end elseif key=="escape"then SCN.back() diff --git a/parts/scenes/login.lua b/parts/scenes/login.lua index 364a1482..5e0b38b2 100644 --- a/parts/scenes/login.lua +++ b/parts/scenes/login.lua @@ -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,'warn')return + MES.new(text.wrongEmail)return elseif #password==0 then - LOG.print(text.noPassword,'warn')return + MES.new(text.noPassword)return end NET.wsconn_user_pswd(email,password) if savePW then diff --git a/parts/scenes/main.lua b/parts/scenes/main.lua index 643526a6..eb75b6df 100644 --- a/parts/scenes/main.lua +++ b/parts/scenes/main.lua @@ -67,7 +67,7 @@ function scene.keyDown(key) NET.tryLogin(false) else NET.wsconn_app() - LOG.print(text.wsConnecting,'message') + MES.new(text.wsConnecting) SFX.play('connect') end end diff --git a/parts/scenes/net_game.lua b/parts/scenes/net_game.lua index 0d594d05..1243277d 100644 --- a/parts/scenes/net_game.lua +++ b/parts/scenes/net_game.lua @@ -35,7 +35,7 @@ local function _quit() NET.signal_quit() else lastBackTime=TIME() - LOG.print(text.sureQuit,'warn') + MES.new(text.sureQuit) end end local function _switchChat() @@ -220,7 +220,7 @@ function scene.socketRead(cmd,d) resetGameData('n',NET.seed) netPLY.mouseMove(0,0) else - LOG.print("Redundant [Go]",'warn') + MES.new("Redundant [Go]") end elseif cmd=='finish'then playing=false diff --git a/parts/scenes/net_league.lua b/parts/scenes/net_league.lua index 239ee37d..37005136 100644 --- a/parts/scenes/net_league.lua +++ b/parts/scenes/net_league.lua @@ -16,7 +16,7 @@ function scene.draw() end scene.widgetList={ WIDGET.newKey{name="setting",fText=TEXTURE.setting,x=1200,y=160,w=90,h=90,code=goScene'setting_game'}, - WIDGET.newKey{name="match",x=640,y=500,w=760,h=140,font=60,code=function()LOG.print("Coming soon 开发中,敬请期待")end}, + WIDGET.newKey{name="match",x=640,y=500,w=760,h=140,font=60,code=function()MES.new("Coming soon 开发中,敬请期待")end}, WIDGET.newButton{name="back",x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene}, } diff --git a/parts/scenes/net_menu.lua b/parts/scenes/net_menu.lua index b0da57a0..e80915c4 100644 --- a/parts/scenes/net_menu.lua +++ b/parts/scenes/net_menu.lua @@ -18,7 +18,7 @@ end scene.widgetList={ WIDGET.newKey{name="setting",fText=TEXTURE.setting,x=1200,y=160,w=90,h=90,code=goScene'setting_game'}, WIDGET.newButton{name="league", x=640, y=180,w=350,h=120,font=40,color='D',code=goScene'net_league'}, - WIDGET.newButton{name="ffa", x=640, y=360,w=350,h=120,font=40,color='D',code=function()LOG.print("Coming soon 开发中,敬请期待")--[[NET.enterRoom({name="ffa"})]]end}, + WIDGET.newButton{name="ffa", x=640, y=360,w=350,h=120,font=40,color='D',code=function()MES.new("Coming soon 开发中,敬请期待")--[[NET.enterRoom({name="ffa"})]]end}, WIDGET.newButton{name="rooms", x=640, y=540,w=350,h=120,font=40,code=goScene'net_rooms'}, WIDGET.newButton{name="logout", x=880, y=40,w=180,h=60,color='dR', code=function() @@ -32,7 +32,7 @@ scene.widgetList={ SCN.back() end else - LOG.print(text.sureQuit,'warn') + MES.new(text.sureQuit) lastLogoutTime=TIME() end end}, diff --git a/parts/scenes/net_newRoom.lua b/parts/scenes/net_newRoom.lua index f4210c1b..5f1d2457 100644 --- a/parts/scenes/net_newRoom.lua +++ b/parts/scenes/net_newRoom.lua @@ -85,7 +85,7 @@ scene.widgetList={ ROOMENV.capacity=i WIDGET.active.capacity.color=COLOR.lY else - LOG.print("没有权限 Permission Denied",'warn') + MES.new("没有权限 Permission Denied") WIDGET.active.capacity.color=COLOR.R end end}, diff --git a/parts/scenes/net_rooms.lua b/parts/scenes/net_rooms.lua index 2544aba4..63fa7b4d 100644 --- a/parts/scenes/net_rooms.lua +++ b/parts/scenes/net_rooms.lua @@ -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 LOG.print("Version doesn't match",'message')return end - if R.private then LOG.print("Can't enter private room now",'message')return end + if R.roomInfo.version~=VERSION.short then MES.new("Version doesn't match")return end + if R.private then MES.new("Can't enter private room now")return end NET.enterRoom(R)--,password end end diff --git a/parts/scenes/register.lua b/parts/scenes/register.lua index 46527d86..6b5aa727 100644 --- a/parts/scenes/register.lua +++ b/parts/scenes/register.lua @@ -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,'warn')return + MES.new(text.noUsername)return elseif not STRING.simpEmailCheck(email)then - LOG.print(text.wrongEmail,'warn')return + MES.new(text.wrongEmail)return elseif #password==0 or #password2==0 then - LOG.print(text.noPassword,'warn')return + MES.new(text.noPassword)return elseif password~=password2 then - LOG.print(text.diffPassword,'warn')return + MES.new(text.diffPassword)return end NET.register(username,email,password) end diff --git a/parts/scenes/savedata.lua b/parts/scenes/savedata.lua index fda429f1..9c191fd5 100644 --- a/parts/scenes/savedata.lua +++ b/parts/scenes/savedata.lua @@ -2,7 +2,7 @@ local scene={} local function dumpCB(T) love.system.setClipboardText(STRING.packText(TABLE.dump(T))) - LOG.print(text.exportSuccess,'message') + MES.new(text.exportSuccess) end local function parseCB() local _ @@ -10,7 +10,7 @@ local function parseCB() --Decode s=STRING.unpackText(s) - if not s then LOG.print(text.dataCorrupted,'error')return end + if not s then MES.new(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') - LOG.print(text.importSuccess,'message') + MES.new(text.importSuccess) else - LOG.print(text.dataCorrupted,'warn') + MES.new(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') - LOG.print(text.importSuccess,'message') + MES.new(text.importSuccess) else - LOG.print(text.dataCorrupted,'warn') + MES.new(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') - LOG.print(text.importSuccess,'message') + MES.new(text.importSuccess) else - LOG.print(text.dataCorrupted,'warn') + MES.new(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') - LOG.print(text.importSuccess,'message') + MES.new(text.importSuccess) else - LOG.print(text.dataCorrupted,'warn') + MES.new(text.dataCorrupted) end end}, diff --git a/parts/scenes/setting_touch.lua b/parts/scenes/setting_touch.lua index 3abae973..880cb4b2 100644 --- a/parts/scenes/setting_touch.lua +++ b/parts/scenes/setting_touch.lua @@ -16,7 +16,7 @@ local function load1() if D then TABLE.update(D,VK_org) else - LOG.print(text.noFile,'message') + MES.new(text.noFile) end end local function save2() @@ -27,7 +27,7 @@ local function load2() if D then TABLE.update(D,VK_org) else - LOG.print(text.noFile,'message') + MES.new(text.noFile) end end @@ -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)) + MES.new(("==[ %d ]=="):format(defaultSetSelect)) defaultSetSelect=defaultSetSelect%5+1 selected=false end}, diff --git a/parts/scenes/test.lua b/parts/scenes/test.lua index 37393fb7..2872f4a5 100644 --- a/parts/scenes/test.lua +++ b/parts/scenes/test.lua @@ -35,7 +35,7 @@ function scene.keyDown(key) if backCounter==0 then SCN.back() else - LOG.print(backCounter) + MES.new(backCounter) end end end diff --git a/parts/skin.lua b/parts/skin.lua index d274e370..dde1b6f8 100644 --- a/parts/skin.lua +++ b/parts/skin.lua @@ -32,7 +32,7 @@ function SKIN.init(list) I=gc.newImage(N) else I=gc.newImage("media/image/skin/"..list[1]..".png") - LOG.print("No skin file: "..list[i],'warn') + MES.new("No skin file: "..list[i]) end gc.setDefaultFilter('linear','linear') for y=0,2 do