From ede5426a098adb934e6e23caf425bbfbe92dcfb3 Mon Sep 17 00:00:00 2001 From: MrZ_26 <1046101471@qq.com> Date: Wed, 7 Aug 2024 12:53:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E5=90=AF=E7=94=A8=E5=85=AC?= =?UTF-8?q?=E5=91=8A=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/net.lua | 28 ++++++++++++++++++++++++---- parts/scenes/load.lua | 1 + parts/scenes/main.lua | 5 ++--- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/parts/net.lua b/parts/net.lua index 8b67f308e..9c29336e2 100644 --- a/parts/net.lua +++ b/parts/net.lua @@ -187,16 +187,36 @@ function NET.getAvatar(uid) end end) end -function NET.getNotice(lang,count) + +function NET.launchNotice() + local lang=SETTING.locale:find('zh') and 'zh_cn' or 'en_us' + TASK.new(function() + local res=getMsg({ + pool='getNotice', + path='/techmino/api/v1/notice?language='..lang..'&lastCount=1', + },6.26) + + if res and res.code==200 then + local opt=res.data.contents[1] + if opt then + MES.new('info',opt.content) + else + MES.new('info',text.Techrater.NoticeManager.noticeNotFound) + end + end + end) +end +function NET.getNotice(count) + local lang=SETTING.locale:find('zh') and 'zh_cn' or 'en_us' WAIT{timeout=6.26} TASK.new(function() local res=getMsg({ pool='getNotice', - path='/techmino/api/v1/notice?language='..(lang or 'zh_cn')..'&lastCount='..(count or 5), + path='/techmino/api/v1/notice?language='..lang..'&lastCount='..(count or 5), },6.26) - if res and res.code==200 and type(res.data)=='string' then - local dataStr="" + if res and res.code==200 then + local dataStr=TABLE.dump(res.data) SCN.go('notice',nil,dataStr) end end) diff --git a/parts/scenes/load.lua b/parts/scenes/load.lua index c82a67be8..5bb9d895b 100644 --- a/parts/scenes/load.lua +++ b/parts/scenes/load.lua @@ -193,6 +193,7 @@ function scene.enter() maxProgress=10 t1,t2=0,0-- Timer animeType={} for i=1,#SVG_TITLE_FILL do animeType[i]=math.random(#titleTransform) end-- Random animation type + NET.launchNotice() end function scene.leave() SCN.go('quit','none') diff --git a/parts/scenes/main.lua b/parts/scenes/main.lua index 2f692ccb8..b90567bc4 100644 --- a/parts/scenes/main.lua +++ b/parts/scenes/main.lua @@ -104,8 +104,7 @@ function scene.keyDown(key,isRep) end elseif key=='3' then if _testButton(10) then - MES.new('warn',text.notFinished) - -- NET.getNotice() + NET.getNotice() end elseif key=='4' then if _testButton(11) then @@ -221,7 +220,7 @@ scene.widgetList={ WIDGET.newButton{name='replays',x=2480,y=570,w=800,h=100, color='lC',font=40,align='L',edge=30,code=pressKey','}, WIDGET.newButton{name='music', x=90,y=80,w=100, color='lY',code=pressKey'2',font=70,fText=CHAR.icon.music}, - WIDGET.newButton{name='notice', x=210,y=80,w=100, color='D',code=pressKey'3',font=70,fText=CHAR.key.winMenu}, + WIDGET.newButton{name='notice', x=210,y=80,w=100, color='lG',code=pressKey'3',font=70,fText=CHAR.key.winMenu}, WIDGET.newButton{name='lang', x=330,y=80,w=100, color='lN',code=pressKey'4',font=70,fText=CHAR.icon.language}, WIDGET.newButton{name='about', x=-110,y=670,w=600,h=70, color='lB',align='R',edge=20,code=pressKey'x',font=50,fText=CHAR.icon.info}, WIDGET.newButton{name='manual', x=1390,y=670,w=600,h=70, color='lR',align='L',edge=20,code=pressKey'm',font=50,fText=CHAR.icon.help},