From 06da149cff174961cdbbf19d1857f4e96e1f3baf Mon Sep 17 00:00:00 2001 From: Lythium4848 <62567544+Lythium4848@users.noreply.github.com> Date: Thu, 17 Aug 2023 00:19:08 +0100 Subject: [PATCH] Remove UI Sounds --- lua/autorun/sh_pixelui_loader.lua | 46 +------- lua/pixelui/core/cl_fonts.lua | 2 +- lua/pixelui/core/cl_scaling.lua | 1 + lua/pixelui/core/cl_sounds.lua | 67 ----------- lua/pixelui/core/themes/cl_theme.lua | 66 ----------- lua/pixelui/core/themes/cl_themes.lua | 104 ------------------ lua/pixelui/core/themes/sh_themes.lua | 23 ---- lua/pixelui/elements/cl_button.lua | 4 - lua/pixelui/elements/cl_combo_box.lua | 5 +- lua/pixelui/elements/cl_frame.lua | 1 - lua/pixelui/elements/cl_mini_sidebar.lua | 2 +- lua/pixelui/elements/cl_navbar.lua | 2 - lua/pixelui/elements/cl_sidebar.lua | 2 +- .../elements/cl_text_entry_internal.lua | 1 - 14 files changed, 7 insertions(+), 319 deletions(-) delete mode 100644 lua/pixelui/core/cl_sounds.lua delete mode 100644 lua/pixelui/core/themes/cl_theme.lua delete mode 100644 lua/pixelui/core/themes/cl_themes.lua delete mode 100644 lua/pixelui/core/themes/sh_themes.lua diff --git a/lua/autorun/sh_pixelui_loader.lua b/lua/autorun/sh_pixelui_loader.lua index e261ab9..83b3784 100644 --- a/lua/autorun/sh_pixelui_loader.lua +++ b/lua/autorun/sh_pixelui_loader.lua @@ -19,34 +19,6 @@ PIXEL = PIXEL or {} PIXEL.UI = PIXEL.UI or {} PIXEL.UI.Version = "2.0.0" -PIXEL.Themes = PIXEL.Themes or {} - -PIXEL.Themes["Dark"] = { - included = true, - Background = Color(29, 29, 29), - Header = Color(34, 34, 34), - SecondaryHeader = Color(47, 47, 47), - Scroller = Color(63, 63, 63), - PrimaryText = Color(255, 255, 255), - SecondaryText = Color(219, 219, 219), - DisabledText = Color(44, 44, 44), - Primary = Color(46, 83, 148), - Disabled = Color(178, 178, 178), - Positive = Color(0, 168, 107), - Negative = Color(234, 70, 70), - Diamond = Color(184, 242, 255), - Gold = Color(255, 214, 0), - Silver = Color(191, 191, 191), - Bronze = Color(144, 94, 52), - Transparent = Color(0, 0, 0, 0) -} - -PIXEL.Colors = PIXEL.Themes["Dark"] - -function PIXEL.Warn(...) - MsgC(PIXEL.Colors.Gold, "[PIXEL UI - Warning] ", PIXEL.Colors.Negative, ..., "\n") -end - function PIXEL.LoadDirectory(path) local files, folders = file.Find(path .. "/*", "LUA") @@ -84,20 +56,6 @@ end PIXEL.LoadDirectoryRecursive("pixelui") hook.Run("PIXEL.UI.FullyLoaded") -if CLIENT then return end -resource.AddWorkshop("2825396224") - -hook.Add("Think", "PIXEL.UI.VersionChecker", function() - hook.Remove("Think", "PIXEL.UI.VersionChecker") - - http.Fetch("https://raw.githubusercontent.com/Pulsar-Dev/pixel-ui/master/VERSION", function(body) - if PIXEL.UI.Version ~= string.Trim(body) then - local red = Color(192, 27, 27) - MsgC(red, "[PIXEL UI] There is an update available, please download it at: https://github.com/Pulsar-Dev/pixel-ui/releases/latest\n") - MsgC(red, "\nYour version: " .. PIXEL.UI.Version .. "\n") - MsgC(red, "New version: " .. body .. "\n") - return - end - end) -end) +if CLIENT then return end +resource.AddWorkshop("2825396224") \ No newline at end of file diff --git a/lua/pixelui/core/cl_fonts.lua b/lua/pixelui/core/cl_fonts.lua index db6fea3..eb35a7e 100644 --- a/lua/pixelui/core/cl_fonts.lua +++ b/lua/pixelui/core/cl_fonts.lua @@ -61,7 +61,7 @@ do weight = weight or 700 PIXEL.Fonts = PIXEL.Fonts or {} fontName = name or "PIXEL.Font.Size" .. size - font = font or "Open Sans Bold" + font = font or "Rubik" if !PIXEL.Fonts[fontName] or PIXEL.Fonts[fontName].size != size or PIXEL.Fonts[fontName].weight != weight then PIXEL.Fonts[fontName] = { diff --git a/lua/pixelui/core/cl_scaling.lua b/lua/pixelui/core/cl_scaling.lua index d29236c..1b1cf7c 100644 --- a/lua/pixelui/core/cl_scaling.lua +++ b/lua/pixelui/core/cl_scaling.lua @@ -20,6 +20,7 @@ local max = math.max function PIXEL.Scale(value) return max(value * (scrH() / 1080), 1) end + function PIXEL.Scale1440(value) return max(value * (scrH() / 1440), 1) end diff --git a/lua/pixelui/core/cl_sounds.lua b/lua/pixelui/core/cl_sounds.lua deleted file mode 100644 index e93b0fc..0000000 --- a/lua/pixelui/core/cl_sounds.lua +++ /dev/null @@ -1,67 +0,0 @@ -PIXEL = PIXEL or {} -do - function PIXEL.PlaySound(type, sound) - if PIXEL.DisableUISounds then return end - local soundPath = "pixelui-sounds/" .. type .. "/" .. sound .. ".mp3" - - if not file.Exists("sound/" .. soundPath, "GAME") then return end - - surface.PlaySound(soundPath) - end - - local buttonSounds = { - [1] = "Button_4", - [2] = "Button_5", - } - - function PIXEL.PlayButtonSound() - local randSound = math.random(1, 2) - PIXEL.PlaySound("buttons-navigation", buttonSounds[randSound]) - end - - function PIXEL.PlayKeyType() - PIXEL.PlayButtonSound() - end - - function PIXEL.PlayExpand(type) - if type == "open" then - PIXEL.PlaySound("buttons-navigation", "Expand") - else - PIXEL.PlaySound("buttons-navigation", "Collapse") - end - end - - function PIXEL.PlayNotify() - PIXEL.PlaySound("notifications-alerts", "Alert_2") - end - - local tabSounds = { - [1] = "Tab_1", - [2] = "Tab_2", - [3] = "Tab_3" - } - - function PIXEL.PlayChangeTab() - local randSound = math.random(1, 3) - PIXEL.PlaySound("buttons-navigation", tabSounds[randSound]) - end - - function PIXEL.PlayCancel() - PIXEL.PlaySound("errors-cancel", "Cancel_2") - end - - function PIXEL.PlayError(num) - if not num then num = 1 end - PIXEL.PlaySound("errors-cancel", "Error_" .. num) - end - - function PIXEL.PlayComplete(num) - if not num then num = 1 end - PIXEL.PlaySound("complete-success", "Complete_" .. num) - end - - function PIXEL.PlaySuccess(num) - if not num then num = 1 end - PIXEL.PlaySound("complete-success", "Success_" .. num) - end -end \ No newline at end of file diff --git a/lua/pixelui/core/themes/cl_theme.lua b/lua/pixelui/core/themes/cl_theme.lua deleted file mode 100644 index 0eabf2e..0000000 --- a/lua/pixelui/core/themes/cl_theme.lua +++ /dev/null @@ -1,66 +0,0 @@ -if not file.Exists("pixel/themes/", "DATA") then - file.CreateDir("pixel/themes/") -end - -function PIXEL.SetTheme(theme, cross) - if not cross then - local ip = game.GetIPAddress() - ip = ip:gsub(":", "-") - ip = string.Replace(ip, ".", "_") - - file.CreateDir("pixel/themes/" .. ip .. "/") - file.Write("pixel/themes/" .. ip .. "/theme.txt", theme) - else - file.Write("pixel/themes/theme.txt", theme) - end - - if PIXEL.Themes[theme] then - PIXEL.Colors = PIXEL.Themes[theme] - local ply = LocalPlayer() - ply.PIXELTheme = theme - else - PIXEL.Colors = PIXEL.Themes["Dark"] - return false - end -end - -local function setJoinTheme() - local ply = LocalPlayer() - local ip = game.GetIPAddress() - ip = ip:gsub(":", "-") - ip = string.Replace(ip, ".", "_") - if file.Exists("pixel/themes/" .. ip .. "/theme.txt", "DATA") then - local theme = file.Read("pixel/themes/" .. ip .. "/theme.txt", "DATA") - if theme == "" then theme = "Dark" end - if not PIXEL.Themes[theme] then - ply.PIXELTheme = "Dark" - PIXEL.Colors = PIXEL.Themes["Dark"] - return - end - - PIXEL.Colors = PIXEL.Themes[theme] - ply.PIXELTheme = theme - return - end - - if not file.Exists("pixel/themes/theme.txt", "DATA") then return end - - local theme = file.Read("pixel/theme.txt", "DATA") - if theme == "" then theme = "Dark" end - if not PIXEL.Themes[theme] then - ply.PIXELTheme = "Dark" - PIXEL.Colors = PIXEL.Themes["Dark"] - return - end - - PIXEL.Colors = PIXEL.Themes[theme] - ply.PIXELTheme = theme -end - -hook.Add("InitPostEntity", "PIXELUI.LoadTheme", function() - setJoinTheme() -end) - -concommand.Add("pixel_reset_theme", function(ply, cmd, args) - PIXEL.Colors = PIXEL.Themes["Dark"] -end) \ No newline at end of file diff --git a/lua/pixelui/core/themes/cl_themes.lua b/lua/pixelui/core/themes/cl_themes.lua deleted file mode 100644 index ed4b88b..0000000 --- a/lua/pixelui/core/themes/cl_themes.lua +++ /dev/null @@ -1,104 +0,0 @@ -PIXEL = PIXEL or {} -PIXEL.Themes = PIXEL.Themes or {} - -PIXEL.DefaultThemes = PIXEL.DefaultThemes or {"Dark", "Light", "GitHubDark", "NightOwl", "DiscordDark", "DiscordLight"} - -PIXEL.Themes["Light"] = { - included = true, - Background = PIXEL.HexToColor("#F7F8FA"), - Header = PIXEL.HexToColor("#edf1f5"), - SecondaryHeader = PIXEL.HexToColor("#DFE1E4"), - Scroller = PIXEL.HexToColor("#edf1f5"), - PrimaryText = PIXEL.HexToColor("#292D31"), - SecondaryText = PIXEL.HexToColor("#808080"), - DisabledText = PIXEL.HexToColor("#9ba0a3"), - Primary = Color(2, 153, 204), - Disabled = PIXEL.HexToColor("#9ba0a3"), - Positive = PIXEL.HexToColor("#79CB60"), - Negative = PIXEL.HexToColor("#d73a49"), - Diamond = Color(185, 242, 255), - Gold = Color(255, 215, 0), - Silver = Color(192, 192, 192), - Bronze = Color(145, 94, 49), - Transparent = Color(0, 0, 0, 0) -} - -PIXEL.Themes["GitHubDark"] = { - included = true, - Background = PIXEL.HexToColor("#24292e"), - Header = PIXEL.HexToColor("#2f363d"), - SecondaryHeader = PIXEL.HexToColor("#2b3036"), - Scroller = PIXEL.HexToColor("#2f363d"), - PrimaryText = Color(255, 255, 255), - SecondaryText = PIXEL.HexToColor("#c9d1d9"), - DisabledText = PIXEL.HexToColor("#39414a"), - Primary = Color(2, 153, 204), - Disabled = PIXEL.HexToColor("#6a737d"), - Positive = PIXEL.HexToColor("#85e89d"), - Negative = PIXEL.HexToColor("#f97583"), - Diamond = Color(185, 242, 255), - Gold = Color(255, 215, 0), - Silver = Color(192, 192, 192), - Bronze = Color(145, 94, 49), - Transparent = Color(0, 0, 0, 0) -} - -PIXEL.Themes["NightOwl"] = { - included = true, - Background = PIXEL.HexToColor("#011627"), -- Background - Header = PIXEL.HexToColor("#0b2942"), -- Seccond Background - SecondaryHeader = PIXEL.HexToColor("#13344f"), -- Active - Scroller = PIXEL.HexToColor("#0b2942"), -- Seccond Background - PrimaryText = PIXEL.HexToColor("#FBFBFB"), -- Text - SecondaryText = PIXEL.HexToColor("#d9d9d9"), -- Buttons - DisabledText = PIXEL.HexToColor("#697098"), -- Disabled - Primary = Color(2, 153, 204), - Disabled = PIXEL.HexToColor("#697098"), -- Disabled - Positive = PIXEL.HexToColor("#addb67"), -- Green - Negative = PIXEL.HexToColor("#ff6363"), -- Red - Diamond = Color(185, 242, 255), - Gold = Color(255, 215, 0), - Silver = Color(192, 192, 192), - Bronze = Color(145, 94, 49), - Transparent = Color(0, 0, 0, 0) -} - -PIXEL.Themes["DiscordDark"] = { - included = true, - Background = Color(54, 57, 63), - Header = Color(47, 49, 54), - SecondaryHeader = Color(51, 54, 59), - Scroller = Color(32, 34, 37), - PrimaryText = Color(255, 255, 255), - SecondaryText = Color(185, 187, 190), - DisabledText = Color(40, 40, 40), - Primary = Color(2, 153, 204), - Disabled = Color(114, 118, 125), - Positive = Color(87, 242, 135), - Negative = Color(237, 66, 69), - Diamond = Color(185, 242, 255), - Gold = Color(255, 215, 0), - Silver = Color(192, 192, 192), - Bronze = Color(145, 94, 49), - Transparent = Color(0, 0, 0, 0) -} - -PIXEL.Themes["DiscordLight"] = { - included = true, - Background = Color(255, 255, 255), - Header = Color(242, 243, 245), - SecondaryHeader = Color(220, 223, 227), - Scroller = Color(204, 204, 204), - PrimaryText = Color(6, 6, 7), - SecondaryText = Color(79, 86, 96), - DisabledText = Color(79, 86, 96), - Primary = Color(2, 153, 204), - Disabled = Color(79, 86, 96), - Positive = Color(87, 242, 135), - Negative = Color(237, 66, 69), - Diamond = Color(185, 242, 255), - Gold = Color(255, 215, 0), - Silver = Color(192, 192, 192), - Bronze = Color(145, 94, 49), - Transparent = Color(0, 0, 0, 0) -} \ No newline at end of file diff --git a/lua/pixelui/core/themes/sh_themes.lua b/lua/pixelui/core/themes/sh_themes.lua deleted file mode 100644 index bd03b73..0000000 --- a/lua/pixelui/core/themes/sh_themes.lua +++ /dev/null @@ -1,23 +0,0 @@ -PIXEL.Colors = { - Background = Color(31, 31, 31), - Header = Color(40, 41, 42), - SecondaryHeader = Color(35, 37, 39), - Scroller = Color(61, 61, 61), - Outline = Color(55, 56, 57), - -- - PrimaryText = Color(255, 255, 255), - SecondaryText = Color(220, 220, 220), - DisabledText = Color(40, 40, 40), - -- - Primary = Color(66, 133, 244), - -- - Disabled = Color(180, 180, 180), - Positive = Color(68, 235, 124), - Negative = Color(179, 38, 30), - -- - Diamond = Color(185, 242, 255), - Gold = Color(255, 215, 0), - Silver = Color(192, 192, 192), - Bronze = Color(145, 94, 49), - Transparent = Color(0, 0, 0, 0) -} \ No newline at end of file diff --git a/lua/pixelui/elements/cl_button.lua b/lua/pixelui/elements/cl_button.lua index 121406d..26ebf82 100644 --- a/lua/pixelui/elements/cl_button.lua +++ b/lua/pixelui/elements/cl_button.lua @@ -54,10 +54,6 @@ local localPly function PANEL:OnMousePressed(mouseCode) if not self:IsEnabled() then return end - if self:GetSounds() then - PIXEL.PlayButtonSound() - end - if not localPly then localPly = LocalPlayer() end diff --git a/lua/pixelui/elements/cl_combo_box.lua b/lua/pixelui/elements/cl_combo_box.lua index 209e8e7..6b6b49a 100644 --- a/lua/pixelui/elements/cl_combo_box.lua +++ b/lua/pixelui/elements/cl_combo_box.lua @@ -156,7 +156,6 @@ end function PANEL:OpenMenu(pControlOpener) if pControlOpener and pControlOpener == self.TextEntry then return end if #self.Choices == 0 then return end - PIXEL.PlayExpand("open") self:OnOpen() if IsValid(self.Menu) then @@ -198,9 +197,7 @@ function PANEL:OpenMenu(pControlOpener) self.Menu.OnRemove = function(s) if not IsValid(self) then return end - PIXEL.PlayExpand("close") - self:OnClose() - PIXEL.PlayExpand("close") + self:OnClose() self:SetToggle(false) end diff --git a/lua/pixelui/elements/cl_frame.lua b/lua/pixelui/elements/cl_frame.lua index 841f12d..532b053 100644 --- a/lua/pixelui/elements/cl_frame.lua +++ b/lua/pixelui/elements/cl_frame.lua @@ -224,7 +224,6 @@ function PANEL:LayoutContent(w, h) end function PANEL:Open() - PIXEL.PlayButtonSound() self:SetVisible(false) self:SetAlpha(0) self:SetVisible(true) diff --git a/lua/pixelui/elements/cl_mini_sidebar.lua b/lua/pixelui/elements/cl_mini_sidebar.lua index d18151c..2370137 100644 --- a/lua/pixelui/elements/cl_mini_sidebar.lua +++ b/lua/pixelui/elements/cl_mini_sidebar.lua @@ -123,7 +123,7 @@ end function PANEL:SelectItem(id) local item = self.Items[id] if not item then return end - PIXEL.PlayChangeTab() + if self.SelectedItem and self.SelectedItem == id then return end self.SelectedItem = id diff --git a/lua/pixelui/elements/cl_navbar.lua b/lua/pixelui/elements/cl_navbar.lua index 33e5512..d075eba 100644 --- a/lua/pixelui/elements/cl_navbar.lua +++ b/lua/pixelui/elements/cl_navbar.lua @@ -115,12 +115,10 @@ end function PANEL:SelectItem(id) local item = self.Items[id] if not item then return end - PIXEL.PlayChangeTab() if self.SelectedItem and self.SelectedItem == id then return end item:SetSelected(false) self.SelectedItem = id - PIXEL.PlayChangeTab() for k, v in pairs(self.Items) do v:SetToggle(false) diff --git a/lua/pixelui/elements/cl_sidebar.lua b/lua/pixelui/elements/cl_sidebar.lua index 6359aa9..eaa5862 100644 --- a/lua/pixelui/elements/cl_sidebar.lua +++ b/lua/pixelui/elements/cl_sidebar.lua @@ -128,7 +128,7 @@ end function PANEL:SelectItem(id) local item = self.Items[id] if not item then return end - PIXEL.PlayChangeTab() + if self.SelectedItem and self.SelectedItem == id then return end self.SelectedItem = id diff --git a/lua/pixelui/elements/cl_text_entry_internal.lua b/lua/pixelui/elements/cl_text_entry_internal.lua index 156e1ae..8ed5d48 100644 --- a/lua/pixelui/elements/cl_text_entry_internal.lua +++ b/lua/pixelui/elements/cl_text_entry_internal.lua @@ -145,7 +145,6 @@ function PANEL:UpdateFromMenu() end function PANEL:OnTextChanged(noMenuRemoval) - PIXEL.PlayKeyType() self.HistoryPos = 0 if self:GetUpdateOnType() then