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},