Skip to content

Commit

Permalink
help nothing works
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Dec 1, 2018
1 parent 3bb4757 commit d338256
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 13 deletions.
Expand Up @@ -5,6 +5,7 @@ end
t[#t + 1] = LoadActor("profile")
t[#t + 1] = LoadActor("roomsearch")
t[#t + 1] = LoadActor("tabs")
t[#t + 1] = LoadActor("../_lobbyuserlist")

local g =
Def.ActorFrame {
Expand Down
102 changes: 102 additions & 0 deletions Themes/Til Death/BGAnimations/_lobbyuserlist.lua
@@ -0,0 +1,102 @@
local usersZoom = 0.45
local usersWidth = 50
local usersWidthSmall = 25
local usersWidthZoom = 50 * (1 / usersZoom)
local usersWidthSmallZoom = 25 * (1 / usersZoom)
local usersRowSize = 4
local usersX = SCREEN_WIDTH / 4
local usersY = SCREEN_TOP + 15
local usersHeight = 10

local top = SCREENMAN:GetTopScreen()
local qty = 0
local posit = getMainColor("positive")
local negat = getMainColor("negative")
local enable = getMainColor("enabled")
local r =
Def.ActorFrame {
BeginCommand = function(self)
self:queuecommand("Set")
end,
InitCommand = function(self)
self:queuecommand("Set")
end,
SetCommand = function(self)
top = SCREENMAN:GetTopScreen()
end,
UsersUpdateMessageCommand = function(self)
self:queuecommand("Set")
end
}

local function userLabel(i)
local x = 0
local y = 0
if i <= usersRowSize then
x = (usersX) + (i * usersWidth)
y = usersY + usersHeight
elseif i <= usersRowSize * 2 then
x = (usersX) + ((i - usersRowSize) * usersWidth)
y = usersY
elseif i <= usersRowSize * 3 then
x = (usersX) + ((i - usersRowSize * 2) * usersWidth) + usersWidthSmall
y = usersY + usersHeight
elseif i <= usersRowSize * 4 then
x = (usersX) + ((i - usersRowSize * 3) * usersWidth) + usersWidthSmall
y = usersY
elseif i <= usersRowSize * 5 then
x = (usersX) + (usersRowSize * usersWidth) + usersWidthSmall * (i - usersRowSize * 4)
y = usersY
else
x = (usersX) + (usersRowSize * usersWidth) + usersWidthSmall * (i - usersRowSize * 5)
y = usersY + usersHeight
end
local aux =
LoadFont("Common Normal") ..
{
Name = i,
BeginCommand = function(self)
self:xy(x, y):zoom(usersZoom):diffuse(posit):queuecommand("Set")
end,
SetCommand = function(self)
local num = self:GetName() + 0
lobbos = NSMAN:GetLobbyUserList()
qty = #lobbos
if num <= qty then
local str = ""
str = str .. top:GetUser(num)
self:settext(str)
if top:GetUserState(num) == 2 or top:GetUserState(num) == 1 then
self:diffuse(posit)
elseif top:GetUserState(num) == 4 then
self:diffuse(negat)
else
self:diffuse(enable)
end
else
self:settext("")
end
if qty < 9 then
self:maxwidth(usersWidthZoom)
else
self:maxwidth(usersWidthSmallZoom)
end
end,
PlayerJoinedMessageCommand = function(self)
self:queuecommand("Set")
end,
PlayerUnjoinedMessageCommand = function(self)
self:queuecommand("Set")
end,
UsersUpdateMessageCommand = function(self)
self:queuecommand("Set")
end
}
return aux
end

for i = 1, 32 do
r[#r + 1] = userLabel(i)
end

return r
28 changes: 15 additions & 13 deletions src/NetworkSyncManager.cpp
Expand Up @@ -954,6 +954,7 @@ ETTProtocol::Update(NetworkSyncManager* n, float fDeltaTime)
for (auto& user : removedUsers) {
NSMAN->lobbyuserlist.emplace_back(user.get<string>());
}
SCREENMAN->SendMessageToTopScreen(SM_UsersUpdate);
} break;
case ettps_roomlist: {
RoomData tmp;
Expand Down Expand Up @@ -999,7 +1000,7 @@ ETTProtocol::Update(NetworkSyncManager* n, float fDeltaTime)
}
}
}
SCREENMAN->SendMessageToTopScreen(SM_UsersUpdate);
SCREENMAN->SendMessageToTopScreen(SM_UsersUpdate);
} break;
}
} catch (exception e) {
Expand Down Expand Up @@ -1859,6 +1860,17 @@ LuaFunction(IsSMOnlineLoggedIn, NSMAN->loggedIn)
}
return 1;
}
static int GetLobbyUserList(T* p, lua_State* L)
{
lua_newtable(L);
int i = 1;
for (auto& user : NSMAN->lobbyuserlist) {
lua_pushstring(L, user.c_str());
lua_rawseti(L, -2, i);
i++;
}
return 1;
}
LunaNetworkSyncManager()
{
ADD_METHOD(GetEvalScores);
Expand All @@ -1870,6 +1882,7 @@ LuaFunction(IsSMOnlineLoggedIn, NSMAN->loggedIn)
ADD_METHOD(Logout);
ADD_METHOD(IsETTP);
ADD_METHOD(GetCurrentRoomName);
ADD_METHOD(GetLobbyUserList);
}
};

Expand All @@ -1893,21 +1906,10 @@ class LunaChartRequest : public Luna<ChartRequest>
lua_pushnumber(L, p->rate / 1000);
return 1;
}
static int GetLobbyUserList(T* p, lua_State* L)
{
lua_newtable(L);
int i = 1;
for (auto& user : NSMAN->lobbyuserlist) {
lua_pushstring(L, user.c_str());
lua_rawseti(L, -2, i);
i++;
}
return 1;
}

LunaChartRequest()
{
ADD_METHOD(GetChartkey);
ADD_METHOD(GetLobbyUserList);
ADD_METHOD(GetUser);
ADD_METHOD(GetRate);
}
Expand Down

0 comments on commit d338256

Please sign in to comment.