实现公告场景的功能

This commit is contained in:
MrZ_26
2024-08-07 13:25:03 +08:00
parent 59f390de93
commit de3e1fcdc7
2 changed files with 28 additions and 9 deletions

View File

@@ -2,8 +2,16 @@ local scene={}
function scene.enter()
BG.set('cubes')
if type(SCN.args[1])=='string' then
scene.widgetList.texts:setTexts(SCN.args[1])
local data=SCN.args[1]
if data then
local texts={}
for i=1,#data do
table.insert(texts,data[i].timestamp or "20??/??/??")
table.insert(texts,data[i].content)
table.insert(texts,"")
table.insert(texts,"——————————————————————————")
end
scene.widgetList.texts:setTexts(texts)
else
scene.widgetList.texts:setTexts({"No data"})
end
@@ -27,7 +35,7 @@ function scene.keyDown(key)
end
scene.widgetList={
WIDGET.newTextBox{name='texts',x=30,y=45,w=1000,h=640,font=20,fix=true},
WIDGET.newTextBox{name='texts',x=30,y=45,w=1000,h=640,font=25,fix=true,lineH=45},
WIDGET.newButton{name='back',x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene},
}