增加刷新房间的动画提示
This commit is contained in:
@@ -106,7 +106,6 @@ return{
|
|||||||
chatStart="------Beginning of log------",
|
chatStart="------Beginning of log------",
|
||||||
chatHistory="------New messages below------",
|
chatHistory="------New messages below------",
|
||||||
|
|
||||||
noRooms="Such emptiness much void, come back later?",
|
|
||||||
roomsCreateFailed="Failed to create room.",
|
roomsCreateFailed="Failed to create room.",
|
||||||
roomsFetchFailed="Failed to fetch room list.",
|
roomsFetchFailed="Failed to fetch room list.",
|
||||||
|
|
||||||
@@ -252,6 +251,8 @@ return{
|
|||||||
chat="Chat",
|
chat="Chat",
|
||||||
},
|
},
|
||||||
net_rooms={
|
net_rooms={
|
||||||
|
refreshing="Refreshing Rooms",
|
||||||
|
noRooms="Such emptiness much void, come back later?",
|
||||||
refresh="Refresh",
|
refresh="Refresh",
|
||||||
new="New Room",
|
new="New Room",
|
||||||
join="Join",
|
join="Join",
|
||||||
|
|||||||
@@ -107,7 +107,6 @@ return{
|
|||||||
chatStart="--------Début des logs--------",
|
chatStart="--------Début des logs--------",
|
||||||
chatHistory="-Nouveaux messages en dessous-",
|
chatHistory="-Nouveaux messages en dessous-",
|
||||||
|
|
||||||
noRooms="Aucun salon actuellement",
|
|
||||||
roomsCreateFailed="Echec de la création du salon",
|
roomsCreateFailed="Echec de la création du salon",
|
||||||
roomsFetchFailed="Echec de la récupération des salons",
|
roomsFetchFailed="Echec de la récupération des salons",
|
||||||
|
|
||||||
@@ -225,8 +224,9 @@ return{
|
|||||||
chat="Chat",
|
chat="Chat",
|
||||||
},
|
},
|
||||||
net_rooms={
|
net_rooms={
|
||||||
|
-- refreshing="Refreshing Rooms",
|
||||||
|
noRooms="Aucun salon actuellement",
|
||||||
-- refresh="Refresh",
|
-- refresh="Refresh",
|
||||||
new="Nouveau salon",
|
|
||||||
join="Rejoindre",
|
join="Rejoindre",
|
||||||
up="↑",
|
up="↑",
|
||||||
down="↓",
|
down="↓",
|
||||||
|
|||||||
@@ -106,7 +106,6 @@ return{
|
|||||||
chatStart="------Começo do log------",
|
chatStart="------Começo do log------",
|
||||||
chatHistory="------Novas mensagens abaixo------",
|
chatHistory="------Novas mensagens abaixo------",
|
||||||
|
|
||||||
noRooms="Nenhuma sala agora",
|
|
||||||
-- roomsCreateFailed="Failed to create room",
|
-- roomsCreateFailed="Failed to create room",
|
||||||
roomsFetchFailed="Falha ao buscar salas",
|
roomsFetchFailed="Falha ao buscar salas",
|
||||||
|
|
||||||
@@ -252,6 +251,8 @@ return{
|
|||||||
chat="Chat",
|
chat="Chat",
|
||||||
},
|
},
|
||||||
net_rooms={
|
net_rooms={
|
||||||
|
-- refreshing="Refreshing Rooms",
|
||||||
|
noRooms="Nenhuma sala agora",
|
||||||
-- refresh="Refresh",
|
-- refresh="Refresh",
|
||||||
-- new="New room",
|
-- new="New room",
|
||||||
-- join="Join",
|
-- join="Join",
|
||||||
|
|||||||
@@ -108,7 +108,6 @@ return{
|
|||||||
-- chatStart="------Beginning of log------",
|
-- chatStart="------Beginning of log------",
|
||||||
-- chatHistory="------New messages below------",
|
-- chatHistory="------New messages below------",
|
||||||
|
|
||||||
-- noRooms="No Rooms Now",
|
|
||||||
-- roomsCreateFailed="Failed to create room",
|
-- roomsCreateFailed="Failed to create room",
|
||||||
-- roomsFetchFailed="Failed to fetch rooms",
|
-- roomsFetchFailed="Failed to fetch rooms",
|
||||||
|
|
||||||
@@ -231,6 +230,8 @@ return{
|
|||||||
-- chat="Chat",
|
-- chat="Chat",
|
||||||
},
|
},
|
||||||
net_rooms={
|
net_rooms={
|
||||||
|
-- refreshing="Refreshing Rooms",
|
||||||
|
-- noRooms="No Rooms Now",
|
||||||
-- refresh="Refresh",
|
-- refresh="Refresh",
|
||||||
-- new="New room",
|
-- new="New room",
|
||||||
-- join="Join",
|
-- join="Join",
|
||||||
|
|||||||
@@ -106,7 +106,6 @@ return{
|
|||||||
chatStart="------消息的开头------",
|
chatStart="------消息的开头------",
|
||||||
chatHistory="------以上是历史消息------",
|
chatHistory="------以上是历史消息------",
|
||||||
|
|
||||||
noRooms="一个房间都没有哎...",
|
|
||||||
roomsCreateFailed="创建房间失败",
|
roomsCreateFailed="创建房间失败",
|
||||||
roomsFetchFailed="拉取房间列表失败",
|
roomsFetchFailed="拉取房间列表失败",
|
||||||
|
|
||||||
@@ -252,6 +251,8 @@ return{
|
|||||||
chat="聊天室",
|
chat="聊天室",
|
||||||
},
|
},
|
||||||
net_rooms={
|
net_rooms={
|
||||||
|
refreshing="刷新房间列表中",
|
||||||
|
noRooms="一个房间都没有哎...",
|
||||||
refresh="刷新",
|
refresh="刷新",
|
||||||
new="创建房间",
|
new="创建房间",
|
||||||
join="加入",
|
join="加入",
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ local min=math.min
|
|||||||
|
|
||||||
local NET=NET
|
local NET=NET
|
||||||
local scrollPos,selected
|
local scrollPos,selected
|
||||||
local lastFetchTime
|
local fetchTimer
|
||||||
local lastCreateRoomTime=0
|
local lastCreateRoomTime=0
|
||||||
|
|
||||||
local function fetchRoom()
|
local function fetchRoom()
|
||||||
lastFetchTime=TIME()
|
fetchTimer=5
|
||||||
NET.fetchRoom()
|
NET.fetchRoom()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ function scene.wheelMoved(_,y)
|
|||||||
end
|
end
|
||||||
function scene.keyDown(k)
|
function scene.keyDown(k)
|
||||||
if k=="r"then
|
if k=="r"then
|
||||||
if TIME()-lastFetchTime>1 then
|
if fetchTimer<=0 then
|
||||||
fetchRoom()
|
fetchRoom()
|
||||||
end
|
end
|
||||||
elseif k=="n"then
|
elseif k=="n"then
|
||||||
@@ -63,16 +63,19 @@ function scene.keyDown(k)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.update()
|
function scene.update(dt)
|
||||||
if TIME()-lastFetchTime>5 then
|
if not NET.getLock("fetchRoom")then
|
||||||
fetchRoom()
|
fetchTimer=fetchTimer-dt
|
||||||
|
if fetchTimer<=0 then
|
||||||
|
fetchRoom()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.draw()
|
function scene.draw()
|
||||||
--Fetching timer
|
--Fetching timer
|
||||||
gc.setColor(1,1,1,.26)
|
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
|
--Room list
|
||||||
gc.setColor(1,1,1)
|
gc.setColor(1,1,1)
|
||||||
@@ -95,16 +98,12 @@ function scene.draw()
|
|||||||
gc.printf(R.type,500,66+40*i,500,"right")
|
gc.printf(R.type,500,66+40*i,500,"right")
|
||||||
gc.print(R.count.."/"..R.capacity,1050,66+40*i)
|
gc.print(R.count.."/"..R.capacity,1050,66+40*i)
|
||||||
end
|
end
|
||||||
|
|
||||||
--No room message
|
|
||||||
if #NET.roomList==0 then
|
|
||||||
setFont(60)
|
|
||||||
mStr(text.noRooms,640,315)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
scene.widgetList={
|
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="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="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},
|
WIDGET.newKey{name="up", x=840,y=585,w=140,h=70,font=40,code=pressKey"up", hide=function()return #NET.roomList==0 end},
|
||||||
|
|||||||
Reference in New Issue
Block a user