From f7137b1ad04a090095f3878217c4a2dd5eb6a83a Mon Sep 17 00:00:00 2001 From: Barinade Date: Mon, 14 Oct 2024 01:26:49 -0500 Subject: [PATCH] rebirth add multi user list --- .../ScreenNetRoom overlay/default.lua | 2 + .../ScreenNetRoom overlay/lobbyuserlist.lua | 77 +++++++++++++ .../ScreenSelectMusic overlay/default.lua | 9 +- .../multiuserlist.lua | 106 ++++++++++++++++++ Themes/Rebirth/Scripts/01 color_config.lua | 8 ++ 5 files changed, 200 insertions(+), 2 deletions(-) create mode 100644 Themes/Rebirth/BGAnimations/ScreenNetRoom overlay/lobbyuserlist.lua create mode 100644 Themes/Rebirth/BGAnimations/ScreenSelectMusic overlay/multiuserlist.lua diff --git a/Themes/Rebirth/BGAnimations/ScreenNetRoom overlay/default.lua b/Themes/Rebirth/BGAnimations/ScreenNetRoom overlay/default.lua index 7353a25577..bc39adf24f 100644 --- a/Themes/Rebirth/BGAnimations/ScreenNetRoom overlay/default.lua +++ b/Themes/Rebirth/BGAnimations/ScreenNetRoom overlay/default.lua @@ -253,6 +253,8 @@ t[#t+1] = Def.ActorFrame { t[#t+1] = makeroomlist() +t[#t+1] = LoadActor("lobbyuserlist") + t[#t+1] = LoadActor("../_mouse.lua") return t \ No newline at end of file diff --git a/Themes/Rebirth/BGAnimations/ScreenNetRoom overlay/lobbyuserlist.lua b/Themes/Rebirth/BGAnimations/ScreenNetRoom overlay/lobbyuserlist.lua new file mode 100644 index 0000000000..3dc562c9c1 --- /dev/null +++ b/Themes/Rebirth/BGAnimations/ScreenNetRoom overlay/lobbyuserlist.lua @@ -0,0 +1,77 @@ +local usersZoom = 0.7 +local usersWidth = 70 +local usersWidthSmall = 32 +local usersWidthZoom = usersWidth * (1 / usersZoom) +local usersWidthSmallZoom = usersWidthSmall * (1 / usersZoom) +local usersRowSize = 10 +local usersRowSizeSmall = 20 +local usersX = 15 +local usersY = SCREEN_TOP + 66 +local usersXGap = 7 +local usersYGap = 15 +local usersHeight = 8 + +local lobbos +local top = SCREENMAN:GetTopScreen() +local posit = COLORS:getColor("multiplayer", "UserInLobby") +local r = Def.ActorFrame { + BeginCommand = function(self) + self:queuecommand("Set") + end, + InitCommand = function(self) + self:queuecommand("Set") + end, + SetCommand = function(self) + top = SCREENMAN:GetTopScreen() + lobbos = NSMAN:GetLobbyUserList() + end, + UsersUpdateMessageCommand = function(self) + self:queuecommand("Set") + end +} + +local function userLabel(i) + local aux = LoadFont("Common Normal") .. { + Name = i, + BeginCommand = function(self) + self:halign(0) + self:zoom(usersZoom):diffuse(posit):queuecommand("Set") + end, + SetCommand = function(self) + if SCREENMAN:GetTopScreen():GetName() ~= "ScreenNetRoom" then + return + end + local num = self:GetName() + 0 + if num <= #lobbos then + self:settext(lobbos[num]) + else + self:settext("") + end + if #lobbos < 21 then + self:x(usersX + (usersWidth + usersXGap) * ((i-1) % usersRowSize)) + self:y(usersY + math.floor((i-1) / usersRowSize) * (usersHeight + usersYGap)) + self:maxwidth(usersWidthZoom) + else + self:x(usersX + (usersWidthSmall + usersXGap/2) * ((i-1) % usersRowSizeSmall)) + self:y(usersY + math.floor((i-1) / usersRowSizeSmall) * (usersHeight + usersYGap)) + 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, 64 do + r[#r + 1] = userLabel(i) +end + +return r diff --git a/Themes/Rebirth/BGAnimations/ScreenSelectMusic overlay/default.lua b/Themes/Rebirth/BGAnimations/ScreenSelectMusic overlay/default.lua index ca3f5cfc4d..cc5394f5ba 100644 --- a/Themes/Rebirth/BGAnimations/ScreenSelectMusic overlay/default.lua +++ b/Themes/Rebirth/BGAnimations/ScreenSelectMusic overlay/default.lua @@ -4,11 +4,16 @@ local t = Def.ActorFrame { end, } -t[#t+1] = LoadActor("../_mouse.lua") - -- header t[#t+1] = LoadActorWithParams("../playerInfoFrame/main.lua", {visualizer = themeConfig:get_data().global.ShowVisualizer, screen = "ScreenSelectMusic"}) updateDiscordStatusForMenus() updateNowPlaying() +local scnm = Var ("LoadingScreen") +if scnm ~= nil and scnm:find("Net") ~= nil then + t[#t+1] = LoadActor("multiuserlist") +end + +t[#t+1] = LoadActor("../_mouse.lua") + return t \ No newline at end of file diff --git a/Themes/Rebirth/BGAnimations/ScreenSelectMusic overlay/multiuserlist.lua b/Themes/Rebirth/BGAnimations/ScreenSelectMusic overlay/multiuserlist.lua new file mode 100644 index 0000000000..51318ae3a2 --- /dev/null +++ b/Themes/Rebirth/BGAnimations/ScreenSelectMusic overlay/multiuserlist.lua @@ -0,0 +1,106 @@ +local usersZoom = 0.7 +local usersWidth = 70 +local usersWidthSmall = 48 +local usersWidthZoom = usersWidth * (1 / usersZoom) +local usersWidthSmallZoom = usersWidthSmall * (1 / usersZoom) +local usersRowSize = 7 +local usersRowSizeSmall = 10 +local usersX = SCREEN_CENTER_X / 1.6 +local usersY = SCREEN_TOP + 15 +local usersXGap = 7 +local usersYGap = 15 +local usersHeight = 8 + +local top = SCREENMAN:GetTopScreen() +local qty = 0 +local posit = COLORS:getColor("multiplayer", "UserStatusInEval") +local negat = COLORS:getColor("multiplayer", "UserStatusNotReady") +local enable = COLORS:getColor("multiplayer", "UserStatusReady") +local disabled = COLORS:getColor("multiplayer", "UserStatusInGameplay") +local highlight = COLORS:getColor("multiplayer", "UserStatusInOptions") + +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 aux = LoadFont("Common Normal") .. { + Name = i, + BeginCommand = function(self) + self:halign(0) + self:zoom(usersZoom):diffuse(posit):queuecommand("Set") + end, + SetCommand = function(self) + if SCREENMAN:GetTopScreen():GetName() ~= "ScreenNetSelectMusic" then + return + end + local num = self:GetName() + 0 + qty = top:GetUserQty() + if num <= qty then + local str = "" + str = str .. top:GetUser(num) + self:settext(str) + local state = top:GetUserState(num) + if state == 3 then + -- eval + self:diffuse(posit) + elseif state == 2 then + -- playing + self:diffuse(disabled) + elseif state == 4 then + -- options + self:diffuse(highlight) + else -- 1 == can play + local ready = top:GetUserReady(num) + if ready then + self:diffuse(enable) + else + self:diffuse(negat) + end + end + else + self:settext("") + end + if qty < 8 then + self:x(usersX + (usersWidth + usersXGap) * ((i-1) % usersRowSize)) + self:y(usersY + 6.5) + self:maxwidth(usersWidthZoom) + elseif qty < 15 then + self:x(usersX + (usersWidth + usersXGap) * ((i-1) % usersRowSize)) + self:y(usersY + math.floor((i-1) / usersRowSize) * (usersHeight + usersYGap)) + self:maxwidth(usersWidthZoom) + else + self:x(usersX + (usersWidthSmall + usersXGap/3) * ((i-1) % usersRowSizeSmall)) + self:y(usersY + math.floor((i-1) / usersRowSizeSmall) * (usersHeight + usersYGap)) + 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 diff --git a/Themes/Rebirth/Scripts/01 color_config.lua b/Themes/Rebirth/Scripts/01 color_config.lua index dccd2d354b..e1678e13b3 100644 --- a/Themes/Rebirth/Scripts/01 color_config.lua +++ b/Themes/Rebirth/Scripts/01 color_config.lua @@ -11,6 +11,14 @@ local defaultConfig = { SeparationDivider = "#ffffff", -- also some accents like slider markers and text cursors SelectMusicBackground = "#000000", -- only used if single bg is on }, + multiplayer = { + UserStatusInEval = "#9645FD", + UserStatusNotReady = "#FF9999", + UserStatusReady = "#4CBB17", + UserStatusInGameplay = "#666666", + UserStatusInOptions = "#614080", + UserInLobby = "#614080", + }, leaderboard = { Background = "#111111", Border = "#000111",