增加刷新房间的动画提示

This commit is contained in:
MrZ626
2021-03-30 15:22:50 +08:00
parent 23c0c63c6a
commit 4a9066b1cb
6 changed files with 23 additions and 20 deletions

View File

@@ -106,7 +106,6 @@ return{
chatStart="------Beginning of log------",
chatHistory="------New messages below------",
noRooms="Such emptiness much void, come back later?",
roomsCreateFailed="Failed to create room.",
roomsFetchFailed="Failed to fetch room list.",
@@ -252,6 +251,8 @@ return{
chat="Chat",
},
net_rooms={
refreshing="Refreshing Rooms",
noRooms="Such emptiness much void, come back later?",
refresh="Refresh",
new="New Room",
join="Join",

View File

@@ -107,7 +107,6 @@ return{
chatStart="--------Début des logs--------",
chatHistory="-Nouveaux messages en dessous-",
noRooms="Aucun salon actuellement",
roomsCreateFailed="Echec de la création du salon",
roomsFetchFailed="Echec de la récupération des salons",
@@ -225,8 +224,9 @@ return{
chat="Chat",
},
net_rooms={
-- refreshing="Refreshing Rooms",
noRooms="Aucun salon actuellement",
-- refresh="Refresh",
new="Nouveau salon",
join="Rejoindre",
up="",
down="",

View File

@@ -106,7 +106,6 @@ return{
chatStart="------Começo do log------",
chatHistory="------Novas mensagens abaixo------",
noRooms="Nenhuma sala agora",
-- roomsCreateFailed="Failed to create room",
roomsFetchFailed="Falha ao buscar salas",
@@ -252,6 +251,8 @@ return{
chat="Chat",
},
net_rooms={
-- refreshing="Refreshing Rooms",
noRooms="Nenhuma sala agora",
-- refresh="Refresh",
-- new="New room",
-- join="Join",

View File

@@ -108,7 +108,6 @@ return{
-- chatStart="------Beginning of log------",
-- chatHistory="------New messages below------",
-- noRooms="No Rooms Now",
-- roomsCreateFailed="Failed to create room",
-- roomsFetchFailed="Failed to fetch rooms",
@@ -231,6 +230,8 @@ return{
-- chat="Chat",
},
net_rooms={
-- refreshing="Refreshing Rooms",
-- noRooms="No Rooms Now",
-- refresh="Refresh",
-- new="New room",
-- join="Join",

View File

@@ -106,7 +106,6 @@ return{
chatStart="------消息的开头------",
chatHistory="------以上是历史消息------",
noRooms="一个房间都没有哎...",
roomsCreateFailed="创建房间失败",
roomsFetchFailed="拉取房间列表失败",
@@ -252,6 +251,8 @@ return{
chat="聊天室",
},
net_rooms={
refreshing="刷新房间列表中",
noRooms="一个房间都没有哎...",
refresh="刷新",
new="创建房间",
join="加入",

View File

@@ -3,11 +3,11 @@ local min=math.min
local NET=NET
local scrollPos,selected
local lastFetchTime
local fetchTimer
local lastCreateRoomTime=0
local function fetchRoom()
lastFetchTime=TIME()
fetchTimer=5
NET.fetchRoom()
end
@@ -25,7 +25,7 @@ function scene.wheelMoved(_,y)
end
function scene.keyDown(k)
if k=="r"then
if TIME()-lastFetchTime>1 then
if fetchTimer<=0 then
fetchRoom()
end
elseif k=="n"then
@@ -63,16 +63,19 @@ function scene.keyDown(k)
end
end
function scene.update()
if TIME()-lastFetchTime>5 then
fetchRoom()
function scene.update(dt)
if not NET.getLock("fetchRoom")then
fetchTimer=fetchTimer-dt
if fetchTimer<=0 then
fetchRoom()
end
end
end
function scene.draw()
--Fetching timer
gc.setColor(1,1,1,.26)
gc.arc("fill","pie",240,620,60,-1.5708,-1.5708+1.2566*(TIME()-lastFetchTime))
gc.arc("fill","pie",240,620,60,-1.5708,-1.5708-1.2566*fetchTimer)
--Room list
gc.setColor(1,1,1)
@@ -95,16 +98,12 @@ function scene.draw()
gc.printf(R.type,500,66+40*i,500,"right")
gc.print(R.count.."/"..R.capacity,1050,66+40*i)
end
--No room message
if #NET.roomList==0 then
setFont(60)
mStr(text.noRooms,640,315)
end
end
scene.widgetList={
WIDGET.newKey{name="refresh", x=240,y=620,w=140,h=140,font=40,code=fetchRoom, hide=function()return TIME()-lastFetchTime<1.26 end},
WIDGET.newText{name="refreshing",x=640,y=260,font=65,hide=function()return not NET.getLock("fetchRoom")end},
WIDGET.newText{name="noRoom", x=640,y=260,font=65,hide=function()return #NET.roomList>0 or NET.getLock("fetchRoom")end},
WIDGET.newKey{name="refresh", x=240,y=620,w=140,h=140,font=40,code=fetchRoom, hide=function()return fetchTimer>3.26 end},
WIDGET.newKey{name="new", x=440,y=620,w=140,h=140,font=25,code=pressKey"n"},
WIDGET.newKey{name="join", x=640,y=620,w=140,h=140,font=40,code=pressKey"return", hide=function()return #NET.roomList==0 end},
WIDGET.newKey{name="up", x=840,y=585,w=140,h=70,font=40,code=pressKey"up", hide=function()return #NET.roomList==0 end},