├── .gitattributes ├── LICENSE ├── README.md ├── RageUI ├── RMenu.lua ├── components │ ├── Audio.lua │ ├── Enum.lua │ ├── Keys.lua │ ├── Rectangle.lua │ ├── Sprite.lua │ ├── Text.lua │ └── Visual.lua ├── menu │ ├── Menu.lua │ ├── MenuController.lua │ ├── RageUI.lua │ ├── elements │ │ ├── ItemsBadge.lua │ │ ├── ItemsColour.lua │ │ └── PanelColour.lua │ ├── items │ │ ├── UIButton.lua │ │ ├── UICheckBox.lua │ │ ├── UIList.lua │ │ ├── UISeparator.lua │ │ ├── UISlider.lua │ │ ├── UISliderHeritage.lua │ │ └── UISliderProgress.lua │ ├── panels │ │ ├── UIBoutonPanel.lua │ │ ├── UIColourPanel.lua │ │ ├── UIGridPanel.lua │ │ ├── UIPercentagePanel.lua │ │ ├── UISpritPanel.lua │ │ └── UIStatisticsPanel.lua │ └── windows │ │ └── UIHeritage.lua └── stream │ └── RageUI_.ytd ├── animDictsCompact.json ├── client └── client.lua ├── config.lua ├── fxmanifest.lua └── server └── server.lua /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 mathu_lmn 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Description 📃 : 2 | 3 | 👋 Hey guys, I've always wanted to easily test the animations in FiveM and I never really found the script that fits the purpose, so I decided to make my own and today I'm releasing it for free! 4 | 5 | This script has been updated for gamebuild mp2023_01 / b2944 / San Andreas Mercenaries thanks to [TayMcKenzieNZ](https://github.com/TayMcKenzieNZ) for the pull request. 6 | 7 | Animations found by [DurtyFree](https://github.com/DurtyFree/gta-v-data-dumps) gta v data dumps. 8 | 9 | 10 | --- 11 | ## Usage 🛠️ : 12 | 13 | To use the resource, download it, put the `mth-animations` folder in your main resources folder. 14 | Add `start mth-animations` to your server.cfg. 15 | Then, once you're in game, use the command `/animations` to toggle the menu. 16 | 17 |
18 | 19 | ### Config.lua: 20 | > By changing this to `true` will make the `/animations` command only accessible for **server admins**. 21 | ```lua 22 | Config.AdminOnly = false 23 | ``` 24 | --- 25 | ## Features ✨ : 26 | * Accessible json file for all animations dict and names 27 | * Search button to specify what you're looking for 28 | * STANDALONE : this means that you don't need any dependencies to start this script on your server 29 | * Change permissions of the command 30 | * Up to date animations list 31 | * Easy to use 32 | 33 | --- 34 | 35 | *Demo 👀 :* 36 | 37 | 🎥 [Video](https://streamable.com/yfl6us): https://streamable.com/yfl6us 38 | 39 | 40 | Feel free to open an Issue or make a PR to help me improve this resource ! 41 | -------------------------------------------------------------------------------- /RageUI/RMenu.lua: -------------------------------------------------------------------------------- 1 | --- 2 | --- Generated by EmmyLua(https://github.com/EmmyLua) 3 | --- Created by Dylan Malandain. 4 | --- DateTime: 29/10/2019 02:40 5 | --- 6 | 7 | ---@class RageUI 8 | RageUI = {} 9 | 10 | ---@class Item 11 | RageUI.Item = {} 12 | 13 | ---@class Panel 14 | RageUI.Panel = {} 15 | 16 | ---@class Window 17 | RageUI.Window = {} 18 | 19 | ---@class RMenu 20 | RMenu = setmetatable({}, RMenu) 21 | 22 | ---@type table 23 | local TotalMenus = {} 24 | 25 | ---Add 26 | ---@param Type string 27 | ---@param Name string 28 | ---@param Menu table 29 | ---@return RMenu 30 | ---@public 31 | function RMenu.Add(Type, Name, Menu) 32 | if RMenu[Type] ~= nil then 33 | RMenu[Type][Name] = { 34 | Menu = Menu 35 | } 36 | else 37 | RMenu[Type] = {} 38 | RMenu[Type][Name] = { 39 | Menu = Menu 40 | } 41 | end 42 | return table.insert(TotalMenus, Menu) 43 | end 44 | 45 | ---Get 46 | ---@param Type string 47 | ---@param Name string 48 | ---@return table 49 | ---@public 50 | function RMenu:Get(Type, Name) 51 | if self[Type] ~= nil and self[Type][Name] ~= nil then 52 | return self[Type][Name].Menu 53 | end 54 | end 55 | 56 | ---GetType 57 | ---@param Type string 58 | ---@return table 59 | ---@public 60 | function RMenu:GetType(Type) 61 | if self[Type] ~= nil then 62 | return self[Type] 63 | end 64 | end 65 | 66 | ---Settings 67 | ---@param Type string 68 | ---@param Name string 69 | ---@param Settings string 70 | ---@param Value any optional 71 | ---@return void 72 | ---@public 73 | function RMenu:Settings(Type, Name, Settings, Value) 74 | if Value ~= nil then 75 | self[Type][Name][Settings] = Value 76 | else 77 | return self[Type][Name][Settings] 78 | end 79 | end 80 | 81 | ---Delete 82 | ---@param Type string 83 | ---@param Name string 84 | ---@return void 85 | ---@public 86 | function RMenu:Delete(Type, Name) 87 | self[Type][Name] = nil 88 | collectgarbage() 89 | end 90 | 91 | ---DeleteType 92 | ---@param Type string 93 | ---@return void 94 | ---@public 95 | function RMenu:DeleteType(Type) 96 | self[Type] = nil 97 | collectgarbage() 98 | end 99 | -------------------------------------------------------------------------------- /RageUI/components/Audio.lua: -------------------------------------------------------------------------------- 1 | --- 2 | --- Generated by EmmyLua(https://github.com/EmmyLua) 3 | --- Created by Dylan Malandain. 4 | --- DateTime: 24/07/2019 03:38 5 | --- 6 | 7 | 8 | ---PlaySound 9 | --- 10 | --- Reference : N/A 11 | --- 12 | ---@param Library string 13 | ---@param Sound string 14 | ---@param IsLooped boolean 15 | ---@return nil 16 | ---@public 17 | function RageUI.PlaySound(Library, Sound, IsLooped) 18 | local audioId 19 | if not IsLooped then 20 | PlaySoundFrontend(-1, Sound, Library, true) 21 | else 22 | if not audioId then 23 | Citizen.CreateThread(function() 24 | audioId = GetSoundId() 25 | PlaySoundFrontend(audioId, Sound, Library, true) 26 | Citizen.Wait(0.01) 27 | StopSound(audioId) 28 | ReleaseSoundId(audioId) 29 | audioId = nil 30 | end) 31 | end 32 | end 33 | end 34 | 35 | 36 | -------------------------------------------------------------------------------- /RageUI/components/Enum.lua: -------------------------------------------------------------------------------- 1 | --- 2 | --- @author Dylan MALANDAIN 3 | --- @version 2.0.0 4 | --- @since 2020 5 | --- 6 | --- RageUI Is Advanced UI Libs in LUA for make beautiful interface like RockStar GAME. 7 | --- 8 | --- 9 | --- Commercial Info. 10 | --- Any use for commercial purposes is strictly prohibited and will be punished. 11 | --- 12 | --- @see RageUI 13 | --- 14 | 15 | ---@class Enum 16 | local enums = { 17 | __index = function(table, key) 18 | if rawget(table.enums, key) then 19 | return key 20 | end 21 | end 22 | } 23 | 24 | ---Enum 25 | ---@param t table 26 | ---@return Enum 27 | function RageUI.Enum(t) 28 | local e = { enums = t } 29 | return setmetatable(e, enums) 30 | end 31 | -------------------------------------------------------------------------------- /RageUI/components/Keys.lua: -------------------------------------------------------------------------------- 1 | --- 2 | --- @author Dylan MALANDAIN 3 | --- @version 2.0.0 4 | --- @since 2020 5 | --- 6 | --- RageUI Is Advanced UI Libs in LUA for make beautiful interface like RockStar GAME. 7 | --- 8 | --- 9 | --- Commercial Info. 10 | --- Any use for commercial purposes is strictly prohibited and will be punished. 11 | --- 12 | --- @see RageUI 13 | --- 14 | 15 | 16 | ---@class Keys 17 | Keys = {}; 18 | 19 | ---Register 20 | ---@param Controls string 21 | ---@param ControlName string 22 | ---@param Description string 23 | ---@param Action function 24 | ---@return Keys 25 | ---@public 26 | 27 | Keys = { 28 | keysAllow = true 29 | } 30 | 31 | function Keys.Register(Controls, ControlName, Description, Action) 32 | local _Keys = { 33 | CONTROLS = Controls 34 | } 35 | RegisterKeyMapping(string.format('rageui-%s', ControlName), Description, "keyboard", Controls) 36 | RegisterCommand(string.format('rageui-%s', ControlName), function(source, args) 37 | if (Action ~= nil) then 38 | if Keys.keysAllow then 39 | Action(); 40 | else 41 | ShowNotification("~r~Action impossible ...~s~") 42 | end 43 | end 44 | end, false) 45 | return setmetatable(_Keys, Keys) 46 | end 47 | 48 | ---Exists 49 | ---@param Controls string 50 | ---@return boolean 51 | function Keys:Exists(Controls) 52 | return self.CONTROLS == Controls and true or false 53 | end 54 | -------------------------------------------------------------------------------- /RageUI/components/Rectangle.lua: -------------------------------------------------------------------------------- 1 | ---RenderRectangle 2 | --- 3 | --- Reference : https://github.com/iTexZoz/NativeUILua_Reloaded/blob/master/UIElements/UIResRectangle.lua#L84 4 | --- 5 | ---@param X number 6 | ---@param Y number 7 | ---@param Width number 8 | ---@param Height number 9 | ---@param R number 10 | ---@param G number 11 | ---@param B number 12 | ---@param A number 13 | ---@return nil 14 | ---@public 15 | function RenderRectangle(X, Y, Width, Height, R, G, B, A) 16 | local X, Y, Width, Height = (tonumber(X) or 0) / 1920, (tonumber(Y) or 0) / 1080, (tonumber(Width) or 0) / 1920, (tonumber(Height) or 0) / 1080 17 | DrawRect(X + Width * 0.5, Y + Height * 0.5, Width, Height, tonumber(R) or 255, tonumber(G) or 255, tonumber(B) or 255, tonumber(A) or 255) 18 | end 19 | -------------------------------------------------------------------------------- /RageUI/components/Sprite.lua: -------------------------------------------------------------------------------- 1 | ---RenderSprite 2 | --- 3 | --- Reference : https://github.com/iTexZoz/NativeUILua_Reloaded/blob/master/UIElements/Sprite.lua#L90 4 | --- 5 | ---@param TextureDictionary string 6 | ---@param TextureName string 7 | ---@param X number 8 | ---@param Y number 9 | ---@param Width number 10 | ---@param Height number 11 | ---@param Heading number 12 | ---@param R number 13 | ---@param G number 14 | ---@param B number 15 | ---@param A number 16 | ---@return nil 17 | ---@public 18 | function RenderSprite(TextureDictionary, TextureName, X, Y, Width, Height, Heading, R, G, B, A) 19 | ---@type number 20 | local X, Y, Width, Height = (tonumber(X) or 0) / 1920, (tonumber(Y) or 0) / 1080, (tonumber(Width) or 0) / 1920, (tonumber(Height) or 0) / 1080 21 | 22 | if not HasStreamedTextureDictLoaded(TextureDictionary) then 23 | RequestStreamedTextureDict(TextureDictionary, true) 24 | end 25 | 26 | DrawSprite(TextureDictionary, TextureName, X + Width * 0.5, Y + Height * 0.5, Width, Height, Heading or 0, tonumber(R) or 255, tonumber(G) or 255, tonumber(B) or 255, tonumber(A) or 255) 27 | end -------------------------------------------------------------------------------- /RageUI/components/Text.lua: -------------------------------------------------------------------------------- 1 | ---StringToArray 2 | --- 3 | --- Reference : Frazzle <3 4 | --- 5 | ---@param str string 6 | function StringToArray(str) 7 | local charCount = #str 8 | local strCount = math.ceil(charCount / 99) 9 | local strings = {} 10 | 11 | for i = 1, strCount do 12 | local start = (i - 1) * 99 + 1 13 | local clamp = math.clamp(#string.sub(str, start), 0, 99) 14 | local finish = ((i ~= 1) and (start - 1) or 0) + clamp 15 | 16 | strings[i] = string.sub(str, start, finish) 17 | end 18 | 19 | return strings 20 | end 21 | 22 | ---MeasureStringWidth 23 | --- 24 | --- Reference : Frazzle <3 25 | --- 26 | ---@param str string 27 | ---@param font number 28 | ---@param scale number 29 | ---@return _G 30 | ---@public 31 | function MeasureStringWidth(str, font, scale) 32 | BeginTextCommandWidth("CELL_EMAIL_BCON") 33 | AddTextComponentSubstringPlayerName(str) 34 | SetTextFont(font or 0) 35 | SetTextScale(1.0, scale or 0) 36 | return EndTextCommandGetWidth(true) * 1920 37 | end 38 | 39 | 40 | ---AddText 41 | --- 42 | --- Reference : Frazzle <3 43 | --- 44 | ---@param str string 45 | function AddText(str) 46 | local str = tostring(str) 47 | local charCount = #str 48 | 49 | if charCount < 100 then 50 | AddTextComponentSubstringPlayerName(str) 51 | else 52 | local strings = StringToArray(str) 53 | 54 | for s = 1, #strings do 55 | AddTextComponentSubstringPlayerName(strings[s]) 56 | end 57 | end 58 | end 59 | 60 | 61 | ---GetLineCount 62 | --- 63 | --- Reference : Frazzle <3 64 | --- 65 | ---@param Text string 66 | ---@param X number 67 | ---@param Y number 68 | ---@param Font number 69 | ---@param Scale number 70 | ---@param R number 71 | ---@param G number 72 | ---@param B number 73 | ---@param A number 74 | ---@param Alignment string 75 | ---@param DropShadow boolean 76 | ---@param Outline boolean 77 | ---@param WordWrap number 78 | ---@return function 79 | ---@public 80 | function GetLineCount(Text, X, Y, Font, Scale, R, G, B, A, Alignment, DropShadow, Outline, WordWrap) 81 | ---@type table 82 | local Text, X, Y = tostring(Text), (tonumber(X) or 0) / 1920, (tonumber(Y) or 0) / 1080 83 | SetTextFont(Font or 0) 84 | SetTextScale(1.0, Scale or 0) 85 | SetTextColour(tonumber(R) or 255, tonumber(G) or 255, tonumber(B) or 255, tonumber(A) or 255) 86 | if DropShadow then 87 | SetTextDropShadow() 88 | end 89 | if Outline then 90 | SetTextOutline() 91 | end 92 | if Alignment ~= nil then 93 | if Alignment == 1 or Alignment == "Center" or Alignment == "Centre" then 94 | SetTextCentre(true) 95 | elseif Alignment == 2 or Alignment == "Right" then 96 | SetTextRightJustify(true) 97 | end 98 | end 99 | if tonumber(WordWrap) and tonumber(WordWrap) ~= 0 then 100 | if Alignment == 1 or Alignment == "Center" or Alignment == "Centre" then 101 | SetTextWrap(X - ((WordWrap / 1920) / 2), X + ((WordWrap / 1920) / 2)) 102 | elseif Alignment == 2 or Alignment == "Right" then 103 | SetTextWrap(0, X) 104 | else 105 | SetTextWrap(X, X + (WordWrap / 1920)) 106 | end 107 | else 108 | if Alignment == 2 or Alignment == "Right" then 109 | SetTextWrap(0, X) 110 | end 111 | end 112 | 113 | BeginTextCommandLineCount("CELL_EMAIL_BCON") 114 | AddText(Text) 115 | return GetTextScreenLineCount(X, Y) 116 | end 117 | 118 | ---RenderText 119 | --- 120 | --- Reference : https://github.com/iTexZoz/NativeUILua_Reloaded/blob/master/UIElements/UIResText.lua#L189 121 | --- 122 | ---@param Text string 123 | ---@param X number 124 | ---@param Y number 125 | ---@param Font number 126 | ---@param Scale number 127 | ---@param R number 128 | ---@param G number 129 | ---@param B number 130 | ---@param A number 131 | ---@param Alignment string 132 | ---@param DropShadow boolean 133 | ---@param Outline boolean 134 | ---@param WordWrap number 135 | ---@return nil 136 | ---@public 137 | function RenderText(Text, X, Y, Font, Scale, R, G, B, A, Alignment, DropShadow, Outline, WordWrap) 138 | ---@type table 139 | local Text, X, Y = tostring(Text), (tonumber(X) or 0) / 1920, (tonumber(Y) or 0) / 1080 140 | SetTextFont(Font or 0) 141 | SetTextScale(1.0, Scale or 0) 142 | SetTextColour(tonumber(R) or 255, tonumber(G) or 255, tonumber(B) or 255, tonumber(A) or 255) 143 | if DropShadow then 144 | SetTextDropShadow() 145 | end 146 | if Outline then 147 | SetTextOutline() 148 | end 149 | if Alignment ~= nil then 150 | if Alignment == 1 or Alignment == "Center" or Alignment == "Centre" then 151 | SetTextCentre(true) 152 | elseif Alignment == 2 or Alignment == "Right" then 153 | SetTextRightJustify(true) 154 | end 155 | end 156 | if tonumber(WordWrap) and tonumber(WordWrap) ~= 0 then 157 | if Alignment == 1 or Alignment == "Center" or Alignment == "Centre" then 158 | SetTextWrap(X - ((WordWrap / 1920) / 2), X + ((WordWrap / 1920) / 2)) 159 | elseif Alignment == 2 or Alignment == "Right" then 160 | SetTextWrap(0, X) 161 | else 162 | SetTextWrap(X, X + (WordWrap / 1920)) 163 | end 164 | else 165 | if Alignment == 2 or Alignment == "Right" then 166 | SetTextWrap(0, X) 167 | end 168 | end 169 | BeginTextCommandDisplayText("CELL_EMAIL_BCON") 170 | AddText(Text) 171 | EndTextCommandDisplayText(X, Y) 172 | end 173 | -------------------------------------------------------------------------------- /RageUI/components/Visual.lua: -------------------------------------------------------------------------------- 1 | --- 2 | --- @author Dylan MALANDAIN 3 | --- @version 2.0.0 4 | --- @since 2020 5 | --- 6 | --- RageUI Is Advanced UI Libs in LUA for make beautiful interface like RockStar GAME. 7 | --- 8 | --- 9 | --- Commercial Info. 10 | --- Any use for commercial purposes is strictly prohibited and will be punished. 11 | --- 12 | --- @see RageUI 13 | --- 14 | 15 | ---@class Visual 16 | Visual = Visual or {}; 17 | 18 | local function AddLongString(txt) 19 | for i = 100, string.len(txt), 99 do 20 | local sub = string.sub(txt, i, i + 99) 21 | AddTextComponentSubstringPlayerName(sub) 22 | end 23 | end 24 | 25 | function Visual.Subtitle(text, time) 26 | ClearPrints() 27 | AddTextEntry('core:Subtitle', text) 28 | BeginTextCommandPrint('core:subtitle') 29 | AddTextComponentSubstringPlayerName(text) 30 | EndTextCommandPrint(time and math.ceil(time) or 0, true) 31 | end 32 | 33 | function Visual.FloatingHelpText(text, sound, loop) 34 | BeginTextCommandDisplayHelp("jamyfafi") 35 | AddTextComponentSubstringPlayerName(text) 36 | if string.len(text) > 99 then 37 | AddLongString(text) 38 | end 39 | EndTextCommandDisplayHelp(0, loop or 0, sound or true, -1) 40 | end 41 | 42 | function Visual.Prompt(text, spinner) 43 | BeginTextCommandBusyspinnerOn("STRING") 44 | AddTextComponentSubstringPlayerName(text) 45 | EndTextCommandBusyspinnerOn(spinner or 1) 46 | end 47 | 48 | function Visual.ENBASLAAA(text, spinner) 49 | BeginTextCommandBusyspinnerOn("STRING") 50 | AddTextComponentSubstringPlayerName(text) 51 | EndTextCommandScaleformString() 52 | end 53 | 54 | function Visual.PromptDuration(duration, text, spinner) 55 | Citizen.CreateThread(function() 56 | Citizen.Wait(0) 57 | Visual.Prompt(text, spinner) 58 | Citizen.Wait(duration) 59 | if (BusyspinnerIsOn()) then 60 | BusyspinnerOff(); 61 | end 62 | end) 63 | end 64 | -------------------------------------------------------------------------------- /RageUI/menu/Menu.lua: -------------------------------------------------------------------------------- 1 | --- 2 | --- Generated by EmmyLua(https://github.com/EmmyLua) 3 | --- Created by Dylan Malandain. 4 | --- DateTime: 21/04/2019 21:20 5 | --- 6 | 7 | ---CreateMenu 8 | ---@param Title string 9 | ---@param Subtitle string 10 | ---@param X number 11 | ---@param Y number 12 | ---@param TextureDictionary string 13 | ---@param TextureName string 14 | ---@param R number 15 | ---@param G number 16 | ---@param B number 17 | ---@param A number 18 | ---@return RageUIMenus 19 | ---@public 20 | function RageUI.CreateMenu(Title, Subtitle, X, Y, TextureDictionary, TextureName, R, G, B, A) 21 | 22 | ---@type table 23 | local Menu = {} 24 | Menu.Display = {}; 25 | 26 | Menu.InstructionalButtons = {} 27 | 28 | Menu.Display.Header = true; 29 | Menu.Display.Glare = true; 30 | Menu.Display.Subtitle = true; 31 | Menu.Display.Background = true; 32 | Menu.Display.Navigation = true; 33 | Menu.Display.InstructionalButton = true; 34 | Menu.Display.PageCounter = false; 35 | 36 | Menu.Title = Title or "" 37 | Menu.TitleFont = 6 38 | Menu.TitleScale = 1.2 39 | Menu.Subtitle = string.upper(Subtitle) or nil 40 | Menu.SubtitleHeight = -37 41 | Menu.Description = nil 42 | Menu.DescriptionHeight = RageUI.Settings.Items.Description.Background.Height 43 | Menu.X = X or 0 44 | Menu.Y = Y or 0 45 | Menu.Parent = nil 46 | Menu.WidthOffset = RageUI.UI.Style[RageUI.UI.Current].Width 47 | Menu.Open = false 48 | Menu.Controls = RageUI.Settings.Controls 49 | Menu.Index = 1 50 | Menu.Sprite = { Dictionary = TextureDictionary or "commonmenu", Texture = TextureName or "interaction_bgd", Color = { R = R, G = G, B = B, A = A } } 51 | Menu.Rectangle = nil 52 | Menu.Pagination = { Minimum = 1, Maximum = 10, Total = 10 } 53 | Menu.Safezone = true 54 | Menu.SafeZoneSize = nil 55 | Menu.EnableMouse = false 56 | Menu.Options = 0 57 | Menu.Closable = true 58 | Menu.InstructionalScaleform = RequestScaleformMovie("INSTRUCTIONAL_BUTTONS") 59 | Menu.CursorStyle = 1 60 | 61 | if string.starts(Menu.Subtitle, "~") then 62 | Menu.PageCounterColour = string.lower(string.sub(Menu.Subtitle, 1, 3)) 63 | else 64 | Menu.PageCounterColour = "" 65 | end 66 | 67 | if Menu.Subtitle ~= "" then 68 | local SubtitleLineCount = GetLineCount(Menu.Subtitle, Menu.X + RageUI.Settings.Items.Subtitle.Text.X, Menu.Y + RageUI.Settings.Items.Subtitle.Text.Y, 0, RageUI.Settings.Items.Subtitle.Text.Scale, 245, 245, 245, 255, nil, false, false, RageUI.Settings.Items.Subtitle.Background.Width + Menu.WidthOffset) 69 | 70 | if SubtitleLineCount > 1 then 71 | Menu.SubtitleHeight = 18 * SubtitleLineCount 72 | else 73 | Menu.SubtitleHeight = 0 74 | end 75 | end 76 | 77 | Citizen.CreateThread(function() 78 | if not HasScaleformMovieLoaded(Menu.InstructionalScaleform) then 79 | Menu.InstructionalScaleform = RequestScaleformMovie("INSTRUCTIONAL_BUTTONS") 80 | while not HasScaleformMovieLoaded(Menu.InstructionalScaleform) do 81 | Citizen.Wait(0) 82 | end 83 | end 84 | end) 85 | 86 | Citizen.CreateThread(function() 87 | local ScaleformMovie = RequestScaleformMovie("MP_MENU_GLARE") 88 | while not HasScaleformMovieLoaded(ScaleformMovie) do 89 | Citizen.Wait(0) 90 | end 91 | end) 92 | 93 | return setmetatable(Menu, RageUI.Menus) 94 | end 95 | 96 | ---CreateSubMenu 97 | ---@param ParentMenu function 98 | ---@param Title string 99 | ---@param Subtitle string 100 | ---@param X number 101 | ---@param Y number 102 | ---@param TextureDictionary string 103 | ---@param TextureName string 104 | ---@param R number 105 | ---@param G number 106 | ---@param B number 107 | ---@param A number 108 | ---@return RageUIMenus 109 | ---@public 110 | function RageUI.CreateSubMenu(ParentMenu, Title, Subtitle, X, Y, TextureDictionary, TextureName, R, G, B, A) 111 | if ParentMenu ~= nil then 112 | if ParentMenu() then 113 | local Menu = RageUI.CreateMenu(Title or ParentMenu.Title, string.upper(Subtitle) or string.upper(ParentMenu.Subtitle), X or ParentMenu.X, Y or ParentMenu.Y) 114 | Menu.Parent = ParentMenu 115 | Menu.WidthOffset = ParentMenu.WidthOffset 116 | Menu.Safezone = ParentMenu.Safezone 117 | if ParentMenu.Sprite then 118 | Menu.Sprite = { Dictionary = TextureDictionary or ParentMenu.Sprite.Dictionary, Texture = TextureName or ParentMenu.Sprite.Texture, Color = { R = R or ParentMenu.Sprite.Color.R, G = G or ParentMenu.Sprite.Color.G, B = B or ParentMenu.Sprite.Color.B, A = A or ParentMenu.Sprite.Color.A } } 119 | else 120 | Menu.Rectangle = ParentMenu.Rectangle 121 | end 122 | return setmetatable(Menu, RageUI.Menus) 123 | else 124 | return nil 125 | end 126 | else 127 | return nil 128 | end 129 | end 130 | 131 | function RageUI.Menus:DisplayHeader(boolean) 132 | self.Display.Header = boolean; 133 | return self.Display.Header; 134 | end 135 | 136 | function RageUI.Menus:DisplayGlare(boolean) 137 | self.Display.Glare = boolean; 138 | return self.Display.Glare; 139 | end 140 | 141 | function RageUI.Menus:DisplaySubtitle(boolean) 142 | self.Display.Subtitle = boolean; 143 | return self.Display.Subtitle; 144 | end 145 | 146 | function RageUI.Menus:DisplayNavigation(boolean) 147 | self.Display.Navigation = boolean; 148 | return self.Display.Navigation; 149 | end 150 | 151 | function RageUI.Menus:DisplayInstructionalButton(boolean) 152 | self.Display.InstructionalButton = boolean; 153 | return self.Display.InstructionalButton; 154 | end 155 | 156 | function RageUI.Menus:DisplayPageCounter(boolean) 157 | self.Display.PageCounter= boolean; 158 | return self.Display.PageCounter; 159 | end 160 | 161 | ---SetTitle 162 | ---@param Title string 163 | ---@return nil 164 | ---@public 165 | function RageUI.Menus:SetTitle(Title) 166 | self.Title = Title 167 | end 168 | 169 | function RageUI.Menus:SetStyleSize(Value) 170 | local witdh 171 | if Value >= 0 and Value <= 200 then 172 | witdh = Value 173 | else 174 | witdh = 100 175 | end 176 | self.WidthOffset = witdh 177 | end 178 | 179 | ---GetStyleSize 180 | ---@return any 181 | ---@public 182 | function RageUI.Menus:GetStyleSize() 183 | if (self.WidthOffset == 100) then 184 | return "RageUI" 185 | elseif (self.WidthOffset == 0) then 186 | return "NativeUI"; 187 | else 188 | return self.WidthOffset; 189 | end 190 | end 191 | 192 | ---SetStyleSize 193 | ---@param Int string 194 | ---@return void 195 | ---@public 196 | function RageUI.Menus:SetCursorStyle(Int) 197 | self.CursorStyle = Int or 1 or 0 198 | SetMouseCursorSprite(Int) 199 | end 200 | 201 | ---ResetCursorStyle 202 | ---@return void 203 | ---@public 204 | function RageUI.Menus:ResetCursorStyle() 205 | self.CursorStyle = 1 206 | SetMouseCursorSprite(1) 207 | end 208 | 209 | ---UpdateCursorStyle 210 | ---@return void 211 | ---@public 212 | function RageUI.Menus:UpdateCursorStyle() 213 | SetMouseCursorSprite(self.CursorStyle) 214 | end 215 | 216 | ---RefreshIndex 217 | ---@return void 218 | ---@public 219 | function RageUI.Menus:RefreshIndex() 220 | self.Index = 1 221 | end 222 | 223 | ---SetSubtitle 224 | ---@param Subtitle string 225 | ---@return nil 226 | ---@public 227 | function RageUI.Menus:SetSubtitle(Subtitle) 228 | 229 | self.Subtitle = string.upper(Subtitle) or string.upper(self.Subtitle) 230 | 231 | if string.starts(self.Subtitle, "~") then 232 | self.PageCounterColour = string.lower(string.sub(self.Subtitle, 1, 3)) 233 | else 234 | self.PageCounterColour = "" 235 | end 236 | if self.Subtitle ~= "" then 237 | local SubtitleLineCount = GetLineCount(self.Subtitle, self.X + RageUI.Settings.Items.Subtitle.Text.X, self.Y + RageUI.Settings.Items.Subtitle.Text.Y, 0, RageUI.Settings.Items.Subtitle.Text.Scale, 245, 245, 245, 255, nil, false, false, RageUI.Settings.Items.Subtitle.Background.Width + self.WidthOffset) 238 | 239 | if SubtitleLineCount > 1 then 240 | self.SubtitleHeight = 18 * SubtitleLineCount 241 | else 242 | self.SubtitleHeight = 0 243 | end 244 | 245 | else 246 | self.SubtitleHeight = -37 247 | end 248 | end 249 | 250 | ---PageCounter 251 | ---@param Subtitle string 252 | ---@return nil 253 | ---@public 254 | function RageUI.Menus:SetPageCounter(Subtitle) 255 | self.PageCounter = Subtitle 256 | end 257 | 258 | ---EditSpriteColor 259 | ---@param Colors table 260 | ---@return nil 261 | ---@public 262 | function RageUI.Menus:EditSpriteColor(R, G, B, A) 263 | if self.Sprite.Dictionary == "commonmenu" then 264 | self.Sprite.Color = { R = tonumber(R) or 255, G = tonumber(G) or 255, B = tonumber(B) or 255, A = tonumber(A) or 255 } 265 | end 266 | end 267 | ---SetPosition 268 | ---@param X number 269 | ---@param Y number 270 | ---@return nil 271 | ---@public 272 | function RageUI.Menus:SetPosition(X, Y) 273 | self.X = tonumber(X) or self.X 274 | self.Y = tonumber(Y) or self.Y 275 | end 276 | 277 | ---SetTotalItemsPerPage 278 | ---@param Value number 279 | ---@return nil 280 | ---@public 281 | function RageUI.Menus:SetTotalItemsPerPage(Value) 282 | self.Pagination.Total = tonumber(Value) or self.Pagination.Total 283 | end 284 | 285 | ---SetRectangleBanner 286 | ---@param R number 287 | ---@param G number 288 | ---@param B number 289 | ---@param A number 290 | ---@return nil 291 | ---@public 292 | function RageUI.Menus:SetRectangleBanner(R, G, B, A) 293 | self.Rectangle = { R = tonumber(R) or 255, G = tonumber(G) or 255, B = tonumber(B) or 255, A = tonumber(A) or 255 } 294 | self.Sprite = nil 295 | end 296 | 297 | ---SetSpriteBanner 298 | ---@param TextureDictionary string 299 | ---@param Texture string 300 | ---@return nil 301 | ---@public 302 | function RageUI.Menus:SetSpriteBanner(TextureDictionary, Texture) 303 | self.Sprite = { Dictionary = TextureDictionary or "commonmenu", Texture = Texture or "interaction_bgd" } 304 | self.Rectangle = nil 305 | end 306 | 307 | function RageUI.Menus:Closable(boolean) 308 | if type(boolean) == "boolean" then 309 | self.Closable = boolean 310 | else 311 | error("Type is not boolean") 312 | end 313 | end 314 | 315 | function RageUI.Menus:AddInstructionButton(button) 316 | if type(button) == "table" and #button == 2 then 317 | table.insert(self.InstructionalButtons, button) 318 | self.UpdateInstructionalButtons(true); 319 | end 320 | end 321 | 322 | function RageUI.Menus:RemoveInstructionButton(button) 323 | if type(button) == "table" then 324 | for i = 1, #self.InstructionalButtons do 325 | if button == self.InstructionalButtons[i] then 326 | table.remove(self.InstructionalButtons, i) 327 | self.UpdateInstructionalButtons(true); 328 | break 329 | end 330 | end 331 | else 332 | if tonumber(button) then 333 | if self.InstructionalButtons[tonumber(button)] then 334 | table.remove(self.InstructionalButtons, tonumber(button)) 335 | self.UpdateInstructionalButtons(true); 336 | end 337 | end 338 | end 339 | end 340 | 341 | function RageUI.Menus:UpdateInstructionalButtons(Visible) 342 | 343 | if not Visible then 344 | return 345 | end 346 | 347 | BeginScaleformMovieMethod(self.InstructionalScaleform, "CLEAR_ALL") 348 | EndScaleformMovieMethod() 349 | 350 | BeginScaleformMovieMethod(self.InstructionalScaleform, "TOGGLE_MOUSE_BUTTONS") 351 | ScaleformMovieMethodAddParamInt(0) 352 | EndScaleformMovieMethod() 353 | 354 | BeginScaleformMovieMethod(self.InstructionalScaleform, "CREATE_CONTAINER") 355 | EndScaleformMovieMethod() 356 | 357 | BeginScaleformMovieMethod(self.InstructionalScaleform, "SET_DATA_SLOT") 358 | ScaleformMovieMethodAddParamInt(0) 359 | PushScaleformMovieMethodParameterButtonName(GetControlInstructionalButton(2, 176, 0)) 360 | PushScaleformMovieMethodParameterString(GetLabelText("HUD_INPUT2")) 361 | EndScaleformMovieMethod() 362 | 363 | if self.Closable then 364 | BeginScaleformMovieMethod(self.InstructionalScaleform, "SET_DATA_SLOT") 365 | ScaleformMovieMethodAddParamInt(1) 366 | PushScaleformMovieMethodParameterButtonName(GetControlInstructionalButton(2, 177, 0)) 367 | PushScaleformMovieMethodParameterString(GetLabelText("HUD_INPUT3")) 368 | EndScaleformMovieMethod() 369 | end 370 | 371 | local count = 2 372 | 373 | if (self.InstructionalButtons ~= nil) then 374 | for i = 1, #self.InstructionalButtons do 375 | if self.InstructionalButtons[i] then 376 | if #self.InstructionalButtons[i] == 2 then 377 | BeginScaleformMovieMethod(self.InstructionalScaleform, "SET_DATA_SLOT") 378 | ScaleformMovieMethodAddParamInt(count) 379 | PushScaleformMovieMethodParameterButtonName(self.InstructionalButtons[i][1]) 380 | PushScaleformMovieMethodParameterString(self.InstructionalButtons[i][2]) 381 | EndScaleformMovieMethod() 382 | count = count + 1 383 | end 384 | end 385 | end 386 | end 387 | 388 | BeginScaleformMovieMethod(self.InstructionalScaleform, "DRAW_INSTRUCTIONAL_BUTTONS") 389 | ScaleformMovieMethodAddParamInt(-1) 390 | EndScaleformMovieMethod() 391 | end 392 | -------------------------------------------------------------------------------- /RageUI/menu/MenuController.lua: -------------------------------------------------------------------------------- 1 | --- 2 | --- @author Dylan MALANDAIN 3 | --- @version 2.0.0 4 | --- @since 2020 5 | --- 6 | --- RageUI Is Advanced UI Libs in LUA for make beautiful interface like RockStar GAME. 7 | --- 8 | --- 9 | --- Commercial Info. 10 | --- Any use for commercial purposes is strictly prohibited and will be punished. 11 | --- 12 | --- @see RageUI 13 | --- 14 | 15 | RageUI.LastControl = false 16 | 17 | local ControlActions = { 18 | 'Left', 19 | 'Right', 20 | 'Select', 21 | 'Click', 22 | } 23 | 24 | ---GoUp 25 | ---@param Options number 26 | ---@return nil 27 | ---@public 28 | function RageUI.GoUp(Options) 29 | local CurrentMenu = RageUI.CurrentMenu; 30 | if CurrentMenu ~= nil then 31 | Options = CurrentMenu.Options 32 | if CurrentMenu() then 33 | if (Options ~= 0) then 34 | if Options > CurrentMenu.Pagination.Total then 35 | if CurrentMenu.Index <= CurrentMenu.Pagination.Minimum then 36 | if CurrentMenu.Index == 1 then 37 | CurrentMenu.Pagination.Minimum = Options - (CurrentMenu.Pagination.Total - 1) 38 | CurrentMenu.Pagination.Maximum = Options 39 | CurrentMenu.Index = Options 40 | else 41 | CurrentMenu.Pagination.Minimum = (CurrentMenu.Pagination.Minimum - 1) 42 | CurrentMenu.Pagination.Maximum = (CurrentMenu.Pagination.Maximum - 1) 43 | CurrentMenu.Index = CurrentMenu.Index - 1 44 | end 45 | else 46 | CurrentMenu.Index = CurrentMenu.Index - 1 47 | end 48 | else 49 | if CurrentMenu.Index == 1 then 50 | CurrentMenu.Pagination.Minimum = Options - (CurrentMenu.Pagination.Total - 1) 51 | CurrentMenu.Pagination.Maximum = Options 52 | CurrentMenu.Index = Options 53 | else 54 | CurrentMenu.Index = CurrentMenu.Index - 1 55 | end 56 | end 57 | 58 | local Audio = RageUI.Settings.Audio 59 | RageUI.PlaySound(Audio[Audio.Use].UpDown.audioName, Audio[Audio.Use].UpDown.audioRef) 60 | RageUI.LastControl = true 61 | if (CurrentMenu.onIndexChange ~= nil) then 62 | Citizen.CreateThread(function() 63 | CurrentMenu.onIndexChange(CurrentMenu.Index) 64 | end) 65 | end 66 | else 67 | local Audio = RageUI.Settings.Audio 68 | RageUI.PlaySound(Audio[Audio.Use].Error.audioName, Audio[Audio.Use].Error.audioRef) 69 | end 70 | end 71 | end 72 | end 73 | 74 | ---GoDown 75 | ---@param Options number 76 | ---@return nil 77 | ---@public 78 | function RageUI.GoDown(Options) 79 | local CurrentMenu = RageUI.CurrentMenu; 80 | if CurrentMenu ~= nil then 81 | Options = CurrentMenu.Options 82 | if CurrentMenu() then 83 | if (Options ~= 0) then 84 | if Options > CurrentMenu.Pagination.Total then 85 | if CurrentMenu.Index >= CurrentMenu.Pagination.Maximum then 86 | if CurrentMenu.Index == Options then 87 | CurrentMenu.Pagination.Minimum = 1 88 | CurrentMenu.Pagination.Maximum = CurrentMenu.Pagination.Total 89 | CurrentMenu.Index = 1 90 | else 91 | CurrentMenu.Pagination.Maximum = (CurrentMenu.Pagination.Maximum + 1) 92 | CurrentMenu.Pagination.Minimum = CurrentMenu.Pagination.Maximum - (CurrentMenu.Pagination.Total - 1) 93 | CurrentMenu.Index = CurrentMenu.Index + 1 94 | end 95 | else 96 | CurrentMenu.Index = CurrentMenu.Index + 1 97 | end 98 | else 99 | if CurrentMenu.Index == Options then 100 | CurrentMenu.Pagination.Minimum = 1 101 | CurrentMenu.Pagination.Maximum = CurrentMenu.Pagination.Total 102 | CurrentMenu.Index = 1 103 | else 104 | CurrentMenu.Index = CurrentMenu.Index + 1 105 | end 106 | end 107 | local Audio = RageUI.Settings.Audio 108 | RageUI.PlaySound(Audio[Audio.Use].UpDown.audioName, Audio[Audio.Use].UpDown.audioRef) 109 | RageUI.LastControl = false 110 | if (CurrentMenu.onIndexChange ~= nil) then 111 | Citizen.CreateThread(function() 112 | CurrentMenu.onIndexChange(CurrentMenu.Index) 113 | end) 114 | end 115 | else 116 | local Audio = RageUI.Settings.Audio 117 | RageUI.PlaySound(Audio[Audio.Use].Error.audioName, Audio[Audio.Use].Error.audioRef) 118 | end 119 | end 120 | end 121 | end 122 | 123 | function RageUI.GoActionControl(Controls, Action) 124 | if Controls[Action or 'Left'].Enabled then 125 | for Index = 1, #Controls[Action or 'Left'].Keys do 126 | if not Controls[Action or 'Left'].Pressed then 127 | if IsDisabledControlJustPressed(Controls[Action or 'Left'].Keys[Index][1], Controls[Action or 'Left'].Keys[Index][2]) then 128 | Controls[Action or 'Left'].Pressed = true 129 | Citizen.CreateThread(function() 130 | Controls[Action or 'Left'].Active = true 131 | Citizen.Wait(0.01) 132 | Controls[Action or 'Left'].Active = false 133 | Citizen.Wait(175) 134 | while Controls[Action or 'Left'].Enabled and IsDisabledControlPressed(Controls[Action or 'Left'].Keys[Index][1], Controls[Action or 'Left'].Keys[Index][2]) do 135 | Controls[Action or 'Left'].Active = true 136 | Citizen.Wait(1) 137 | 138 | Controls[Action or 'Left'].Active = false 139 | Citizen.Wait(124) 140 | end 141 | Controls[Action or 'Left'].Pressed = false 142 | if (Action ~= ControlActions[5]) then 143 | Citizen.Wait(10) 144 | end 145 | end) 146 | break 147 | end 148 | end 149 | end 150 | end 151 | end 152 | 153 | function RageUI.GoActionControlSlider(Controls, Action) 154 | if Controls[Action].Enabled then 155 | for Index = 1, #Controls[Action].Keys do 156 | if not Controls[Action].Pressed then 157 | if IsDisabledControlJustPressed(Controls[Action].Keys[Index][1], Controls[Action].Keys[Index][2]) then 158 | Controls[Action].Pressed = true 159 | Citizen.CreateThread(function() 160 | Controls[Action].Active = true 161 | Citizen.Wait(1) 162 | Controls[Action].Active = false 163 | while Controls[Action].Enabled and IsDisabledControlPressed(Controls[Action].Keys[Index][1], Controls[Action].Keys[Index][2]) do 164 | Controls[Action].Active = true 165 | Citizen.Wait(1) 166 | Controls[Action].Active = false 167 | end 168 | Controls[Action].Pressed = false 169 | end) 170 | break 171 | end 172 | end 173 | end 174 | end 175 | end 176 | 177 | ---Controls 178 | ---@return nil 179 | ---@public 180 | function RageUI.Controls() 181 | local CurrentMenu = RageUI.CurrentMenu; 182 | if CurrentMenu ~= nil then 183 | if CurrentMenu() then 184 | if CurrentMenu.Open then 185 | 186 | local Controls = CurrentMenu.Controls; 187 | ---@type number 188 | local Options = CurrentMenu.Options 189 | RageUI.Options = CurrentMenu.Options 190 | if CurrentMenu.EnableMouse then 191 | DisableControlAction(2, 24, true) -- disable attack 192 | DisableControlAction(2, 25, true) -- disable aim 193 | DisableControlAction(2, 1, true) -- LookLeftRight 194 | DisableControlAction(2, 2, true) -- LookUpDown 195 | DisableControlAction(2, 142, true) 196 | DisableControlAction(2, 18, true) 197 | DisableControlAction(2, 322, true) 198 | DisableControlAction(2, 106, true) 199 | DisableControlAction(2, 263, true) -- disable melee 200 | DisableControlAction(2, 264, true) -- disable melee 201 | DisableControlAction(2, 257, true) -- disable melee 202 | DisableControlAction(2, 140, true) -- disable melee 203 | DisableControlAction(2, 141, true) -- disable melee 204 | DisableControlAction(2, 142, true) -- disable melee 205 | DisableControlAction(2, 143, true) -- disable melee 206 | end 207 | 208 | if not IsInputDisabled(2) then 209 | for Index = 1, #Controls.Enabled.Controller do 210 | EnableControlAction(Controls.Enabled.Controller[Index][1], Controls.Enabled.Controller[Index][2], true) 211 | end 212 | else 213 | for Index = 1, #Controls.Enabled.Keyboard do 214 | EnableControlAction(Controls.Enabled.Keyboard[Index][1], Controls.Enabled.Keyboard[Index][2], true) 215 | end 216 | end 217 | 218 | if Controls.Up.Enabled then 219 | for Index = 1, #Controls.Up.Keys do 220 | if not Controls.Up.Pressed then 221 | if IsDisabledControlJustPressed(Controls.Up.Keys[Index][1], Controls.Up.Keys[Index][2]) then 222 | Controls.Up.Pressed = true 223 | Citizen.CreateThread(function() 224 | RageUI.GoUp(Options) 225 | Citizen.Wait(175) 226 | while Controls.Up.Enabled and IsDisabledControlPressed(Controls.Up.Keys[Index][1], Controls.Up.Keys[Index][2]) do 227 | RageUI.GoUp(Options) 228 | Citizen.Wait(50) 229 | end 230 | Controls.Up.Pressed = false 231 | end) 232 | break 233 | end 234 | end 235 | end 236 | end 237 | 238 | if Controls.Down.Enabled then 239 | for Index = 1, #Controls.Down.Keys do 240 | if not Controls.Down.Pressed then 241 | if IsDisabledControlJustPressed(Controls.Down.Keys[Index][1], Controls.Down.Keys[Index][2]) then 242 | Controls.Down.Pressed = true 243 | Citizen.CreateThread(function() 244 | RageUI.GoDown(Options) 245 | Citizen.Wait(175) 246 | while Controls.Down.Enabled and IsDisabledControlPressed(Controls.Down.Keys[Index][1], Controls.Down.Keys[Index][2]) do 247 | RageUI.GoDown(Options) 248 | Citizen.Wait(50) 249 | end 250 | Controls.Down.Pressed = false 251 | end) 252 | break 253 | end 254 | end 255 | end 256 | end 257 | 258 | for i = 1, #ControlActions do 259 | RageUI.GoActionControl(Controls, ControlActions[i]) 260 | end 261 | 262 | RageUI.GoActionControlSlider(Controls, 'SliderLeft') 263 | RageUI.GoActionControlSlider(Controls, 'SliderRight') 264 | 265 | if Controls.Back.Enabled then 266 | for Index = 1, #Controls.Back.Keys do 267 | if not Controls.Back.Pressed then 268 | if IsDisabledControlJustPressed(Controls.Back.Keys[Index][1], Controls.Back.Keys[Index][2]) then 269 | Controls.Back.Pressed = true 270 | Citizen.CreateThread(function() 271 | Citizen.Wait(175) 272 | Controls.Down.Pressed = false 273 | end) 274 | break 275 | end 276 | end 277 | end 278 | end 279 | 280 | end 281 | end 282 | end 283 | end 284 | 285 | ---Navigation 286 | ---@return nil 287 | ---@public 288 | function RageUI.Navigation() 289 | local CurrentMenu = RageUI.CurrentMenu; 290 | if CurrentMenu ~= nil then 291 | if CurrentMenu() and (CurrentMenu.Display.Navigation) then 292 | if CurrentMenu.EnableMouse then 293 | SetMouseCursorActiveThisFrame() 294 | end 295 | if RageUI.Options > CurrentMenu.Pagination.Total then 296 | 297 | ---@type boolean 298 | local UpHovered = false 299 | 300 | ---@type boolean 301 | local DownHovered = false 302 | 303 | if not CurrentMenu.SafeZoneSize then 304 | CurrentMenu.SafeZoneSize = { X = 0, Y = 0 } 305 | 306 | if CurrentMenu.Safezone then 307 | CurrentMenu.SafeZoneSize = RageUI.GetSafeZoneBounds() 308 | 309 | SetScriptGfxAlign(76, 84) 310 | SetScriptGfxAlignParams(0, 0, 0, 0) 311 | end 312 | end 313 | 314 | if CurrentMenu.EnableMouse then 315 | UpHovered = RageUI.IsMouseInBounds(CurrentMenu.X + CurrentMenu.SafeZoneSize.X, CurrentMenu.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, RageUI.Settings.Items.Navigation.Rectangle.Width + CurrentMenu.WidthOffset, RageUI.Settings.Items.Navigation.Rectangle.Height) 316 | DownHovered = RageUI.IsMouseInBounds(CurrentMenu.X + CurrentMenu.SafeZoneSize.X, CurrentMenu.Y + RageUI.Settings.Items.Navigation.Rectangle.Height + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, RageUI.Settings.Items.Navigation.Rectangle.Width + CurrentMenu.WidthOffset, RageUI.Settings.Items.Navigation.Rectangle.Height) 317 | 318 | -- if CurrentMenu.Controls.Click.Active then 319 | -- if UpHovered then 320 | -- RageUI.GoUp(RageUI.Options) 321 | -- elseif DownHovered then 322 | -- RageUI.GoDown(RageUI.Options) 323 | -- end 324 | -- end 325 | 326 | -- if UpHovered then 327 | -- RenderRectangle(CurrentMenu.X, CurrentMenu.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, RageUI.Settings.Items.Navigation.Rectangle.Width + CurrentMenu.WidthOffset, RageUI.Settings.Items.Navigation.Rectangle.Height, 30, 30, 30, 255) 328 | -- else 329 | -- RenderRectangle(CurrentMenu.X, CurrentMenu.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, RageUI.Settings.Items.Navigation.Rectangle.Width + CurrentMenu.WidthOffset, RageUI.Settings.Items.Navigation.Rectangle.Height, 0, 0, 0, 200) 330 | -- end 331 | 332 | -- if DownHovered then 333 | -- RenderRectangle(CurrentMenu.X, CurrentMenu.Y + RageUI.Settings.Items.Navigation.Rectangle.Height + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, RageUI.Settings.Items.Navigation.Rectangle.Width + CurrentMenu.WidthOffset, RageUI.Settings.Items.Navigation.Rectangle.Height, 30, 30, 30, 255) 334 | -- else 335 | -- RenderRectangle(CurrentMenu.X, CurrentMenu.Y + RageUI.Settings.Items.Navigation.Rectangle.Height + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, RageUI.Settings.Items.Navigation.Rectangle.Width + CurrentMenu.WidthOffset, RageUI.Settings.Items.Navigation.Rectangle.Height, 0, 0, 0, 200) 336 | -- end 337 | else 338 | -- RenderRectangle(CurrentMenu.X, CurrentMenu.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, RageUI.Settings.Items.Navigation.Rectangle.Width + CurrentMenu.WidthOffset, RageUI.Settings.Items.Navigation.Rectangle.Height, 0, 0, 0, 200) 339 | -- RenderRectangle(CurrentMenu.X, CurrentMenu.Y + RageUI.Settings.Items.Navigation.Rectangle.Height + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, RageUI.Settings.Items.Navigation.Rectangle.Width + CurrentMenu.WidthOffset, RageUI.Settings.Items.Navigation.Rectangle.Height, 0, 0, 0, 200) 340 | end 341 | -- RenderSprite(RageUI.Settings.Items.Navigation.Arrows.Dictionary, RageUI.Settings.Items.Navigation.Arrows.Texture, CurrentMenu.X + RageUI.Settings.Items.Navigation.Arrows.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + RageUI.Settings.Items.Navigation.Arrows.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, RageUI.Settings.Items.Navigation.Arrows.Width, RageUI.Settings.Items.Navigation.Arrows.Height) 342 | RageUI.ItemOffset = RageUI.ItemOffset + (RageUI.Settings.Items.Navigation.Rectangle.Height * 2) 343 | end 344 | end 345 | end 346 | end 347 | 348 | ---GoBack 349 | ---@return nil 350 | ---@public 351 | function RageUI.GoBack() 352 | local CurrentMenu = RageUI.CurrentMenu 353 | if CurrentMenu ~= nil then 354 | local Audio = RageUI.Settings.Audio 355 | RageUI.PlaySound(Audio[Audio.Use].Back.audioName, Audio[Audio.Use].Back.audioRef) 356 | if CurrentMenu.Parent ~= nil then 357 | if CurrentMenu.Parent() then 358 | RageUI.NextMenu = CurrentMenu.Parent 359 | else 360 | RageUI.NextMenu = nil 361 | RageUI.Visible(CurrentMenu, false) 362 | end 363 | else 364 | RageUI.NextMenu = nil 365 | RageUI.Visible(CurrentMenu, false) 366 | end 367 | end 368 | end 369 | 370 | ---GoBack2 371 | ---@return nil 372 | ---@public 373 | function RageUI.GoBack2() 374 | -- function to go back to the previous menu twice 375 | local CurrentMenu = RageUI.CurrentMenu 376 | if CurrentMenu ~= nil then 377 | local Audio = RageUI.Settings.Audio 378 | RageUI.PlaySound(Audio[Audio.Use].Back.audioName, Audio[Audio.Use].Back.audioRef) 379 | if CurrentMenu.Parent ~= nil then 380 | if CurrentMenu.Parent() then 381 | RageUI.NextMenu = CurrentMenu.Parent 382 | else 383 | RageUI.NextMenu = nil 384 | RageUI.Visible(CurrentMenu, false) 385 | end 386 | else 387 | RageUI.NextMenu = nil 388 | RageUI.Visible(CurrentMenu, false) 389 | end 390 | end 391 | 392 | local CurrentMenu = RageUI.NextMenu 393 | if CurrentMenu ~= nil then 394 | local Audio = RageUI.Settings.Audio 395 | RageUI.PlaySound(Audio[Audio.Use].Back.audioName, Audio[Audio.Use].Back.audioRef) 396 | if CurrentMenu.Parent ~= nil then 397 | if CurrentMenu.Parent() then 398 | RageUI.NextMenu = CurrentMenu.Parent 399 | else 400 | RageUI.NextMenu = nil 401 | RageUI.Visible(CurrentMenu, false) 402 | end 403 | else 404 | RageUI.NextMenu = nil 405 | RageUI.Visible(CurrentMenu, false) 406 | end 407 | end 408 | end 409 | -------------------------------------------------------------------------------- /RageUI/menu/RageUI.lua: -------------------------------------------------------------------------------- 1 | --- 2 | --- @author Dylan MALANDAIN 3 | --- @version 2.0.0 4 | --- @since 2020 5 | --- 6 | --- RageUI Is Advanced UI Libs in LUA for make beautiful interface like RockStar GAME. 7 | --- 8 | --- 9 | --- Commercial Info. 10 | --- Any use for commercial purposes is strictly prohibited and will be punished. 11 | --- 12 | --- @see RageUI 13 | --- 14 | 15 | -- print("^4RageUI - https://github.com/iTexZoz/RageUI - OpenSource Advanced UI Api^0") 16 | 17 | function math.round(num, numDecimalPlaces) 18 | return tonumber(string.format("%." .. (numDecimalPlaces or 0) .. "f", num)) 19 | end 20 | 21 | function string.starts(String, Start) 22 | return string.sub(String, 1, string.len(Start)) == Start 23 | end 24 | 25 | ---@class RageUIMenus 26 | RageUI.Menus = setmetatable({}, RageUI.Menus) 27 | 28 | ---@type table 29 | ---@return boolean 30 | RageUI.Menus.__call = function() 31 | return true 32 | end 33 | 34 | ---@type table 35 | RageUI.Menus.__index = RageUI.Menus 36 | 37 | ---@type table 38 | RageUI.CurrentMenu = nil 39 | 40 | ---@type table 41 | RageUI.NextMenu = nil 42 | 43 | ---@type number 44 | RageUI.Options = 0 45 | 46 | ---@type number 47 | RageUI.ItemOffset = 0 48 | 49 | ---@type number 50 | RageUI.StatisticPanelCount = 0 51 | 52 | ---@class UISize 53 | RageUI.UI = { 54 | Current = "NativeUI", 55 | Style = { 56 | RageUI = { 57 | Width = 0 58 | }, 59 | NativeUI = { 60 | Width = 0 61 | } 62 | } 63 | } 64 | 65 | ---@class Settings 66 | RageUI.Settings = { 67 | Debug = false, 68 | Controls = { 69 | Up = { 70 | Enabled = true, 71 | Active = false, 72 | Pressed = false, 73 | Keys = { 74 | { 0, 172 }, 75 | { 1, 172 }, 76 | { 2, 172 }, 77 | { 0, 241 }, 78 | { 1, 241 }, 79 | { 2, 241 }, 80 | }, 81 | }, 82 | Down = { 83 | Enabled = true, 84 | Active = false, 85 | Pressed = false, 86 | Keys = { 87 | { 0, 173 }, 88 | { 1, 173 }, 89 | { 2, 173 }, 90 | { 0, 242 }, 91 | { 1, 242 }, 92 | { 2, 242 }, 93 | }, 94 | }, 95 | Left = { 96 | Enabled = true, 97 | Active = false, 98 | Pressed = false, 99 | Keys = { 100 | { 0, 174 }, 101 | { 1, 174 }, 102 | { 2, 174 }, 103 | }, 104 | }, 105 | Right = { 106 | Enabled = true, 107 | Pressed = false, 108 | Active = false, 109 | Keys = { 110 | { 0, 175 }, 111 | { 1, 175 }, 112 | { 2, 175 }, 113 | }, 114 | }, 115 | SliderLeft = { 116 | Enabled = true, 117 | Active = false, 118 | Pressed = false, 119 | Keys = { 120 | { 0, 174 }, 121 | { 1, 174 }, 122 | { 2, 174 }, 123 | }, 124 | }, 125 | SliderRight = { 126 | Enabled = true, 127 | Pressed = false, 128 | Active = false, 129 | Keys = { 130 | { 0, 175 }, 131 | { 1, 175 }, 132 | { 2, 175 }, 133 | }, 134 | }, 135 | Select = { 136 | Enabled = true, 137 | Pressed = false, 138 | Active = false, 139 | Keys = { 140 | { 0, 201 }, 141 | { 1, 201 }, 142 | { 2, 201 }, 143 | }, 144 | }, 145 | Back = { 146 | Enabled = true, 147 | Active = false, 148 | Pressed = false, 149 | Keys = { 150 | { 0, 177 }, 151 | { 1, 177 }, 152 | { 2, 177 }, 153 | { 0, 199 }, 154 | { 1, 199 }, 155 | { 2, 199 }, 156 | }, 157 | }, 158 | Click = { 159 | Enabled = true, 160 | Active = false, 161 | Pressed = false, 162 | Keys = { 163 | { 0, 24 }, 164 | }, 165 | }, 166 | Enabled = { 167 | Controller = { 168 | { 0, 2 }, -- Look Up and Down 169 | { 0, 1 }, -- Look Left and Right 170 | { 0, 25 }, -- Aim 171 | { 0, 24 }, -- Attack 172 | }, 173 | Keyboard = { 174 | { 0, 201 }, -- Select 175 | { 0, 195 }, -- X axis 176 | { 0, 196 }, -- Y axis 177 | { 0, 187 }, -- Down 178 | { 0, 188 }, -- Up 179 | { 0, 189 }, -- Left 180 | { 0, 190 }, -- Right 181 | { 0, 202 }, -- Back 182 | { 0, 217 }, -- Select 183 | { 0, 242 }, -- Scroll down 184 | { 0, 241 }, -- Scroll up 185 | { 0, 239 }, -- Cursor X 186 | { 0, 240 }, -- Cursor Y 187 | { 0, 31 }, -- Move Up and Down 188 | { 0, 30 }, -- Move Left and Right 189 | { 0, 21 }, -- Sprint 190 | { 0, 22 }, -- Jump 191 | { 0, 23 }, -- Enter 192 | { 0, 75 }, -- Exit Vehicle 193 | { 0, 71 }, -- Accelerate Vehicle 194 | { 0, 72 }, -- Vehicle Brake 195 | { 0, 59 }, -- Move Vehicle Left and Right 196 | { 0, 89 }, -- Fly Yaw Left 197 | { 0, 9 }, -- Fly Left and Right 198 | { 0, 8 }, -- Fly Up and Down 199 | { 0, 90 }, -- Fly Yaw Right 200 | { 0, 76 }, -- Vehicle Handbrake 201 | }, 202 | }, 203 | }, 204 | Audio = { 205 | Id = nil, 206 | Use = "NativeUI", 207 | RageUI = { 208 | UpDown = { 209 | audioName = "HUD_FREEMODE_SOUNDSET", 210 | audioRef = "NAV_UP_DOWN", 211 | }, 212 | LeftRight = { 213 | audioName = "HUD_FRONTEND_DEFAULT_SOUNDSET", 214 | audioRef = "NAV_LEFT_RIGHT", 215 | }, 216 | Select = { 217 | audioName = "HUD_FRONTEND_DEFAULT_SOUNDSET", 218 | audioRef = "SELECT", 219 | }, 220 | Back = { 221 | audioName = "HUD_FRONTEND_DEFAULT_SOUNDSET", 222 | audioRef = "BACK", 223 | }, 224 | Error = { 225 | audioName = "HUD_FRONTEND_DEFAULT_SOUNDSET", 226 | audioRef = "ERROR", 227 | }, 228 | Slider = { 229 | audioName = "HUD_FRONTEND_DEFAULT_SOUNDSET", 230 | audioRef = "CONTINUOUS_SLIDER", 231 | Id = nil 232 | }, 233 | }, 234 | NativeUI = { 235 | UpDown = { 236 | audioName = "HUD_FRONTEND_DEFAULT_SOUNDSET", 237 | audioRef = "NAV_UP_DOWN", 238 | }, 239 | LeftRight = { 240 | audioName = "HUD_FRONTEND_DEFAULT_SOUNDSET", 241 | audioRef = "NAV_LEFT_RIGHT", 242 | }, 243 | Select = { 244 | audioName = "HUD_FRONTEND_DEFAULT_SOUNDSET", 245 | audioRef = "SELECT", 246 | }, 247 | Back = { 248 | audioName = "HUD_FRONTEND_DEFAULT_SOUNDSET", 249 | audioRef = "BACK", 250 | }, 251 | Error = { 252 | audioName = "HUD_FRONTEND_DEFAULT_SOUNDSET", 253 | audioRef = "ERROR", 254 | }, 255 | Slider = { 256 | audioName = "HUD_FRONTEND_DEFAULT_SOUNDSET", 257 | audioRef = "CONTINUOUS_SLIDER", 258 | Id = nil 259 | }, 260 | } 261 | }, 262 | Items = { 263 | Title = { 264 | Background = { Width = 431, Height = 107 }, 265 | Text = { X = 215, Y = 20, Scale = 1.15 }, 266 | }, 267 | Subtitle = { 268 | Background = { Width = 431, Height = 37 }, 269 | Text = { X = 8, Y = 3, Scale = 0.35 }, 270 | PreText = { X = 425, Y = 3, Scale = 0.35 }, 271 | }, 272 | Background = { Dictionary = "commonmenu", Texture = "gradient_bgd", Y = 0, Width = 431 }, 273 | Navigation = { 274 | Rectangle = { Width = 431, Height = 18 }, 275 | Offset = 5, 276 | Arrows = { Dictionary = "commonmenu", Texture = "shop_arrows_upanddown", X = 190, Y = -6, Width = 50, Height = 50 }, 277 | }, 278 | Description = { 279 | Bar = { Y = 4, Width = 431, Height = 4 }, 280 | Background = { Dictionary = "commonmenu", Texture = "gradient_bgd", Y = 4, Width = 431, Height = 30 }, 281 | Text = { X = 8, Y = 10, Scale = 0.35 }, 282 | }, 283 | }, 284 | Panels = { 285 | Grid = { 286 | Background = { Dictionary = "commonmenu", Texture = "gradient_bgd", Y = 4, Width = 431, Height = 275 }, 287 | Grid = { Dictionary = "pause_menu_pages_char_mom_dad", Texture = "nose_grid", X = 115.5, Y = 47.5, Width = 200, Height = 200 }, 288 | Circle = { Dictionary = "mpinventory", Texture = "in_world_circle", X = 115.5, Y = 47.5, Width = 20, Height = 20 }, 289 | Text = { 290 | Top = { X = 215.5, Y = 15, Scale = 0.35 }, 291 | Bottom = { X = 215.5, Y = 250, Scale = 0.35 }, 292 | Left = { X = 57.75, Y = 130, Scale = 0.35 }, 293 | Right = { X = 373.25, Y = 130, Scale = 0.35 }, 294 | }, 295 | }, 296 | Percentage = { 297 | Background = { Dictionary = "commonmenu", Texture = "gradient_bgd", Y = 4, Width = 431, Height = 76 }, 298 | Bar = { X = 9, Y = 50, Width = 413, Height = 10 }, 299 | Text = { 300 | Left = { X = 25, Y = 15, Scale = 0.35 }, 301 | Middle = { X = 215.5, Y = 15, Scale = 0.35 }, 302 | Right = { X = 398, Y = 15, Scale = 0.35 }, 303 | }, 304 | }, 305 | }, 306 | } 307 | 308 | function RageUI.SetScaleformParams(scaleform, data) 309 | data = data or {} 310 | for k, v in pairs(data) do 311 | PushScaleformMovieFunction(scaleform, v.name) 312 | if v.param then 313 | for _, par in pairs(v.param) do 314 | if math.type(par) == "integer" then 315 | PushScaleformMovieFunctionParameterInt(par) 316 | elseif type(par) == "boolean" then 317 | PushScaleformMovieFunctionParameterBool(par) 318 | elseif math.type(par) == "float" then 319 | PushScaleformMovieFunctionParameterFloat(par) 320 | elseif type(par) == "string" then 321 | PushScaleformMovieFunctionParameterString(par) 322 | end 323 | end 324 | end 325 | if v.func then 326 | v.func() 327 | end 328 | PopScaleformMovieFunctionVoid() 329 | end 330 | end 331 | 332 | function RageUI.IsMouseInBounds(X, Y, Width, Height) 333 | local MX, MY = math.round(GetControlNormal(2, 239) * 1920) / 1920, math.round(GetControlNormal(2, 240) * 1080) / 1080 334 | X, Y = X / 1920, Y / 1080 335 | Width, Height = Width / 1920, Height / 1080 336 | return (MX >= X and MX <= X + Width) and (MY > Y and MY < Y + Height) 337 | end 338 | 339 | function RageUI.GetSafeZoneBounds() 340 | local SafeSize = GetSafeZoneSize() 341 | SafeSize = math.round(SafeSize, 2) 342 | SafeSize = (SafeSize * 100) - 90 343 | SafeSize = 10 - SafeSize 344 | 345 | local W, H = 1920, 1080 346 | 347 | return { X = math.round(SafeSize * ((W / H) * 5.4)), Y = math.round(SafeSize * 5.4) } 348 | end 349 | 350 | function RageUI.Visible(Menu, Value) 351 | if Menu ~= nil and Menu() then 352 | if Value == true or Value == false then 353 | if Value then 354 | if RageUI.CurrentMenu ~= nil then 355 | if RageUI.CurrentMenu.Closed ~= nil then 356 | RageUI.CurrentMenu.Closed() 357 | end 358 | RageUI.CurrentMenu.Open = not Value 359 | Menu:UpdateInstructionalButtons(Value); 360 | Menu:UpdateCursorStyle(); 361 | 362 | end 363 | RageUI.CurrentMenu = Menu 364 | else 365 | RageUI.CurrentMenu = nil 366 | end 367 | Menu.Open = Value 368 | RageUI.Options = 0 369 | RageUI.ItemOffset = 0 370 | RageUI.LastControl = false 371 | else 372 | return Menu.Open 373 | end 374 | end 375 | end 376 | 377 | function RageUI.CloseAll() 378 | if RageUI.CurrentMenu ~= nil then 379 | local parent = RageUI.CurrentMenu.Parent 380 | while parent ~= nil do 381 | parent.Index = 1 382 | parent.Pagination.Minimum = 1 383 | parent.Pagination.Maximum = parent.Pagination.Total 384 | parent = parent.Parent 385 | end 386 | RageUI.CurrentMenu.Index = 1 387 | RageUI.CurrentMenu.Pagination.Minimum = 1 388 | RageUI.CurrentMenu.Pagination.Maximum = RageUI.CurrentMenu.Pagination.Total 389 | RageUI.CurrentMenu.Open = false 390 | RageUI.CurrentMenu = nil 391 | end 392 | RageUI.Options = 0 393 | RageUI.ItemOffset = 0 394 | ResetScriptGfxAlign() 395 | end 396 | 397 | function RageUI.Banner() 398 | local CurrentMenu = RageUI.CurrentMenu 399 | if CurrentMenu ~= nil then 400 | if CurrentMenu() and (CurrentMenu.Display.Header) then 401 | RageUI.ItemsSafeZone(CurrentMenu) 402 | if CurrentMenu.Sprite ~= nil then 403 | if CurrentMenu.Sprite.Dictionary ~= nil then 404 | if CurrentMenu.Sprite.Dictionary == "commonmenu" then 405 | RenderSprite(CurrentMenu.Sprite.Dictionary, CurrentMenu.Sprite.Texture, CurrentMenu.X, CurrentMenu.Y, RageUI.Settings.Items.Title.Background.Width + CurrentMenu.WidthOffset, RageUI.Settings.Items.Title.Background.Height, CurrentMenu.Sprite.Color.R,CurrentMenu.Sprite.Color.G,CurrentMenu.Sprite.Color.B,CurrentMenu.Sprite.Color.A) 406 | else 407 | RenderSprite(CurrentMenu.Sprite.Dictionary, CurrentMenu.Sprite.Texture, CurrentMenu.X, CurrentMenu.Y, RageUI.Settings.Items.Title.Background.Width + CurrentMenu.WidthOffset, RageUI.Settings.Items.Title.Background.Height, nil) 408 | end 409 | else 410 | RenderRectangle(CurrentMenu.X, CurrentMenu.Y, RageUI.Settings.Items.Title.Background.Width + CurrentMenu.WidthOffset, RageUI.Settings.Items.Title.Background.Height, CurrentMenu.Rectangle.R, CurrentMenu.Rectangle.G, CurrentMenu.Rectangle.B, CurrentMenu.Rectangle.A) 411 | end 412 | else 413 | RenderRectangle(CurrentMenu.X, CurrentMenu.Y, RageUI.Settings.Items.Title.Background.Width + CurrentMenu.WidthOffset, RageUI.Settings.Items.Title.Background.Height, CurrentMenu.Rectangle.R, CurrentMenu.Rectangle.G, CurrentMenu.Rectangle.B, CurrentMenu.Rectangle.A) 414 | end 415 | -- if (CurrentMenu.Display.Glare) then 416 | -- local ScaleformMovie = RequestScaleformMovie("MP_MENU_GLARE") 417 | -- ---@type number 418 | -- local Glarewidth = RageUI.Settings.Items.Title.Background.Width 419 | -- ---@type number 420 | -- local Glareheight = RageUI.Settings.Items.Title.Background.Height 421 | -- ---@type number 422 | -- local GlareX = CurrentMenu.X / 1920 + (CurrentMenu.SafeZoneSize.X / (64.399 - (CurrentMenu.WidthOffset * 0.065731))) 423 | -- ---@type number 424 | -- local GlareY = CurrentMenu.Y / 1080 + CurrentMenu.SafeZoneSize.Y / 33.195020746888 425 | -- RageUI.SetScaleformParams(ScaleformMovie, { 426 | -- { name = "SET_DATA_SLOT", param = { GetGameplayCamRelativeHeading() } } 427 | -- }) 428 | -- DrawScaleformMovie(ScaleformMovie, GlareX, GlareY, Glarewidth / 430, Glareheight / 100, 255, 255, 255, 255, 0) 429 | -- end 430 | RenderText(CurrentMenu.Title, CurrentMenu.X + RageUI.Settings.Items.Title.Text.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + RageUI.Settings.Items.Title.Text.Y, CurrentMenu.TitleFont, CurrentMenu.TitleScale, 255, 255, 255, 255, 1) 431 | RageUI.ItemOffset = RageUI.ItemOffset + RageUI.Settings.Items.Title.Background.Height 432 | end 433 | end 434 | end 435 | 436 | function RageUI.Subtitle() 437 | local CurrentMenu = RageUI.CurrentMenu 438 | if CurrentMenu ~= nil then 439 | if CurrentMenu() and (CurrentMenu.Display.Subtitle) then 440 | RageUI.ItemsSafeZone(CurrentMenu) 441 | if CurrentMenu.Subtitle ~= "" then 442 | RenderRectangle(CurrentMenu.X, CurrentMenu.Y + RageUI.ItemOffset, RageUI.Settings.Items.Subtitle.Background.Width + CurrentMenu.WidthOffset, RageUI.Settings.Items.Subtitle.Background.Height + CurrentMenu.SubtitleHeight, 0, 0, 0, 255) 443 | RenderText(CurrentMenu.PageCounterColour .. CurrentMenu.Subtitle, CurrentMenu.X + RageUI.Settings.Items.Subtitle.Text.X, CurrentMenu.Y + RageUI.Settings.Items.Subtitle.Text.Y + RageUI.ItemOffset, 0, RageUI.Settings.Items.Subtitle.Text.Scale, 245, 245, 245, 255, nil, false, false, RageUI.Settings.Items.Subtitle.Background.Width + CurrentMenu.WidthOffset) 444 | if CurrentMenu.Index > CurrentMenu.Options or CurrentMenu.Index < 0 then 445 | CurrentMenu.Index = 1 446 | end 447 | if (CurrentMenu ~= nil) then 448 | if (CurrentMenu.Index > CurrentMenu.Pagination.Total) then 449 | local offset = CurrentMenu.Index - CurrentMenu.Pagination.Total 450 | CurrentMenu.Pagination.Minimum = 1 + offset 451 | CurrentMenu.Pagination.Maximum = CurrentMenu.Pagination.Total + offset 452 | else 453 | CurrentMenu.Pagination.Minimum = 1 454 | CurrentMenu.Pagination.Maximum = CurrentMenu.Pagination.Total 455 | end 456 | end 457 | 458 | if CurrentMenu.Display.PageCounter then 459 | if CurrentMenu.PageCounter == nil then 460 | RenderText(CurrentMenu.PageCounterColour .. CurrentMenu.Index .. " / " .. CurrentMenu.Options, CurrentMenu.X + RageUI.Settings.Items.Subtitle.PreText.X + CurrentMenu.WidthOffset, CurrentMenu.Y + RageUI.Settings.Items.Subtitle.PreText.Y + RageUI.ItemOffset, 0, RageUI.Settings.Items.Subtitle.PreText.Scale, 245, 245, 245, 255, 2) 461 | else 462 | RenderText(CurrentMenu.PageCounter, CurrentMenu.X + RageUI.Settings.Items.Subtitle.PreText.X + CurrentMenu.WidthOffset, CurrentMenu.Y + RageUI.Settings.Items.Subtitle.PreText.Y + RageUI.ItemOffset, 0, RageUI.Settings.Items.Subtitle.PreText.Scale, 245, 245, 245, 255, 2) 463 | end 464 | end 465 | RageUI.ItemOffset = RageUI.ItemOffset + RageUI.Settings.Items.Subtitle.Background.Height 466 | end 467 | end 468 | end 469 | end 470 | 471 | function RageUI.Background() 472 | local CurrentMenu = RageUI.CurrentMenu; 473 | if CurrentMenu ~= nil then 474 | if CurrentMenu() and (CurrentMenu.Display.Background) then 475 | RageUI.ItemsSafeZone(CurrentMenu) 476 | SetScriptGfxDrawOrder(0) 477 | RenderSprite(RageUI.Settings.Items.Background.Dictionary, RageUI.Settings.Items.Background.Texture, CurrentMenu.X, CurrentMenu.Y + RageUI.Settings.Items.Background.Y + CurrentMenu.SubtitleHeight, RageUI.Settings.Items.Background.Width + CurrentMenu.WidthOffset, RageUI.ItemOffset, 0, 0, 0, 0, 255) 478 | SetScriptGfxDrawOrder(1) 479 | end 480 | end 481 | end 482 | 483 | function RageUI.Description() 484 | local CurrentMenu = RageUI.CurrentMenu; 485 | local Description = RageUI.Settings.Items.Description; 486 | if CurrentMenu ~= nil and CurrentMenu.Description ~= nil then 487 | if CurrentMenu() then 488 | RageUI.ItemsSafeZone(CurrentMenu) 489 | RenderRectangle(CurrentMenu.X, CurrentMenu.Y + Description.Bar.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Description.Bar.Width + CurrentMenu.WidthOffset, Description.Bar.Height, 0, 0, 0, 255) 490 | RenderSprite(Description.Background.Dictionary, Description.Background.Texture, CurrentMenu.X, CurrentMenu.Y + Description.Background.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Description.Background.Width + CurrentMenu.WidthOffset, CurrentMenu.DescriptionHeight, 0, 0, 0, 255) 491 | RenderText(CurrentMenu.Description, CurrentMenu.X + Description.Text.X, CurrentMenu.Y + Description.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, Description.Text.Scale, 255, 255, 255, 255, nil, false, false, Description.Background.Width + CurrentMenu.WidthOffset - 8.0) 492 | RageUI.ItemOffset = RageUI.ItemOffset + CurrentMenu.DescriptionHeight + Description.Bar.Y 493 | end 494 | end 495 | end 496 | 497 | function RageUI.Render() 498 | local CurrentMenu = RageUI.CurrentMenu; 499 | if CurrentMenu ~= nil then 500 | if CurrentMenu() then 501 | if CurrentMenu.Safezone then 502 | ResetScriptGfxAlign() 503 | end 504 | 505 | if (CurrentMenu.Display.InstructionalButton) then 506 | if not CurrentMenu.InitScaleform then 507 | CurrentMenu:UpdateInstructionalButtons(true) 508 | CurrentMenu.InitScaleform = true 509 | end 510 | DrawScaleformMovieFullscreen(CurrentMenu.InstructionalScaleform, 255, 255, 255, 255, 0) 511 | end 512 | CurrentMenu.Options = RageUI.Options 513 | CurrentMenu.SafeZoneSize = nil 514 | RageUI.Controls() 515 | RageUI.Options = 0 516 | RageUI.StatisticPanelCount = 0 517 | RageUI.ItemOffset = 0 518 | if CurrentMenu.Controls.Back.Enabled then 519 | if CurrentMenu.Controls.Back.Pressed and CurrentMenu.Closable then 520 | CurrentMenu.Controls.Back.Pressed = false 521 | local Audio = RageUI.Settings.Audio 522 | RageUI.PlaySound(Audio[Audio.Use].Back.audioName, Audio[Audio.Use].Back.audioRef) 523 | if CurrentMenu.Closed ~= nil then 524 | collectgarbage() 525 | CurrentMenu.Closed() 526 | end 527 | 528 | if CurrentMenu.Parent ~= nil then 529 | if CurrentMenu.Parent() then 530 | RageUI.NextMenu = CurrentMenu.Parent 531 | CurrentMenu:UpdateCursorStyle() 532 | else 533 | RageUI.NextMenu = nil 534 | RageUI.Visible(CurrentMenu, false) 535 | end 536 | else 537 | RageUI.NextMenu = nil 538 | RageUI.Visible(CurrentMenu, false) 539 | end 540 | elseif CurrentMenu.Controls.Back.Pressed and not CurrentMenu.Closable then 541 | CurrentMenu.Controls.Back.Pressed = false 542 | end 543 | end 544 | if RageUI.NextMenu ~= nil then 545 | if RageUI.NextMenu() then 546 | RageUI.Visible(CurrentMenu, false) 547 | RageUI.Visible(RageUI.NextMenu, true) 548 | CurrentMenu.Controls.Select.Active = false 549 | RageUI.NextMenu = nil 550 | RageUI.LastControl = false 551 | end 552 | end 553 | end 554 | end 555 | end 556 | 557 | function RageUI.ItemsDescription(CurrentMenu, Description, Selected) 558 | ---@type table 559 | if Description ~= "" or Description ~= nil then 560 | local SettingsDescription = RageUI.Settings.Items.Description; 561 | if Selected and CurrentMenu.Description ~= Description then 562 | CurrentMenu.Description = Description or nil 563 | ---@type number 564 | local DescriptionLineCount = GetLineCount(CurrentMenu.Description, CurrentMenu.X + SettingsDescription.Text.X, CurrentMenu.Y + SettingsDescription.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsDescription.Text.Scale, 255, 255, 255, 255, nil, false, false, SettingsDescription.Background.Width + (CurrentMenu.WidthOffset - 5.0)) 565 | if DescriptionLineCount > 1 then 566 | CurrentMenu.DescriptionHeight = SettingsDescription.Background.Height * DescriptionLineCount 567 | else 568 | CurrentMenu.DescriptionHeight = SettingsDescription.Background.Height + 7 569 | end 570 | end 571 | end 572 | end 573 | 574 | function RageUI.ItemsMouseBounds(CurrentMenu, Selected, Option, SettingsButton) 575 | ---@type boolean 576 | local Hovered = false 577 | Hovered = RageUI.IsMouseInBounds(CurrentMenu.X + CurrentMenu.SafeZoneSize.X, CurrentMenu.Y + SettingsButton.Rectangle.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight , SettingsButton.Rectangle.Width + CurrentMenu.WidthOffset, SettingsButton.Rectangle.Height) 578 | if Hovered and not Selected then 579 | RenderRectangle(CurrentMenu.X, CurrentMenu.Y + SettingsButton.Rectangle.Y + CurrentMenu.SubtitleHeight, SettingsButton.Rectangle.Width + CurrentMenu.WidthOffset, SettingsButton.Rectangle.Height, 255, 255, 255, 20) 580 | if CurrentMenu.Controls.Click.Active then 581 | CurrentMenu.Index = Option 582 | local Audio = RageUI.Settings.Audio 583 | RageUI.PlaySound(Audio[Audio.Use].UpDown.audioName, Audio[Audio.Use].UpDown.audioRef) 584 | end 585 | end 586 | return Hovered; 587 | end 588 | 589 | function RageUI.ItemsSafeZone(CurrentMenu) 590 | if not CurrentMenu.SafeZoneSize then 591 | CurrentMenu.SafeZoneSize = { X = 0, Y = 0 } 592 | if CurrentMenu.Safezone then 593 | CurrentMenu.SafeZoneSize = RageUI.GetSafeZoneBounds() 594 | SetScriptGfxAlign(76, 84) 595 | SetScriptGfxAlignParams(0, 0, 0, 0) 596 | end 597 | end 598 | end 599 | 600 | function RageUI.CurrentIsEqualTo(Current, To, Style, DefaultStyle) 601 | return Current == To and Style or DefaultStyle or {}; 602 | end 603 | 604 | function RageUI.IsVisible(Menu, Items, Panels) 605 | if (RageUI.Visible(Menu)) and (UpdateOnscreenKeyboard() ~= 0) and (UpdateOnscreenKeyboard() ~= 3) then 606 | RageUI.Banner() 607 | RageUI.Subtitle() 608 | if (Items ~= nil) then 609 | Items() 610 | end 611 | RageUI.Background(); 612 | RageUI.Navigation(); 613 | RageUI.Description(); 614 | if (Panels ~= nil) then 615 | Panels() 616 | end 617 | RageUI.Render() 618 | end 619 | end 620 | 621 | ---SetStyleAudio 622 | ---@param StyleAudio string 623 | ---@return void 624 | ---@public 625 | function RageUI.SetStyleAudio(StyleAudio) 626 | RageUI.Settings.Audio.Use = StyleAudio or "RageUI" 627 | end 628 | 629 | function RageUI.GetStyleAudio() 630 | return RageUI.Settings.Audio.Use or "RageUI" 631 | end 632 | 633 | -------------------------------------------------------------------------------- /RageUI/menu/elements/ItemsBadge.lua: -------------------------------------------------------------------------------- 1 | RageUI.BadgeStyle = { 2 | -- DEFAULT BADGE 3 | None = function() 4 | return { 5 | BadgeTexture = "", 6 | BadgeDictionary = "commonmenu" 7 | } 8 | end, 9 | BronzeMedal = function() 10 | return { 11 | BadgeTexture = "mp_medal_bronze", 12 | } 13 | end, 14 | GoldMedal = function() 15 | return { 16 | BadgeTexture = "mp_medal_gold", 17 | } 18 | end, 19 | SilverMedal = function() 20 | return { 21 | BadgeTexture = "medal_silver", 22 | } 23 | end, 24 | Alert = function() 25 | return { 26 | BadgeTexture = "mp_alerttriangle", 27 | } 28 | end, 29 | Crown = function(Selected) 30 | return { 31 | BadgeTexture = "mp_hostcrown", 32 | BadgeColour = Selected and { R = 0, G = 0, B = 0, A = 255 } or { R = 255, G = 255, B = 255, A = 255 } 33 | } 34 | end, 35 | Ammo = function(Selected) 36 | return { 37 | BadgeTexture = Selected and "shop_ammo_icon_b" or "shop_ammo_icon_a", 38 | } 39 | end, 40 | Armour = function(Selected) 41 | return { 42 | BadgeTexture = Selected and "shop_armour_icon_b" or "shop_armour_icon_a", 43 | } 44 | end, 45 | Barber = function(Selected) 46 | return { 47 | BadgeTexture = Selected and "shop_barber_icon_b" or "shop_barber_icon_a", 48 | } 49 | end, 50 | Clothes = function(Selected) 51 | return { 52 | BadgeTexture = Selected and "shop_clothing_icon_b" or "shop_clothing_icon_a", 53 | } 54 | end, 55 | Franklin = function(Selected) 56 | return { 57 | BadgeTexture = Selected and "shop_franklin_icon_b" or "shop_franklin_icon_a", 58 | } 59 | end, 60 | Bike = function(Selected) 61 | return { 62 | BadgeTexture = Selected and "shop_garage_bike_icon_b" or "shop_garage_bike_icon_a", 63 | } 64 | end, 65 | Car = function(Selected) 66 | return { 67 | BadgeTexture = Selected and "shop_garage_icon_b" or "shop_garage_icon_a", 68 | } 69 | end, 70 | Boat = function(Selected) 71 | return { 72 | BadgeTexture = Selected and "mp_specitem_boat_black" or "mp_specitem_boat", 73 | BadgeDictionary = "mpinventory" 74 | } 75 | end, 76 | Heli = function(Selected) 77 | return { 78 | BadgeTexture = Selected and "mp_specitem_heli_black" or "mp_specitem_heli", 79 | BadgeDictionary = "mpinventory" 80 | } 81 | end, 82 | Plane = function(Selected) 83 | return { 84 | BadgeTexture = Selected and "mp_specitem_plane_black" or "mp_specitem_plane", 85 | BadgeDictionary = "mpinventory" 86 | } 87 | end, 88 | BoatPickup = function(Selected) 89 | return { 90 | BadgeTexture = Selected and "mp_specitem_boatpickup_black" or "mp_specitem_boatpickup", 91 | BadgeDictionary = "mpinventory" 92 | } 93 | end, 94 | Card = function(Selected) 95 | return { 96 | BadgeTexture = Selected and "mp_specitem_keycard_black" or "mp_specitem_keycard", 97 | BadgeDictionary = "mpinventory" 98 | } 99 | end, 100 | Gun = function(Selected) 101 | return { 102 | BadgeTexture = Selected and "shop_gunclub_icon_b" or "shop_gunclub_icon_a", 103 | } 104 | end, 105 | Heart = function(Selected) 106 | return { 107 | BadgeTexture = Selected and "shop_health_icon_b" or "shop_health_icon_a", 108 | } 109 | end, 110 | Makeup = function(Selected) 111 | return { 112 | BadgeTexture = Selected and "shop_makeup_icon_b" or "shop_makeup_icon_a", 113 | } 114 | end, 115 | Mask = function(Selected) 116 | return { 117 | BadgeTexture = Selected and "shop_mask_icon_b" or "shop_mask_icon_a", 118 | } 119 | end, 120 | Michael = function(Selected) 121 | return { 122 | BadgeTexture = Selected and "shop_michael_icon_b" or "shop_michael_icon_a", 123 | } 124 | end, 125 | Star = function() 126 | return { 127 | BadgeTexture = "shop_new_star", 128 | } 129 | end, 130 | Tattoo = function(Selected) 131 | return { 132 | BadgeTexture = Selected and "shop_tattoos_icon_b" or "shop_tattoos_icon_a", 133 | } 134 | end, 135 | Trevor = function(Selected) 136 | return { 137 | BadgeTexture = Selected and "shop_trevor_icon_b" or "shop_trevor_icon_a", 138 | } 139 | end, 140 | Lock = function(Selected) 141 | return { 142 | BadgeTexture = "shop_lock", 143 | BadgeColour = Selected and { R = 0, G = 0, B = 0, A = 255 } or { R = 255, G = 255, B = 255, A = 255 } 144 | } 145 | end, 146 | Tick = function(Selected) 147 | return { 148 | BadgeTexture = "shop_tick_icon", 149 | BadgeColour = Selected and { R = 0, G = 0, B = 0, A = 255 } or { R = 255, G = 255, B = 255, A = 255 } 150 | } 151 | end, 152 | Key = function(Selected) 153 | return { 154 | BadgeTexture = Selected and "mp_specitem_cuffkeys_black" or "mp_specitem_cuffkeys", 155 | BadgeDictionary = "mpinventory" 156 | } 157 | end, 158 | Coke = function(Selected) 159 | return { 160 | BadgeTexture = Selected and "mp_specitem_coke_black" or "mp_specitem_coke", 161 | BadgeDictionary = "mpinventory" 162 | } 163 | end, 164 | Heroin = function(Selected) 165 | return { 166 | BadgeTexture = Selected and "mp_specitem_heroin_black" or "mp_specitem_heroin", 167 | BadgeDictionary = "mpinventory" 168 | } 169 | end, 170 | Meth = function(Selected) 171 | return { 172 | BadgeTexture = Selected and "mp_specitem_meth_black" or "mp_specitem_meth", 173 | BadgeDictionary = "mpinventory" 174 | } 175 | end, 176 | Weed = function(Selected) 177 | return { 178 | BadgeTexture = Selected and "mp_specitem_weed_black" or "mp_specitem_weed", 179 | BadgeDictionary = "mpinventory" 180 | } 181 | end, 182 | Package = function(Selected) 183 | return { 184 | BadgeTexture = Selected and "mp_specitem_package_black" or "mp_specitem_package", 185 | BadgeDictionary = "mpinventory" 186 | } 187 | end, 188 | Cash = function(Selected) 189 | return { 190 | BadgeTexture = Selected and "mp_specitem_cash_black" or "mp_specitem_cash", 191 | BadgeDictionary = "mpinventory" 192 | } 193 | end, 194 | RP = function(Selected) 195 | return { 196 | BadgeTexture = "mp_anim_rp", 197 | BadgeDictionary = "mphud" 198 | } 199 | end, 200 | LSPD = function() 201 | return { 202 | BadgeTexture = "mpgroundlogo_cops", 203 | BadgeDictionary = "3dtextures" 204 | } 205 | end, 206 | Vagos = function() 207 | return { 208 | BadgeTexture = "mpgroundlogo_vagos", 209 | BadgeDictionary = "3dtextures" 210 | } 211 | end, 212 | Bikers = function() 213 | return { 214 | BadgeTexture = "mpgroundlogo_bikers", 215 | BadgeDictionary = "3dtextures" 216 | } 217 | end, 218 | 219 | -- CASINO 220 | Badbeat = function() 221 | return { 222 | BadgeTexture = "badbeat", 223 | BadgeDictionary = "mpawardcasino" 224 | } 225 | end, 226 | CashingOut = function() 227 | return { 228 | BadgeTexture = "cashingout", 229 | BadgeDictionary = "mpawardcasino" 230 | } 231 | end, 232 | FullHouse = function() 233 | return { 234 | BadgeTexture = "fullhouse", 235 | BadgeDictionary = "mpawardcasino" 236 | } 237 | end, 238 | HighRoller = function() 239 | return { 240 | BadgeTexture = "highroller", 241 | BadgeDictionary = "mpawardcasino" 242 | } 243 | end, 244 | HouseKeeping = function() 245 | return { 246 | BadgeTexture = "housekeeping", 247 | BadgeDictionary = "mpawardcasino" 248 | } 249 | end, 250 | LooseCheng = function() 251 | return { 252 | BadgeTexture = "loosecheng", 253 | BadgeDictionary = "mpawardcasino" 254 | } 255 | end, 256 | LuckyLucky = function() 257 | return { 258 | BadgeTexture = "luckylucky", 259 | BadgeDictionary = "mpawardcasino" 260 | } 261 | end, 262 | PlayToWin = function() 263 | return { 264 | BadgeTexture = "playtowin", 265 | BadgeDictionary = "mpawardcasino" 266 | } 267 | end, 268 | StraightFlush = function() 269 | return { 270 | BadgeTexture = "straightflush", 271 | BadgeDictionary = "mpawardcasino" 272 | } 273 | end, 274 | StrongArmTactics = function() 275 | return { 276 | BadgeTexture = "strongarmtactics", 277 | BadgeDictionary = "mpawardcasino" 278 | } 279 | end, 280 | TopPair = function() 281 | return { 282 | BadgeTexture = "toppair", 283 | BadgeDictionary = "mpawardcasino" 284 | } 285 | end, 286 | } -------------------------------------------------------------------------------- /RageUI/menu/elements/ItemsColour.lua: -------------------------------------------------------------------------------- 1 | --- 2 | --- Generated by EmmyLua(https://github.com/EmmyLua) 3 | --- Created by Dylan Malandain. 4 | --- DateTime: 24/07/2019 02:26 5 | --- 6 | 7 | RageUI.ItemsColour = { 8 | PureWhite = { 255, 255, 255, 255 }, 9 | White = { 240, 240, 240, 255 }, 10 | Black = { 0, 0, 0, 255 }, 11 | Grey = { 155, 155, 155, 255 }, 12 | GreyLight = { 205, 205, 205, 255 }, 13 | GreyDark = { 77, 77, 77, 255 }, 14 | Red = { 224, 50, 50, 255 }, 15 | RedLight = { 240, 153, 153, 255 }, 16 | RedDark = { 112, 25, 25, 255 }, 17 | Blue = { 93, 182, 229, 255 }, 18 | BlueLight = { 174, 219, 242, 255 }, 19 | BlueDark = { 47, 92, 115, 255 }, 20 | Yellow = { 240, 200, 80, 255 }, 21 | YellowLight = { 254, 235, 169, 255 }, 22 | YellowDark = { 126, 107, 41, 255 }, 23 | Orange = { 255, 133, 85, 255 }, 24 | OrangeLight = { 255, 194, 170, 255 }, 25 | OrangeDark = { 127, 66, 42, 255 }, 26 | Green = { 114, 204, 114, 255 }, 27 | GreenLight = { 185, 230, 185, 255 }, 28 | GreenDark = { 57, 102, 57, 255 }, 29 | Purple = { 132, 102, 226, 255 }, 30 | PurpleLight = { 192, 179, 239, 255 }, 31 | PurpleDark = { 67, 57, 111, 255 }, 32 | Pink = { 203, 54, 148, 255 }, 33 | RadarHealth = { 53, 154, 71, 255 }, 34 | RadarArmour = { 93, 182, 229, 255 }, 35 | RadarDamage = { 235, 36, 39, 255 }, 36 | NetPlayer1 = { 194, 80, 80, 255 }, 37 | NetPlayer2 = { 156, 110, 175, 255 }, 38 | NetPlayer3 = { 255, 123, 196, 255 }, 39 | NetPlayer4 = { 247, 159, 123, 255 }, 40 | NetPlayer5 = { 178, 144, 132, 255 }, 41 | NetPlayer6 = { 141, 206, 167, 255 }, 42 | NetPlayer7 = { 113, 169, 175, 255 }, 43 | NetPlayer8 = { 211, 209, 231, 255 }, 44 | NetPlayer9 = { 144, 127, 153, 255 }, 45 | NetPlayer10 = { 106, 196, 191, 255 }, 46 | NetPlayer11 = { 214, 196, 153, 255 }, 47 | NetPlayer12 = { 234, 142, 80, 255 }, 48 | NetPlayer13 = { 152, 203, 234, 255 }, 49 | NetPlayer14 = { 178, 98, 135, 255 }, 50 | NetPlayer15 = { 144, 142, 122, 255 }, 51 | NetPlayer16 = { 166, 117, 94, 255 }, 52 | NetPlayer17 = { 175, 168, 168, 255 }, 53 | NetPlayer18 = { 232, 142, 155, 255 }, 54 | NetPlayer19 = { 187, 214, 91, 255 }, 55 | NetPlayer20 = { 12, 123, 86, 255 }, 56 | NetPlayer21 = { 123, 196, 255, 255 }, 57 | NetPlayer22 = { 171, 60, 230, 255 }, 58 | NetPlayer23 = { 206, 169, 13, 255 }, 59 | NetPlayer24 = { 71, 99, 173, 255 }, 60 | NetPlayer25 = { 42, 166, 185, 255 }, 61 | NetPlayer26 = { 186, 157, 125, 255 }, 62 | NetPlayer27 = { 201, 225, 255, 255 }, 63 | NetPlayer28 = { 240, 240, 150, 255 }, 64 | NetPlayer29 = { 237, 140, 161, 255 }, 65 | NetPlayer30 = { 249, 138, 138, 255 }, 66 | NetPlayer31 = { 252, 239, 166, 255 }, 67 | NetPlayer32 = { 240, 240, 240, 255 }, 68 | SimpleBlipDefault = { 159, 201, 166, 255 }, 69 | MenuBlue = { 140, 140, 140, 255 }, 70 | MenuGreyLight = { 140, 140, 140, 255 }, 71 | MenuBlueExtraDark = { 40, 40, 40, 255 }, 72 | MenuYellow = { 240, 160, 0, 255 }, 73 | MenuYellowDark = { 240, 160, 0, 255 }, 74 | MenuGreen = { 240, 160, 0, 255 }, 75 | MenuGrey = { 140, 140, 140, 255 }, 76 | MenuGreyDark = { 60, 60, 60, 255 }, 77 | MenuHighlight = { 30, 30, 30, 255 }, 78 | MenuStandard = { 140, 140, 140, 255 }, 79 | MenuDimmed = { 75, 75, 75, 255 }, 80 | MenuExtraDimmed = { 50, 50, 50, 255 }, 81 | BriefTitle = { 95, 95, 95, 255 }, 82 | MidGreyMp = { 100, 100, 100, 255 }, 83 | NetPlayer1Dark = { 93, 39, 39, 255 }, 84 | NetPlayer2Dark = { 77, 55, 89, 255 }, 85 | NetPlayer3Dark = { 124, 62, 99, 255 }, 86 | NetPlayer4Dark = { 120, 80, 80, 255 }, 87 | NetPlayer5Dark = { 87, 72, 66, 255 }, 88 | NetPlayer6Dark = { 74, 103, 83, 255 }, 89 | NetPlayer7Dark = { 60, 85, 88, 255 }, 90 | NetPlayer8Dark = { 105, 105, 64, 255 }, 91 | NetPlayer9Dark = { 72, 63, 76, 255 }, 92 | NetPlayer10Dark = { 53, 98, 95, 255 }, 93 | NetPlayer11Dark = { 107, 98, 76, 255 }, 94 | NetPlayer12Dark = { 117, 71, 40, 255 }, 95 | NetPlayer13Dark = { 76, 101, 117, 255 }, 96 | NetPlayer14Dark = { 65, 35, 47, 255 }, 97 | NetPlayer15Dark = { 72, 71, 61, 255 }, 98 | NetPlayer16Dark = { 85, 58, 47, 255 }, 99 | NetPlayer17Dark = { 87, 84, 84, 255 }, 100 | NetPlayer18Dark = { 116, 71, 77, 255 }, 101 | NetPlayer19Dark = { 93, 107, 45, 255 }, 102 | NetPlayer20Dark = { 6, 61, 43, 255 }, 103 | NetPlayer21Dark = { 61, 98, 127, 255 }, 104 | NetPlayer22Dark = { 85, 30, 115, 255 }, 105 | NetPlayer23Dark = { 103, 84, 6, 255 }, 106 | NetPlayer24Dark = { 35, 49, 86, 255 }, 107 | NetPlayer25Dark = { 21, 83, 92, 255 }, 108 | NetPlayer26Dark = { 93, 98, 62, 255 }, 109 | NetPlayer27Dark = { 100, 112, 127, 255 }, 110 | NetPlayer28Dark = { 120, 120, 75, 255 }, 111 | NetPlayer29Dark = { 152, 76, 93, 255 }, 112 | NetPlayer30Dark = { 124, 69, 69, 255 }, 113 | NetPlayer31Dark = { 10, 43, 50, 255 }, 114 | NetPlayer32Dark = { 95, 95, 10, 255 }, 115 | Bronze = { 180, 130, 97, 255 }, 116 | Silver = { 150, 153, 161, 255 }, 117 | Gold = { 214, 181, 99, 255 }, 118 | Platinum = { 166, 221, 190, 255 }, 119 | Gang1 = { 29, 100, 153, 255 }, 120 | Gang2 = { 214, 116, 15, 255 }, 121 | Gang3 = { 135, 125, 142, 255 }, 122 | Gang4 = { 229, 119, 185, 255 }, 123 | SameCrew = { 252, 239, 166, 255 }, 124 | Freemode = { 45, 110, 185, 255 }, 125 | PauseBg = { 0, 0, 0, 255 }, 126 | Friendly = { 93, 182, 229, 255 }, 127 | Enemy = { 194, 80, 80, 255 }, 128 | Location = { 240, 200, 80, 255 }, 129 | Pickup = { 114, 204, 114, 255 }, 130 | PauseSingleplayer = { 114, 204, 114, 255 }, 131 | FreemodeDark = { 22, 55, 92, 255 }, 132 | InactiveMission = { 154, 154, 154, 255 }, 133 | Damage = { 194, 80, 80, 255 }, 134 | PinkLight = { 252, 115, 201, 255 }, 135 | PmMitemHighlight = { 252, 177, 49, 255 }, 136 | ScriptVariable = { 0, 0, 0, 255 }, 137 | Yoga = { 109, 247, 204, 255 }, 138 | Tennis = { 241, 101, 34, 255 }, 139 | Golf = { 214, 189, 97, 255 }, 140 | ShootingRange = { 112, 25, 25, 255 }, 141 | FlightSchool = { 47, 92, 115, 255 }, 142 | NorthBlue = { 93, 182, 229, 255 }, 143 | SocialClub = { 234, 153, 28, 255 }, 144 | PlatformBlue = { 11, 55, 123, 255 }, 145 | PlatformGreen = { 146, 200, 62, 255 }, 146 | PlatformGrey = { 234, 153, 28, 255 }, 147 | FacebookBlue = { 66, 89, 148, 255 }, 148 | IngameBg = { 0, 0, 0, 255 }, 149 | Darts = { 114, 204, 114, 255 }, 150 | Waypoint = { 164, 76, 242, 255 }, 151 | Michael = { 101, 180, 212, 255 }, 152 | Franklin = { 171, 237, 171, 255 }, 153 | Trevor = { 255, 163, 87, 255 }, 154 | GolfP1 = { 240, 240, 240, 255 }, 155 | GolfP2 = { 235, 239, 30, 255 }, 156 | GolfP3 = { 255, 149, 14, 255 }, 157 | GolfP4 = { 246, 60, 161, 255 }, 158 | WaypointLight = { 210, 166, 249, 255 }, 159 | WaypointDark = { 82, 38, 121, 255 }, 160 | PanelLight = { 0, 0, 0, 255 }, 161 | MichaelDark = { 72, 103, 116, 255 }, 162 | FranklinDark = { 85, 118, 85, 255 }, 163 | TrevorDark = { 127, 81, 43, 255 }, 164 | ObjectiveRoute = { 240, 200, 80, 255 }, 165 | PausemapTint = { 0, 0, 0, 255 }, 166 | PauseDeselect = { 100, 100, 100, 255 }, 167 | PmWeaponsPurchasable = { 45, 110, 185, 255 }, 168 | PmWeaponsLocked = { 240, 240, 240, 255 }, 169 | ScreenBg = { 0, 0, 0, 255 }, 170 | Chop = { 224, 50, 50, 255 }, 171 | PausemapTintHalf = { 0, 0, 0, 255 }, 172 | NorthBlueOfficial = { 0, 71, 133, 255 }, 173 | ScriptVariable2 = { 0, 0, 0, 255 }, 174 | H = { 33, 118, 37, 255 }, 175 | HDark = { 37, 102, 40, 255 }, 176 | T = { 234, 153, 28, 255 }, 177 | TDark = { 225, 140, 8, 255 }, 178 | HShard = { 20, 40, 0, 255 }, 179 | ControllerMichael = { 48, 255, 255, 255 }, 180 | ControllerFranklin = { 48, 255, 0, 255 }, 181 | ControllerTrevor = { 176, 80, 0, 255 }, 182 | ControllerChop = { 127, 0, 0, 255 }, 183 | VideoEditorVideo = { 53, 166, 224, 255 }, 184 | VideoEditorAudio = { 162, 79, 157, 255 }, 185 | VideoEditorText = { 104, 192, 141, 255 }, 186 | HbBlue = { 29, 100, 153, 255 }, 187 | HbYellow = { 234, 153, 28, 255 }, 188 | VideoEditorScore = { 240, 160, 1, 255 }, 189 | VideoEditorAudioFadeout = { 59, 34, 57, 255 }, 190 | VideoEditorTextFadeout = { 41, 68, 53, 255 }, 191 | VideoEditorScoreFadeout = { 82, 58, 10, 255 }, 192 | HeistBackground = { 37, 102, 40, 255 }, 193 | VideoEditorAmbient = { 240, 200, 80, 255 }, 194 | VideoEditorAmbientFadeout = { 80, 70, 34, 255 }, 195 | Gb = { 255, 133, 85, 255 }, 196 | G = { 255, 194, 170, 255 }, 197 | B = { 255, 133, 85, 255 }, 198 | LowFlow = { 240, 200, 80, 255 }, 199 | LowFlowDark = { 126, 107, 41, 255 }, 200 | G1 = { 247, 159, 123, 255 }, 201 | G2 = { 226, 134, 187, 255 }, 202 | G3 = { 239, 238, 151, 255 }, 203 | G4 = { 113, 169, 175, 255 }, 204 | G5 = { 160, 140, 193, 255 }, 205 | G6 = { 141, 206, 167, 255 }, 206 | G7 = { 181, 214, 234, 255 }, 207 | G8 = { 178, 144, 132, 255 }, 208 | G9 = { 0, 132, 114, 255 }, 209 | G10 = { 216, 85, 117, 255 }, 210 | G11 = { 30, 100, 152, 255 }, 211 | G12 = { 43, 181, 117, 255 }, 212 | G13 = { 233, 141, 79, 255 }, 213 | G14 = { 137, 210, 215, 255 }, 214 | G15 = { 134, 125, 141, 255 }, 215 | Adversary = { 109, 34, 33, 255 }, 216 | DegenRed = { 255, 0, 0, 255 }, 217 | DegenYellow = { 255, 255, 0, 255 }, 218 | DegenGreen = { 0, 255, 0, 255 }, 219 | DegenCyan = { 0, 255, 255, 255 }, 220 | DegenBlue = { 0, 0, 255, 255 }, 221 | DegenMagenta = { 255, 0, 255, 255 }, 222 | Stunt1 = { 38, 136, 234, 255 }, 223 | Stunt2 = { 224, 50, 50, 255 }, 224 | } 225 | 226 | -------------------------------------------------------------------------------- /RageUI/menu/elements/PanelColour.lua: -------------------------------------------------------------------------------- 1 | RageUI.PanelColour = { 2 | HairCut = { 3 | { 28, 31, 33 }, -- 0 4 | { 39, 42, 44 }, -- 1 5 | { 49, 46, 44 }, -- 2 6 | { 53, 38, 28 }, -- 3 7 | { 75, 50, 31 }, -- 4 8 | { 92, 59, 36 }, -- 5 9 | { 109, 76, 53 }, -- 6 10 | { 107, 80, 59 }, -- 7 11 | { 118, 92, 69 }, -- 8 12 | { 127, 104, 78 }, -- 9 13 | { 153, 129, 93 }, -- 10 14 | { 167, 147, 105 }, -- 11 15 | { 175, 156, 112 }, -- 12 16 | { 187, 160, 99 }, -- 13 17 | { 214, 185, 123 }, -- 14 18 | { 218, 195, 142 }, -- 15 19 | { 159, 127, 89 }, -- 16 20 | { 132, 80, 57 }, -- 17 21 | { 104, 43, 31 }, -- 18 22 | { 97, 18, 12 }, -- 19 23 | { 100, 15, 10 }, -- 20 24 | { 124, 20, 15 }, -- 21 25 | { 160, 46, 25 }, -- 22 26 | { 182, 75, 40 }, -- 23 27 | { 162, 80, 47 }, -- 24 28 | { 170, 78, 43 }, -- 25 29 | { 98, 98, 98 }, -- 26 30 | { 128, 128, 128}, -- 27 31 | { 170, 170, 170 }, -- 28 32 | { 197, 197, 197 }, -- 29 33 | { 70, 57, 85 }, -- 30 34 | { 90, 63, 107 }, -- 31 35 | { 118, 60, 118 }, -- 32 36 | { 237, 116, 227 }, -- 33 37 | { 235, 75, 147 }, -- 34 38 | { 242, 153, 188 }, -- 35 39 | { 4, 149, 158 }, -- 36 40 | { 2, 95, 134 }, -- 37 41 | { 2, 57, 116 }, -- 38 42 | { 63, 161, 106 }, -- 39 43 | { 33, 124, 97 }, -- 40 44 | { 24, 92, 85 }, -- 41 45 | { 182, 192, 52 }, -- 42 46 | { 112, 169, 11 }, -- 43 47 | { 67, 157, 19 }, -- 44 48 | { 220, 184, 87 }, -- 45 49 | { 229, 177, 3 }, -- 46 50 | { 230, 145, 2 }, -- 47 51 | { 242, 136, 49 }, -- 48 52 | { 251, 128, 87 }, -- 49 53 | { 226, 139, 88 }, -- 50 54 | { 209, 89, 60 }, -- 51 55 | { 206, 49, 32 }, -- 52 56 | { 173, 9, 3 }, -- 53 57 | { 136, 3, 2 }, -- 54 58 | { 31, 24, 20 }, -- 55 59 | { 41, 31, 25 }, -- 56 60 | { 46, 34, 27 }, -- 57 61 | { 55, 41, 30 }, -- 58 62 | { 46, 34, 24 }, -- 59 63 | { 35, 27, 21 }, -- 60 64 | { 2, 2, 2 }, -- 61 65 | { 112, 108, 102 }, -- 62 66 | { 157, 122, 80 } -- 63 67 | }, 68 | MakeUp = { 69 | { 153, 37, 50 }, -- 0 70 | { 200, 57, 93 }, -- 1 71 | { 189, 81, 108 }, -- 2 72 | { 184, 99, 122 }, -- 3 73 | { 166, 82, 107 }, -- 4 74 | { 177, 67, 76 }, -- 5 75 | { 127, 49, 51 }, -- 6 76 | { 164, 100, 93 }, -- 7 77 | { 193, 135, 121 }, -- 8 78 | { 203, 160, 150 }, -- 9 79 | { 198, 145, 143 }, -- 10 80 | { 171, 111, 99}, -- 11 81 | { 176, 96, 80 }, -- 12 82 | { 168, 76, 51 }, -- 13 83 | { 180, 113, 120 }, -- 14 84 | { 202, 127, 146 }, -- 15 85 | { 237, 156, 190 }, -- 16 86 | { 231, 117, 164 }, -- 17 87 | { 222, 62, 129 }, -- 18 88 | { 179, 76, 110 }, -- 19 89 | { 113, 39, 57 }, -- 20 90 | { 79, 31, 42 }, -- 21 91 | { 170, 34, 47 }, -- 22 92 | { 222, 32, 52 }, -- 23 93 | { 207, 8, 19 }, -- 24 94 | { 229, 84, 112 }, -- 25 95 | { 220, 63, 181 }, -- 26 96 | { 192, 39, 178 }, -- 27 97 | { 160, 28, 169 }, -- 28 98 | { 110, 24, 117 }, -- 29 99 | { 115, 20, 101 }, -- 30 100 | { 86, 22, 92 }, -- 31 101 | { 109, 26, 157 }, -- 32 102 | { 27, 55, 113 }, -- 33 103 | { 29, 78, 167 }, -- 34 104 | { 30, 116, 187 }, -- 35 105 | { 33, 163, 206 }, -- 36 106 | { 37, 194, 210 }, -- 37 107 | { 35, 204, 165 }, -- 38 108 | { 39, 192, 125 }, -- 39 109 | { 27, 156, 50 }, -- 40 110 | { 20, 134, 4 }, -- 41 111 | { 112, 208, 65 }, -- 42 112 | { 197, 234, 52 }, -- 43 113 | { 225, 227, 47 }, -- 44 114 | { 255, 221, 38 }, -- 45 115 | { 250, 192, 38 }, -- 46 116 | { 247, 138, 39 }, -- 47 117 | { 254, 89, 16 }, -- 48 118 | { 190, 110, 25 }, -- 49 119 | { 247, 201, 127 }, -- 50 120 | { 251, 229, 192 }, -- 51 121 | { 245, 245, 245 }, -- 52 122 | { 179, 180, 179 }, -- 53 123 | { 145, 145, 145 }, -- 54 124 | { 86, 78, 78 }, -- 55 125 | { 24, 14, 14 }, -- 56 126 | { 88, 150, 158 }, -- 57 127 | { 77, 111, 140 }, -- 58 128 | { 26, 43, 85 }, -- 59 129 | { 160, 126, 107 }, -- 60 130 | { 130, 99, 85 }, -- 61 131 | { 109, 83, 70 }, -- 62 132 | { 62, 45, 39 } -- 63 133 | } 134 | } 135 | 136 | -------------------------------------------------------------------------------- /RageUI/menu/items/UIButton.lua: -------------------------------------------------------------------------------- 1 | ---@type table 2 | local SettingsButton = { 3 | Rectangle = { Y = 0, Width = 431, Height = 38 }, 4 | Text = { X = 8, Y = 3, Scale = 0.33 }, 5 | LeftBadge = { Y = -2, Width = 40, Height = 40 }, 6 | RightBadge = { X = 385, Y = -2, Width = 40, Height = 40 }, 7 | RightText = { X = 420, Y = 4, Scale = 0.35 }, 8 | SelectedSprite = { Dictionary = "commonmenu", Texture = "gradient_nav", Y = 0, Width = 431, Height = 38 }, 9 | } 10 | 11 | ---ButtonWithStyle 12 | ---@param Label string 13 | ---@param Description string 14 | ---@param Style table 15 | ---@param Enabled boolean 16 | ---@param Callback function 17 | ---@param Submenu table 18 | ---@return nil 19 | ---@public 20 | function RageUI.Button(Label, Description, Style, Enabled, Action, Submenu) 21 | local CurrentMenu = RageUI.CurrentMenu 22 | if CurrentMenu ~= nil and CurrentMenu() then 23 | ---@type number 24 | local Option = RageUI.Options + 1 25 | 26 | if CurrentMenu.Pagination.Minimum <= Option and CurrentMenu.Pagination.Maximum >= Option then 27 | ---@type boolean 28 | local Active = CurrentMenu.Index == Option 29 | 30 | RageUI.ItemsSafeZone(CurrentMenu) 31 | 32 | local haveLeftBadge = Style.LeftBadge and Style.LeftBadge ~= RageUI.BadgeStyle.None 33 | local haveRightBadge = (Style.RightBadge and Style.RightBadge ~= RageUI.BadgeStyle.None) or (not Enabled and Style.LockBadge ~= RageUI.BadgeStyle.None) 34 | local LeftBadgeOffset = haveLeftBadge and 27 or 0 35 | local RightBadgeOffset = haveRightBadge and 32 or 0 36 | if Style.Color and Style.Color.BackgroundColor then 37 | RenderRectangle(CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height, Style.Color.BackgroundColor[1], Style.Color.BackgroundColor[2], Style.Color.BackgroundColor[3], Style.Color.BackgroundColor[4]) 38 | end 39 | if Active then 40 | if Style.Color and Style.Color.HightLightColor then 41 | RenderRectangle(CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height, Style.Color.HightLightColor[1], Style.Color.HightLightColor[2], Style.Color.HightLightColor[3], Style.Color.HightLightColor[4]) 42 | else 43 | RenderSprite(SettingsButton.SelectedSprite.Dictionary, SettingsButton.SelectedSprite.Texture, CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height) 44 | end 45 | end 46 | if Enabled then 47 | if haveLeftBadge then 48 | if (Style.LeftBadge ~= nil) then 49 | local LeftBadge = Style.LeftBadge(Active) 50 | RenderSprite(LeftBadge.BadgeDictionary or "commonmenu", LeftBadge.BadgeTexture or "", CurrentMenu.X, CurrentMenu.Y + SettingsButton.LeftBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.LeftBadge.Width, SettingsButton.LeftBadge.Height, 0, LeftBadge.BadgeColour and LeftBadge.BadgeColour.R or 255, LeftBadge.BadgeColour and LeftBadge.BadgeColour.G or 255, LeftBadge.BadgeColour and LeftBadge.BadgeColour.B or 255, LeftBadge.BadgeColour and LeftBadge.BadgeColour.A or 255) 51 | end 52 | end 53 | if haveRightBadge then 54 | if (Style.RightBadge ~= nil) then 55 | local RightBadge = Style.RightBadge(Active) 56 | RenderSprite(RightBadge.BadgeDictionary or "commonmenu", RightBadge.BadgeTexture or "", CurrentMenu.X + SettingsButton.RightBadge.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.RightBadge.Width, SettingsButton.RightBadge.Height, 0, RightBadge.BadgeColour and RightBadge.BadgeColour.R or 255, RightBadge.BadgeColour and RightBadge.BadgeColour.G or 255, RightBadge.BadgeColour and RightBadge.BadgeColour.B or 255, RightBadge.BadgeColour and RightBadge.BadgeColour.A or 255) 57 | end 58 | end 59 | if Style.RightLabel then 60 | RenderText(Style.RightLabel, CurrentMenu.X + SettingsButton.RightText.X - RightBadgeOffset + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightText.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.RightText.Scale, Active and 0 or 245, Active and 0 or 245, Active and 0 or 245, 255, 2) 61 | end 62 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, Active and 0 or 245, Active and 0 or 245, Active and 0 or 245, 255) 63 | else 64 | if haveRightBadge then 65 | local RightBadge = RageUI.BadgeStyle.Lock(Active) 66 | RenderSprite(RightBadge.BadgeDictionary or "commonmenu", RightBadge.BadgeTexture or "", CurrentMenu.X + SettingsButton.RightBadge.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.RightBadge.Width, SettingsButton.RightBadge.Height, 0, RightBadge.BadgeColour and RightBadge.BadgeColour.R or 255, RightBadge.BadgeColour and RightBadge.BadgeColour.G or 255, RightBadge.BadgeColour and RightBadge.BadgeColour.B or 255, RightBadge.BadgeColour and RightBadge.BadgeColour.A or 255) 67 | end 68 | 69 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 163, 159, 148, 255) 70 | end 71 | RageUI.ItemOffset = RageUI.ItemOffset + SettingsButton.Rectangle.Height 72 | RageUI.ItemsDescription(CurrentMenu, Description, Active); 73 | if Enabled then 74 | local Hovered = CurrentMenu.EnableMouse and (CurrentMenu.CursorStyle == 0 or CurrentMenu.CursorStyle == 1) and RageUI.ItemsMouseBounds(CurrentMenu, Active, Option + 1, SettingsButton); 75 | local Selected = (CurrentMenu.Controls.Select.Active or (Hovered and CurrentMenu.Controls.Click.Active)) and Active 76 | if (Action.onHovered ~= nil) and Hovered then 77 | Action.onHovered(); 78 | end 79 | if (Action.onActive ~= nil) and Active then 80 | Action.onActive(); 81 | end 82 | if Selected then 83 | local Audio = RageUI.Settings.Audio 84 | RageUI.PlaySound(Audio[Audio.Use].Select.audioName, Audio[Audio.Use].Select.audioRef) 85 | if (Action.onSelected ~= nil) then 86 | Action.onSelected() 87 | end 88 | if Submenu and Submenu() then 89 | RageUI.NextMenu = Submenu 90 | end 91 | end 92 | end 93 | end 94 | RageUI.Options = RageUI.Options + 1 95 | end 96 | end 97 | 98 | -------------------------------------------------------------------------------- /RageUI/menu/items/UICheckBox.lua: -------------------------------------------------------------------------------- 1 | ---@type table 2 | local SettingsButton = { 3 | Rectangle = { Y = 0, Width = 431, Height = 38 }, 4 | Text = { X = 8, Y = 3, Scale = 0.33 }, 5 | LeftBadge = { Y = -2, Width = 40, Height = 40 }, 6 | RightBadge = { X = 385, Y = -2, Width = 40, Height = 40 }, 7 | RightText = { X = 420, Y = 4, Scale = 0.35 }, 8 | SelectedSprite = { Dictionary = "commonmenu", Texture = "gradient_nav", Y = 0, Width = 431, Height = 38 }, 9 | } 10 | 11 | ---@type table 12 | local SettingsCheckbox = { 13 | Dictionary = "commonmenu", Textures = { 14 | "shop_box_blankb", -- 1 15 | "shop_box_tickb", -- 2 16 | "shop_box_blank", -- 3 17 | "shop_box_tick", -- 4 18 | "shop_box_crossb", -- 5 19 | "shop_box_cross", -- 6 20 | }, 21 | X = 380, Y = -6, Width = 50, Height = 50 22 | } 23 | 24 | RageUI.CheckboxStyle = { 25 | Tick = 1, 26 | Cross = 2 27 | } 28 | 29 | ---StyleCheckBox 30 | ---@param Selected number 31 | ---@param Checked boolean 32 | ---@param Box number 33 | ---@param BoxSelect number 34 | ---@return nil 35 | local function StyleCheckBox(Selected, Checked, Box, BoxSelect, OffSet) 36 | ---@type table 37 | local CurrentMenu = RageUI.CurrentMenu; 38 | if OffSet == nil then 39 | OffSet = 0 40 | end 41 | if Selected then 42 | if Checked then 43 | RenderSprite(SettingsCheckbox.Dictionary, SettingsCheckbox.Textures[Box], CurrentMenu.X + SettingsCheckbox.X + CurrentMenu.WidthOffset - OffSet, CurrentMenu.Y + SettingsCheckbox.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsCheckbox.Width, SettingsCheckbox.Height) 44 | else 45 | RenderSprite(SettingsCheckbox.Dictionary, SettingsCheckbox.Textures[1], CurrentMenu.X + SettingsCheckbox.X + CurrentMenu.WidthOffset - OffSet, CurrentMenu.Y + SettingsCheckbox.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsCheckbox.Width, SettingsCheckbox.Height) 46 | end 47 | else 48 | if Checked then 49 | RenderSprite(SettingsCheckbox.Dictionary, SettingsCheckbox.Textures[BoxSelect], CurrentMenu.X + SettingsCheckbox.X + CurrentMenu.WidthOffset - OffSet, CurrentMenu.Y + SettingsCheckbox.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsCheckbox.Width, SettingsCheckbox.Height) 50 | else 51 | RenderSprite(SettingsCheckbox.Dictionary, SettingsCheckbox.Textures[3], CurrentMenu.X + SettingsCheckbox.X + CurrentMenu.WidthOffset - OffSet, CurrentMenu.Y + SettingsCheckbox.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsCheckbox.Width, SettingsCheckbox.Height) 52 | end 53 | end 54 | end 55 | 56 | 57 | function RageUI.Checkbox(Label, Description, Checked, Style, Actions) 58 | ---@type table 59 | local CurrentMenu = RageUI.CurrentMenu; 60 | if CurrentMenu ~= nil then 61 | if CurrentMenu() then 62 | 63 | ---@type number 64 | local Option = RageUI.Options + 1 65 | if CurrentMenu.Pagination.Minimum <= Option and CurrentMenu.Pagination.Maximum >= Option then 66 | ---@type number 67 | local Selected = CurrentMenu.Index == Option 68 | local LeftBadgeOffset = ((Style.LeftBadge == RageUI.BadgeStyle.None or Style.LeftBadge == nil) and 0 or 27) 69 | local RightBadgeOffset = ((Style.RightBadge == RageUI.BadgeStyle.None or Style.RightBadge == nil) and 0 or 32) 70 | local BoxOffset = 0 71 | RageUI.ItemsSafeZone(CurrentMenu) 72 | 73 | local Hovered = false; 74 | 75 | ---@type boolean 76 | if CurrentMenu.EnableMouse == true and (CurrentMenu.CursorStyle == 0) or (CurrentMenu.CursorStyle == 1) then 77 | Hovered = RageUI.ItemsMouseBounds(CurrentMenu, Selected, Option, SettingsButton); 78 | end 79 | if Selected then 80 | RenderSprite(SettingsButton.SelectedSprite.Dictionary, SettingsButton.SelectedSprite.Texture, CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height) 81 | end 82 | 83 | if type(Style) == "table" then 84 | if Style.Enabled == true or Style.Enabled == nil then 85 | if Selected then 86 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 0, 0, 0, 255) 87 | else 88 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 245, 245, 245, 255) 89 | end 90 | if type(Style) == 'table' then 91 | if Style.LeftBadge ~= nil then 92 | if Style.LeftBadge ~= RageUI.BadgeStyle.None then 93 | local BadgeData = Style.LeftBadge(Selected) 94 | RenderSprite(BadgeData.BadgeDictionary or "commonmenu", BadgeData.BadgeTexture or "", CurrentMenu.X, CurrentMenu.Y + SettingsButton.LeftBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.LeftBadge.Width, SettingsButton.LeftBadge.Height, 0, BadgeData.BadgeColour and BadgeData.BadgeColour.R or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.G or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.B or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.A or 255) 95 | end 96 | end 97 | if Style.RightBadge ~= nil then 98 | if Style.RightBadge ~= RageUI.BadgeStyle.None then 99 | local BadgeData = Style.RightBadge(Selected) 100 | RenderSprite(BadgeData.BadgeDictionary or "commonmenu", BadgeData.BadgeTexture or "", CurrentMenu.X + SettingsButton.RightBadge.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.RightBadge.Width, SettingsButton.RightBadge.Height, 0, BadgeData.BadgeColour and BadgeData.BadgeColour.R or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.G or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.B or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.A or 255) 101 | end 102 | end 103 | end 104 | else 105 | ---@type table 106 | local LeftBadge = RageUI.BadgeStyle.Lock 107 | ---@type number 108 | local LeftBadgeOffset = ((LeftBadge == RageUI.BadgeStyle.None or LeftBadge == nil) and 0 or 27) 109 | 110 | if Selected then 111 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 0, 0, 0, 255) 112 | else 113 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 163, 159, 148, 255) 114 | end 115 | 116 | if LeftBadge ~= RageUI.BadgeStyle.None and LeftBadge ~= nil then 117 | local BadgeData = LeftBadge(Selected) 118 | 119 | RenderSprite(BadgeData.BadgeDictionary or "commonmenu", BadgeData.BadgeTexture or "", CurrentMenu.X, CurrentMenu.Y + SettingsButton.LeftBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.LeftBadge.Width, SettingsButton.LeftBadge.Height, 0, BadgeData.BadgeColour.R or 255, BadgeData.BadgeColour.G or 255, BadgeData.BadgeColour.B or 255, BadgeData.BadgeColour.A or 255) 120 | end 121 | end 122 | 123 | if Style.Enabled == true or Style.Enabled == nil then 124 | if Selected then 125 | if Style.RightLabel ~= nil and Style.RightLabel ~= "" then 126 | 127 | RenderText(Style.RightLabel, CurrentMenu.X + SettingsButton.RightText.X - RightBadgeOffset + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightText.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.RightText.Scale, 0, 0, 0, 255, 2) 128 | BoxOffset = MeasureStringWidth(Style.RightLabel, 0, 0.35) 129 | end 130 | else 131 | if Style.RightLabel ~= nil and Style.RightLabel ~= "" then 132 | RenderText(Style.RightLabel, CurrentMenu.X + SettingsButton.RightText.X - RightBadgeOffset + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightText.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.RightText.Scale, 245, 245, 245, 255, 2) 133 | BoxOffset = MeasureStringWidth(Style.RightLabel, 0, 0.35) 134 | end 135 | end 136 | end 137 | 138 | BoxOffset = RightBadgeOffset + BoxOffset 139 | if Style.Style ~= nil then 140 | if Style.Style == RageUI.CheckboxStyle.Tick then 141 | StyleCheckBox(Selected, Checked, 2, 4, BoxOffset) 142 | elseif Style.Style == RageUI.CheckboxStyle.Cross then 143 | StyleCheckBox(Selected, Checked, 5, 6, BoxOffset) 144 | else 145 | StyleCheckBox(Selected, Checked, 2, 4, BoxOffset) 146 | end 147 | else 148 | StyleCheckBox(Selected, Checked, 2, 4, BoxOffset) 149 | end 150 | 151 | if Selected and (CurrentMenu.Controls.Select.Active or (Hovered and CurrentMenu.Controls.Click.Active)) and (Style.Enabled == true or Style.Enabled == nil) then 152 | local Audio = RageUI.Settings.Audio 153 | RageUI.PlaySound(Audio[Audio.Use].Select.audioName, Audio[Audio.Use].Select.audioRef) 154 | Checked = not Checked 155 | if (Checked) then 156 | if (Actions.onChecked ~= nil) then 157 | Actions.onChecked(); 158 | end 159 | else 160 | if (Actions.onUnChecked ~= nil) then 161 | Actions.onUnChecked(); 162 | end 163 | end 164 | end 165 | else 166 | error("UICheckBox Style is not a `table`") 167 | end 168 | 169 | RageUI.ItemOffset = RageUI.ItemOffset + SettingsButton.Rectangle.Height 170 | 171 | RageUI.ItemsDescription(CurrentMenu, Description, Selected) 172 | 173 | if (Actions.onSelected ~= nil) and (Selected) then 174 | Actions.onSelected(Checked); 175 | end 176 | 177 | end 178 | RageUI.Options = RageUI.Options + 1 179 | end 180 | end 181 | end 182 | 183 | 184 | -------------------------------------------------------------------------------- /RageUI/menu/items/UIList.lua: -------------------------------------------------------------------------------- 1 | ---@type table 2 | local SettingsButton = { 3 | Rectangle = { Y = 0, Width = 431, Height = 38 }, 4 | Text = { X = 8, Y = 3, Scale = 0.33 }, 5 | LeftBadge = { Y = -2, Width = 40, Height = 40 }, 6 | RightBadge = { X = 385, Y = -2, Width = 40, Height = 40 }, 7 | RightText = { X = 420, Y = 4, Scale = 0.35 }, 8 | SelectedSprite = { Dictionary = "commonmenu", Texture = "gradient_nav", Y = 0, Width = 431, Height = 38 }, 9 | } 10 | 11 | ---@type table 12 | local SettingsList = { 13 | LeftArrow = { Dictionary = "commonmenu", Texture = "arrowleft", X = 378, Y = 3, Width = 30, Height = 30 }, 14 | RightArrow = { Dictionary = "commonmenu", Texture = "arrowright", X = 400, Y = 3, Width = 30, Height = 30 }, 15 | Text = { X = 403, Y = 3, Scale = 0.35 }, 16 | } 17 | 18 | function RageUI.List(Label, Items, Index, Description, Style, Enabled, Actions, Submenu) 19 | ---@type table 20 | local CurrentMenu = RageUI.CurrentMenu; 21 | 22 | if CurrentMenu ~= nil then 23 | if CurrentMenu() then 24 | 25 | ---@type number 26 | local Option = RageUI.Options + 1 27 | 28 | if CurrentMenu.Pagination.Minimum <= Option and CurrentMenu.Pagination.Maximum >= Option then 29 | 30 | ---@type number 31 | local Selected = CurrentMenu.Index == Option 32 | 33 | ---@type boolean 34 | local LeftArrowHovered, RightArrowHovered = false, false 35 | 36 | RageUI.ItemsSafeZone(CurrentMenu) 37 | 38 | local Hovered = false; 39 | local LeftBadgeOffset = ((Style.LeftBadge == RageUI.BadgeStyle.None or Style.LeftBadge == nil) and 0 or 27) 40 | local RightBadgeOffset = ((Style.RightBadge == RageUI.BadgeStyle.None or Style.RightBadge == nil) and 0 or 32) 41 | local RightOffset = 0 42 | ---@type boolean 43 | if CurrentMenu.EnableMouse == true and (CurrentMenu.CursorStyle == 0) or (CurrentMenu.CursorStyle == 1) then 44 | Hovered = RageUI.ItemsMouseBounds(CurrentMenu, Selected, Option, SettingsButton); 45 | end 46 | local ListText = (type(Items[Index]) == "table") and string.format("← %s →", Items[Index].Name) or string.format("← %s →", Items[Index]) or "NIL" 47 | 48 | if Selected then 49 | RenderSprite(SettingsButton.SelectedSprite.Dictionary, SettingsButton.SelectedSprite.Texture, CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height) 50 | end 51 | if Enabled == true or Enabled == nil then 52 | if Selected then 53 | if Style.RightLabel ~= nil and Style.RightLabel ~= "" then 54 | RenderText(Style.RightLabel, CurrentMenu.X + SettingsButton.RightText.X - RightBadgeOffset + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightText.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.RightText.Scale, 0, 0, 0, 255, 2) 55 | RightOffset = MeasureStringWidth(Style.RightLabel, 0, 0.35) 56 | end 57 | else 58 | if Style.RightLabel ~= nil and Style.RightLabel ~= "" then 59 | RightOffset = MeasureStringWidth(Style.RightLabel, 0, 0.35) 60 | RenderText(Style.RightLabel, CurrentMenu.X + SettingsButton.RightText.X - RightBadgeOffset + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightText.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.RightText.Scale, 245, 245, 245, 255, 2) 61 | end 62 | end 63 | end 64 | RightOffset = RightBadgeOffset * 1.3 + RightOffset 65 | if Enabled == true or Enabled == nil then 66 | if Selected then 67 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 0, 0, 0, 255) 68 | RenderText(ListText, CurrentMenu.X + SettingsList.Text.X + 15 + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsList.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsList.Text.Scale, 0, 0, 0, 255, 2) 69 | else 70 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 245, 245, 245, 255) 71 | RenderText(ListText, CurrentMenu.X + SettingsList.Text.X + 15 + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsList.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsList.Text.Scale, 245, 245, 245, 255, 2) 72 | end 73 | else 74 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 163, 159, 148, 255) 75 | if Selected then 76 | RenderText(ListText, CurrentMenu.X + SettingsList.Text.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsList.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsList.Text.Scale, 163, 159, 148, 255, 2) 77 | else 78 | RenderText(ListText, CurrentMenu.X + SettingsList.Text.X + 15 + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsList.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsList.Text.Scale, 163, 159, 148, 255, 2) 79 | end 80 | end 81 | 82 | if type(Style) == "table" then 83 | if Style.Enabled == true or Style.Enabled == nil then 84 | if type(Style) == 'table' then 85 | if Style.LeftBadge ~= nil then 86 | if Style.LeftBadge ~= RageUI.BadgeStyle.None then 87 | local BadgeData = Style.LeftBadge(Selected) 88 | 89 | RenderSprite(BadgeData.BadgeDictionary or "commonmenu", BadgeData.BadgeTexture or "", CurrentMenu.X, CurrentMenu.Y + SettingsButton.LeftBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.LeftBadge.Width, SettingsButton.LeftBadge.Height, 0, BadgeData.BadgeColour and BadgeData.BadgeColour.R or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.G or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.B or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.A or 255) 90 | end 91 | end 92 | 93 | if Style.RightBadge ~= nil then 94 | if Style.RightBadge ~= RageUI.BadgeStyle.None then 95 | local BadgeData = Style.RightBadge(Selected) 96 | 97 | RenderSprite(BadgeData.BadgeDictionary or "commonmenu", BadgeData.BadgeTexture or "", CurrentMenu.X + SettingsButton.RightBadge.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.RightBadge.Width, SettingsButton.RightBadge.Height, 0, BadgeData.BadgeColour and BadgeData.BadgeColour.R or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.G or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.B or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.A or 255) 98 | end 99 | end 100 | end 101 | else 102 | ---@type table 103 | local LeftBadge = RageUI.BadgeStyle.Lock 104 | ---@type number 105 | if LeftBadge ~= RageUI.BadgeStyle.None and LeftBadge ~= nil then 106 | local BadgeData = LeftBadge(Selected) 107 | 108 | RenderSprite(BadgeData.BadgeDictionary or "commonmenu", BadgeData.BadgeTexture or "", CurrentMenu.X, CurrentMenu.Y + SettingsButton.LeftBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.LeftBadge.Width, SettingsButton.LeftBadge.Height, 0, BadgeData.BadgeColour.R or 255, BadgeData.BadgeColour.G or 255, BadgeData.BadgeColour.B or 255, BadgeData.BadgeColour.A or 255) 109 | end 110 | end 111 | else 112 | error("UICheckBox Style is not a `table`") 113 | end 114 | 115 | LeftArrowHovered = RageUI.IsMouseInBounds(CurrentMenu.X + SettingsList.Text.X + CurrentMenu.WidthOffset - RightOffset + CurrentMenu.SafeZoneSize.X, CurrentMenu.Y + SettingsList.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset + 2.5 + CurrentMenu.SafeZoneSize.Y , 15, 22.5) 116 | 117 | RightArrowHovered = RageUI.IsMouseInBounds(CurrentMenu.X + SettingsList.Text.X + CurrentMenu.WidthOffset + CurrentMenu.SafeZoneSize.X - RightOffset - MeasureStringWidth(ListText, 0, SettingsList.Text.Scale), CurrentMenu.Y + SettingsList.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset + 2.5 + CurrentMenu.SafeZoneSize.Y , 15, 22.5) 118 | RageUI.ItemOffset = RageUI.ItemOffset + SettingsButton.Rectangle.Height 119 | 120 | RageUI.ItemsDescription(CurrentMenu, Description, Selected); 121 | 122 | if Selected and (CurrentMenu.Controls.Left.Active or (CurrentMenu.Controls.Click.Active and LeftArrowHovered)) and not (CurrentMenu.Controls.Right.Active or (CurrentMenu.Controls.Click.Active and RightArrowHovered)) then 123 | Index = Index - 1 124 | if Index < 1 then 125 | Index = #Items 126 | end 127 | if (Actions.onListChange ~= nil) then 128 | Actions.onListChange(Index, Items[Index]); 129 | end 130 | local Audio = RageUI.Settings.Audio 131 | RageUI.PlaySound(Audio[Audio.Use].LeftRight.audioName, Audio[Audio.Use].LeftRight.audioRef) 132 | elseif Selected and (CurrentMenu.Controls.Right.Active or (CurrentMenu.Controls.Click.Active and RightArrowHovered)) and not (CurrentMenu.Controls.Left.Active or (CurrentMenu.Controls.Click.Active and LeftArrowHovered)) then 133 | Index = Index + 1 134 | if Index > #Items then 135 | Index = 1 136 | end 137 | if (Actions.onListChange ~= nil) then 138 | Actions.onListChange(Index, Items[Index]); 139 | end 140 | local Audio = RageUI.Settings.Audio 141 | RageUI.PlaySound(Audio[Audio.Use].LeftRight.audioName, Audio[Audio.Use].LeftRight.audioRef) 142 | end 143 | 144 | if Selected and (CurrentMenu.Controls.Select.Active or ((Hovered and CurrentMenu.Controls.Click.Active) and (not LeftArrowHovered and not RightArrowHovered))) then 145 | local Audio = RageUI.Settings.Audio 146 | RageUI.PlaySound(Audio[Audio.Use].Select.audioName, Audio[Audio.Use].Select.audioRef) 147 | 148 | if (Actions.onSelected ~= nil) then 149 | CreateThread(function() 150 | Actions.onSelected(Index, Items[Index]); 151 | end) 152 | end 153 | 154 | if Submenu and Submenu() then 155 | RageUI.NextMenu = Submenu 156 | end 157 | elseif Selected then 158 | if(Actions.onActive ~= nil) then 159 | Actions.onActive() 160 | end 161 | end 162 | end 163 | 164 | RageUI.Options = RageUI.Options + 1 165 | end 166 | end 167 | end 168 | -------------------------------------------------------------------------------- /RageUI/menu/items/UISeparator.lua: -------------------------------------------------------------------------------- 1 | --- 2 | --- @author Dylan MALANDAIN 3 | --- @version 2.0.0 4 | --- @since 2020 5 | --- 6 | --- RageUI Is Advanced UI Libs in LUA for make beautiful interface like RockStar GAME. 7 | --- 8 | --- 9 | --- Commercial Info. 10 | --- Any use for commercial purposes is strictly prohibited and will be punished. 11 | --- 12 | --- @see RageUI 13 | --- 14 | 15 | ---@type table 16 | local SettingsButton = { 17 | Rectangle = { Y = 0, Width = 200, Height = 38 }, 18 | Text = { X = 10, Y = 2, Scale = 0.4 }, 19 | } 20 | 21 | function RageUI.Separator(Label) 22 | local CurrentMenu = RageUI.CurrentMenu 23 | if CurrentMenu ~= nil then 24 | if CurrentMenu() then 25 | local Option = RageUI.Options + 1 26 | if CurrentMenu.Pagination.Minimum <= Option and CurrentMenu.Pagination.Maximum >= Option then 27 | if (Label ~= nil) then 28 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + 300, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 245, 245, 245, 255, 1) 29 | end 30 | RageUI.ItemOffset = RageUI.ItemOffset + SettingsButton.Rectangle.Height 31 | if (CurrentMenu.Index == Option) then 32 | if (RageUI.LastControl) then 33 | CurrentMenu.Index = Option - 1 34 | if (CurrentMenu.Index < 1) then 35 | CurrentMenu.Index = RageUI.CurrentMenu.Options 36 | end 37 | else 38 | CurrentMenu.Index = Option + 1 39 | end 40 | end 41 | end 42 | RageUI.Options = RageUI.Options + 1 43 | end 44 | end 45 | end 46 | 47 | -------------------------------------------------------------------------------- /RageUI/menu/items/UISlider.lua: -------------------------------------------------------------------------------- 1 | ---@type table 2 | local SettingsButton = { 3 | Rectangle = { Y = 0, Width = 431, Height = 38 }, 4 | Text = { X = 8, Y = 3, Scale = 0.33 }, 5 | LeftBadge = { Y = -2, Width = 40, Height = 40 }, 6 | RightBadge = { X = 385, Y = -2, Width = 40, Height = 40 }, 7 | RightText = { X = 420, Y = 4, Scale = 0.35 }, 8 | SelectedSprite = { Dictionary = "commonmenu", Texture = "gradient_nav", Y = 0, Width = 431, Height = 38 }, 9 | } 10 | 11 | ---@type table 12 | local SettingsSlider = { 13 | Background = { X = 250, Y = 14.5, Width = 150, Height = 9 }, 14 | Slider = { X = 250, Y = 14.5, Width = 75, Height = 9 }, 15 | Divider = { X = 323.5, Y = 9, Width = 2.5, Height = 20 }, 16 | LeftArrow = { Dictionary = "commonmenutu", Texture = "arrowleft", X = 235, Y = 11.5, Width = 15, Height = 15 }, 17 | RightArrow = { Dictionary = "commonmenutu", Texture = "arrowright", X = 400, Y = 11.5, Width = 15, Height = 15 }, 18 | } 19 | 20 | function RageUI.Slider(Label, ProgressStart, ProgressMax, Description, Divider, Style, Enabled, Actions) 21 | 22 | ---@type table 23 | local CurrentMenu = RageUI.CurrentMenu; 24 | local Audio = RageUI.Settings.Audio 25 | if CurrentMenu ~= nil then 26 | if CurrentMenu() then 27 | local Items = {} 28 | for i = 1, ProgressMax do 29 | table.insert(Items, i) 30 | end 31 | ---@type number 32 | local Option = RageUI.Options + 1 33 | 34 | if CurrentMenu.Pagination.Minimum <= Option and CurrentMenu.Pagination.Maximum >= Option then 35 | 36 | ---@type number 37 | local Selected = CurrentMenu.Index == Option 38 | 39 | ---@type boolean 40 | local LeftArrowHovered, RightArrowHovered = false, false 41 | 42 | RageUI.ItemsSafeZone(CurrentMenu) 43 | 44 | local Hovered = false; 45 | local LeftBadgeOffset = ((Style.LeftBadge == RageUI.BadgeStyle.None or Style.LeftBadge == nil) and 0 or 27) 46 | local RightBadgeOffset = ((Style.RightBadge == RageUI.BadgeStyle.None or Style.RightBadge == nil) and 0 or 32) 47 | local RightOffset = 0 48 | ---@type boolean 49 | if CurrentMenu.EnableMouse == true and (CurrentMenu.CursorStyle == 0) or (CurrentMenu.CursorStyle == 1) then 50 | Hovered = RageUI.ItemsMouseBounds(CurrentMenu, Selected, Option, SettingsButton); 51 | end 52 | 53 | if Selected then 54 | RenderSprite(SettingsButton.SelectedSprite.Dictionary, SettingsButton.SelectedSprite.Texture, CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height) 55 | LeftArrowHovered = RageUI.IsMouseInBounds(CurrentMenu.X + SettingsSlider.LeftArrow.X + CurrentMenu.SafeZoneSize.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsSlider.LeftArrow.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.LeftArrow.Width, SettingsSlider.LeftArrow.Height) 56 | RightArrowHovered = RageUI.IsMouseInBounds(CurrentMenu.X + SettingsSlider.RightArrow.X + CurrentMenu.SafeZoneSize.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsSlider.RightArrow.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.RightArrow.Width, SettingsSlider.RightArrow.Height) 57 | end 58 | if Enabled == true or Enabled == nil then 59 | if Selected then 60 | if Style.RightLabel ~= nil and Style.RightLabel ~= "" then 61 | RenderText(Style.RightLabel, CurrentMenu.X + SettingsButton.RightText.X - RightBadgeOffset + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightText.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.RightText.Scale, 0, 0, 0, 255, 2) 62 | RightOffset = MeasureStringWidth(Style.RightLabel, 0, 0.35) 63 | end 64 | else 65 | if Style.RightLabel ~= nil and Style.RightLabel ~= "" then 66 | RightOffset = MeasureStringWidth(Style.RightLabel, 0, 0.35) 67 | RenderText(Style.RightLabel, CurrentMenu.X + SettingsButton.RightText.X - RightBadgeOffset + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightText.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.RightText.Scale, 245, 245, 245, 255, 2) 68 | end 69 | end 70 | end 71 | RightOffset = RightOffset + RightBadgeOffset 72 | if Enabled == true or Enabled == nil then 73 | if Selected then 74 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 0, 0, 0, 255) 75 | 76 | RenderSprite(SettingsSlider.LeftArrow.Dictionary, SettingsSlider.LeftArrow.Texture, CurrentMenu.X + SettingsSlider.LeftArrow.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.LeftArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.LeftArrow.Width, SettingsSlider.LeftArrow.Height, 0, 0, 0, 0, 255) 77 | RenderSprite(SettingsSlider.RightArrow.Dictionary, SettingsSlider.RightArrow.Texture, CurrentMenu.X + SettingsSlider.RightArrow.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.RightArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.RightArrow.Width, SettingsSlider.RightArrow.Height, 0, 0, 0, 0, 255) 78 | else 79 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 245, 245, 245, 255) 80 | end 81 | else 82 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 163, 159, 148, 255) 83 | 84 | if Selected then 85 | RenderSprite(SettingsSlider.LeftArrow.Dictionary, SettingsSlider.LeftArrow.Texture, CurrentMenu.X + SettingsSlider.LeftArrow.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.LeftArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.LeftArrow.Width, SettingsSlider.LeftArrow.Height, 163, 159, 148, 255) 86 | RenderSprite(SettingsSlider.RightArrow.Dictionary, SettingsSlider.RightArrow.Texture, CurrentMenu.X + SettingsSlider.RightArrow.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.RightArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.RightArrow.Width, SettingsSlider.RightArrow.Height, 163, 159, 148, 255) 87 | end 88 | end 89 | 90 | if type(Style) == "table" then 91 | if Style.Enabled == true or Style.Enabled == nil then 92 | if type(Style) == 'table' then 93 | if Style.LeftBadge ~= nil then 94 | if Style.LeftBadge ~= RageUI.BadgeStyle.None then 95 | local BadgeData = Style.LeftBadge(Selected) 96 | 97 | RenderSprite(BadgeData.BadgeDictionary or "commonmenu", BadgeData.BadgeTexture or "", CurrentMenu.X, CurrentMenu.Y + SettingsButton.LeftBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.LeftBadge.Width, SettingsButton.LeftBadge.Height, 0, BadgeData.BadgeColour and BadgeData.BadgeColour.R or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.G or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.B or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.A or 255) 98 | end 99 | end 100 | 101 | if Style.RightBadge ~= nil then 102 | if Style.RightBadge ~= RageUI.BadgeStyle.None then 103 | local BadgeData = Style.RightBadge(Selected) 104 | 105 | RenderSprite(BadgeData.BadgeDictionary or "commonmenu", BadgeData.BadgeTexture or "", CurrentMenu.X + SettingsButton.RightBadge.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.RightBadge.Width, SettingsButton.RightBadge.Height, 0, BadgeData.BadgeColour and BadgeData.BadgeColour.R or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.G or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.B or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.A or 255) 106 | end 107 | end 108 | end 109 | else 110 | ---@type table 111 | local LeftBadge = RageUI.BadgeStyle.Lock 112 | 113 | if LeftBadge ~= RageUI.BadgeStyle.None and LeftBadge ~= nil then 114 | local BadgeData = LeftBadge(Selected) 115 | 116 | RenderSprite(BadgeData.BadgeDictionary or "commonmenu", BadgeData.BadgeTexture or "", CurrentMenu.X, CurrentMenu.Y + SettingsButton.LeftBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.LeftBadge.Width, SettingsButton.LeftBadge.Height, 0, BadgeData.BadgeColour.R or 255, BadgeData.BadgeColour.G or 255, BadgeData.BadgeColour.B or 255, BadgeData.BadgeColour.A or 255) 117 | end 118 | end 119 | else 120 | error("UICheckBox Style is not a `table`") 121 | end 122 | RenderRectangle(CurrentMenu.X + SettingsSlider.Background.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.Background.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.Background.Width, SettingsSlider.Background.Height, 4, 32, 57, 255) 123 | RenderRectangle(CurrentMenu.X + SettingsSlider.Slider.X + (((SettingsSlider.Background.Width - SettingsSlider.Slider.Width) / (#Items - 1)) * (ProgressStart - 1)) + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.Slider.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.Slider.Width, SettingsSlider.Slider.Height, 57, 116, 200, 255) 124 | if Divider then 125 | RenderRectangle(CurrentMenu.X + SettingsSlider.Divider.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsSlider.Divider.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.Divider.Width, SettingsSlider.Divider.Height, 245, 245, 245, 255) 126 | end 127 | 128 | RageUI.ItemOffset = RageUI.ItemOffset + SettingsButton.Rectangle.Height 129 | 130 | RageUI.ItemsDescription(CurrentMenu, Description, Selected); 131 | 132 | if Selected and (CurrentMenu.Controls.Left.Active or (CurrentMenu.Controls.Click.Active and LeftArrowHovered)) and not (CurrentMenu.Controls.Right.Active or (CurrentMenu.Controls.Click.Active and RightArrowHovered)) then 133 | ProgressStart = ProgressStart - 1 134 | if ProgressStart < 1 then 135 | ProgressStart = #Items 136 | end 137 | if (Actions.onSliderChange ~= nil) then 138 | Actions.onSliderChange(ProgressStart); 139 | end 140 | RageUI.PlaySound(Audio[Audio.Use].LeftRight.audioName, Audio[Audio.Use].LeftRight.audioRef) 141 | elseif Selected and (CurrentMenu.Controls.Right.Active or (CurrentMenu.Controls.Click.Active and RightArrowHovered)) and not (CurrentMenu.Controls.Left.Active or (CurrentMenu.Controls.Click.Active and LeftArrowHovered)) then 142 | ProgressStart = ProgressStart + 1 143 | if ProgressStart > #Items then 144 | ProgressStart = 1 145 | end 146 | if (Actions.onSliderChange ~= nil) then 147 | Actions.onSliderChange(ProgressStart); 148 | end 149 | RageUI.PlaySound(Audio[Audio.Use].LeftRight.audioName, Audio[Audio.Use].LeftRight.audioRef) 150 | end 151 | 152 | if Selected and (CurrentMenu.Controls.Select.Active or ((Hovered and CurrentMenu.Controls.Click.Active) and (not LeftArrowHovered and not RightArrowHovered))) then 153 | if (Actions.onSelected ~= nil) then 154 | Actions.onSelected(ProgressStart); 155 | end 156 | RageUI.PlaySound(Audio[Audio.Use].Select.audioName, Audio[Audio.Use].Select.audioRef) 157 | elseif Selected then 158 | if(Actions.onActive ~= nil) then 159 | Actions.onActive() 160 | end 161 | end 162 | end 163 | 164 | RageUI.Options = RageUI.Options + 1 165 | end 166 | end 167 | end 168 | 169 | 170 | 171 | -------------------------------------------------------------------------------- /RageUI/menu/items/UISliderHeritage.lua: -------------------------------------------------------------------------------- 1 | ---@type table 2 | local SettingsButton = { 3 | Rectangle = { Y = 0, Width = 431, Height = 38 }, 4 | Text = { X = 8, Y = 3, Scale = 0.33 }, 5 | SelectedSprite = { Dictionary = "commonmenu", Texture = "gradient_nav", Y = 0, Width = 431, Height = 38 }, 6 | } 7 | 8 | ---@type table 9 | local SettingsSlider = { 10 | Background = { X = 250, Y = 14.5, Width = 150, Height = 9 }, 11 | Slider = { X = 250, Y = 14.5, Width = 75, Height = 9 }, 12 | Divider = { X = 323.5, Y = 9, Width = 2.5, Height = 20 }, 13 | LeftArrow = { Dictionary = "mpleaderboard", Texture = "leaderboard_female_icon", X = 215, Y = 0, Width = 40, Height = 40 }, 14 | RightArrow = { Dictionary = "mpleaderboard", Texture = "leaderboard_male_icon", X = 395, Y = 0, Width = 40, Height = 40 }, 15 | } 16 | 17 | local Items = {} 18 | for i = 1, 10 do 19 | table.insert(Items, i) 20 | end 21 | 22 | function RageUI.UISliderHeritage(Label, ItemIndex, Description, Actions, Value) 23 | 24 | local CurrentMenu = RageUI.CurrentMenu; 25 | local Audio = RageUI.Settings.Audio 26 | 27 | if CurrentMenu ~= nil then 28 | if CurrentMenu() then 29 | 30 | ---@type number 31 | local Option = RageUI.Options + 1 32 | 33 | if CurrentMenu.Pagination.Minimum <= Option and CurrentMenu.Pagination.Maximum >= Option then 34 | 35 | ---@type number 36 | local value = Value or 0.1 37 | local Selected = CurrentMenu.Index == Option 38 | 39 | ---@type boolean 40 | local LeftArrowHovered, RightArrowHovered = false, false 41 | 42 | RageUI.ItemsSafeZone(CurrentMenu) 43 | 44 | local Hovered = false; 45 | local RightOffset = 0 46 | 47 | ---@type boolean 48 | if CurrentMenu.EnableMouse == true and (CurrentMenu.CursorStyle == 0) or (CurrentMenu.CursorStyle == 1) then 49 | Hovered = RageUI.ItemsMouseBounds(CurrentMenu, Selected, Option, SettingsButton); 50 | end 51 | 52 | if Selected then 53 | RenderSprite(SettingsButton.SelectedSprite.Dictionary, SettingsButton.SelectedSprite.Texture, CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height) 54 | LeftArrowHovered = RageUI.IsMouseInBounds(CurrentMenu.X + SettingsSlider.LeftArrow.X + CurrentMenu.SafeZoneSize.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsSlider.LeftArrow.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.LeftArrow.Width, SettingsSlider.LeftArrow.Height) 55 | RightArrowHovered = RageUI.IsMouseInBounds(CurrentMenu.X + SettingsSlider.RightArrow.X + CurrentMenu.SafeZoneSize.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsSlider.RightArrow.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.RightArrow.Width, SettingsSlider.RightArrow.Height) 56 | end 57 | 58 | RightOffset = RightOffset 59 | 60 | if Selected then 61 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 0, 0, 0, 255) 62 | 63 | RenderSprite(SettingsSlider.LeftArrow.Dictionary, SettingsSlider.LeftArrow.Texture, CurrentMenu.X + SettingsSlider.LeftArrow.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.LeftArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.LeftArrow.Width, SettingsSlider.LeftArrow.Height, 0, 0, 0, 0, 255) 64 | RenderSprite(SettingsSlider.RightArrow.Dictionary, SettingsSlider.RightArrow.Texture, CurrentMenu.X + SettingsSlider.RightArrow.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.RightArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.RightArrow.Width, SettingsSlider.RightArrow.Height, 0, 0, 0, 0, 255) 65 | else 66 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 245, 245, 245, 255) 67 | 68 | RenderSprite(SettingsSlider.LeftArrow.Dictionary, SettingsSlider.LeftArrow.Texture, CurrentMenu.X + SettingsSlider.LeftArrow.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.LeftArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.LeftArrow.Width, SettingsSlider.LeftArrow.Height, 0, 255, 255, 255, 255) 69 | RenderSprite(SettingsSlider.RightArrow.Dictionary, SettingsSlider.RightArrow.Texture, CurrentMenu.X + SettingsSlider.RightArrow.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.RightArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.RightArrow.Width, SettingsSlider.RightArrow.Height, 0, 255, 255, 255, 255) 70 | end 71 | 72 | RenderRectangle(CurrentMenu.X + SettingsSlider.Background.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.Background.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.Background.Width, SettingsSlider.Background.Height, 4, 32, 57, 255) 73 | RenderRectangle(CurrentMenu.X + SettingsSlider.Slider.X + (((SettingsSlider.Background.Width - SettingsSlider.Slider.Width) / (#Items)) * (ItemIndex)) + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.Slider.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.Slider.Width, SettingsSlider.Slider.Height, 57, 116, 200, 255) 74 | 75 | RenderRectangle(CurrentMenu.X + SettingsSlider.Divider.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsSlider.Divider.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.Divider.Width, SettingsSlider.Divider.Height, 245, 245, 245, 255) 76 | 77 | RageUI.ItemOffset = RageUI.ItemOffset + SettingsButton.Rectangle.Height 78 | 79 | RageUI.ItemsDescription(CurrentMenu, Description, Selected); 80 | 81 | if Selected and (CurrentMenu.Controls.SliderLeft.Active or (CurrentMenu.Controls.Click.Active and LeftArrowHovered)) and not (CurrentMenu.Controls.SliderRight.Active or (CurrentMenu.Controls.Click.Active and RightArrowHovered)) then 82 | ItemIndex = ItemIndex - value 83 | if ItemIndex < 0.1 then 84 | ItemIndex = 0.0 85 | else 86 | RageUI.PlaySound(Audio[Audio.Use].Slider.audioName, Audio[Audio.Use].Slider.audioRef, true) 87 | end 88 | if (Actions.onSliderChange ~= nil) then 89 | Actions.onSliderChange(ItemIndex / 10, ItemIndex); 90 | end 91 | elseif Selected and (CurrentMenu.Controls.SliderRight.Active or (CurrentMenu.Controls.Click.Active and RightArrowHovered)) and not (CurrentMenu.Controls.SliderLeft.Active or (CurrentMenu.Controls.Click.Active and LeftArrowHovered)) then 92 | ItemIndex = ItemIndex + value 93 | if ItemIndex > #Items then 94 | ItemIndex = 10 95 | else 96 | RageUI.PlaySound(Audio[Audio.Use].Slider.audioName, Audio[Audio.Use].Slider.audioRef, true) 97 | end 98 | if (Actions.onSliderChange ~= nil) then 99 | Actions.onSliderChange(ItemIndex / 10, ItemIndex); 100 | end 101 | end 102 | 103 | if Selected and (CurrentMenu.Controls.Select.Active or ((Hovered and CurrentMenu.Controls.Click.Active) and (not LeftArrowHovered and not RightArrowHovered))) then 104 | if (Actions.onSelected ~= nil) then 105 | Actions.onSelected(ItemIndex / 10, ItemIndex); 106 | end 107 | RageUI.PlaySound(Audio[Audio.Use].Select.audioName, Audio[Audio.Use].Select.audioRef, false) 108 | elseif Selected then 109 | if(Actions.onActive ~= nil) then 110 | Actions.onActive() 111 | end 112 | end 113 | 114 | end 115 | 116 | RageUI.Options = RageUI.Options + 1 117 | end 118 | end 119 | end 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /RageUI/menu/items/UISliderProgress.lua: -------------------------------------------------------------------------------- 1 | --- 2 | --- Generated by EmmyLua(https://github.com/EmmyLua) 3 | --- Created by Dylan Malandain. 4 | --- DateTime: 21/11/2019 01:33 5 | --- 6 | 7 | ---@type table 8 | local SettingsButton = { 9 | Rectangle = { Y = 0, Width = 431, Height = 38 }, 10 | Text = { X = 8, Y = 3, Scale = 0.33 }, 11 | LeftBadge = { Y = -2, Width = 40, Height = 40 }, 12 | RightBadge = { X = 385, Y = -2, Width = 40, Height = 40 }, 13 | RightText = { X = 420, Y = 4, Scale = 0.35 }, 14 | SelectedSprite = { Dictionary = "commonmenu", Texture = "gradient_nav", Y = 0, Width = 431, Height = 38 }, 15 | } 16 | 17 | ---@type table 18 | local SettingsSlider = { 19 | Background = { X = 250, Y = 14.5, Width = 150, Height = 9 }, 20 | Slider = { X = 250, Y = 14.5, Width = 150, Height = 9 }, 21 | LeftArrow = { Dictionary = "commonmenutu", Texture = "arrowleft", X = 235, Y = 11.5, Width = 15, Height = 15 }, 22 | RightArrow = { Dictionary = "commonmenutu", Texture = "arrowright", X = 400, Y = 11.5, Width = 15, Height = 15 }, 23 | } 24 | 25 | ---Slider 26 | ---@param Label string 27 | ---@param ProgressStart number 28 | ---@param ProgressMax number 29 | ---@param Description string 30 | ---@param Enabled boolean 31 | ---@param Callback function 32 | function RageUI.SliderProgress(Label, ProgressStart, ProgressMax, Description, Style, Enabled, Actions) 33 | 34 | ---@type table 35 | local CurrentMenu = RageUI.CurrentMenu; 36 | local Audio = RageUI.Settings.Audio 37 | 38 | if CurrentMenu ~= nil then 39 | if CurrentMenu() then 40 | 41 | local Items = {} 42 | for i = 1, ProgressMax do 43 | table.insert(Items, i) 44 | end 45 | ---@type number 46 | local Option = RageUI.Options + 1 47 | 48 | if CurrentMenu.Pagination.Minimum <= Option and CurrentMenu.Pagination.Maximum >= Option then 49 | 50 | ---@type number 51 | local Selected = CurrentMenu.Index == Option 52 | 53 | ---@type boolean 54 | local LeftArrowHovered, RightArrowHovered = false, false 55 | 56 | RageUI.ItemsSafeZone(CurrentMenu) 57 | 58 | local Hovered = false; 59 | local LeftBadgeOffset = ((Style.LeftBadge == RageUI.BadgeStyle.None or Style.LeftBadge == nil) and 0 or 27) 60 | local RightBadgeOffset = ((Style.RightBadge == RageUI.BadgeStyle.None or Style.RightBadge == nil) and 0 or 32) 61 | local RightOffset = 0 62 | ---@type boolean 63 | if CurrentMenu.EnableMouse == true and (CurrentMenu.CursorStyle == 0) or (CurrentMenu.CursorStyle == 1) then 64 | Hovered = RageUI.ItemsMouseBounds(CurrentMenu, Selected, Option, SettingsButton); 65 | end 66 | 67 | if Selected then 68 | RenderSprite(SettingsButton.SelectedSprite.Dictionary, SettingsButton.SelectedSprite.Texture, CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height) 69 | LeftArrowHovered = RageUI.IsMouseInBounds(CurrentMenu.X + SettingsSlider.LeftArrow.X + CurrentMenu.SafeZoneSize.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsSlider.LeftArrow.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.LeftArrow.Width, SettingsSlider.LeftArrow.Height) 70 | RightArrowHovered = RageUI.IsMouseInBounds(CurrentMenu.X + SettingsSlider.RightArrow.X + CurrentMenu.SafeZoneSize.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsSlider.RightArrow.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.RightArrow.Width, SettingsSlider.RightArrow.Height) 71 | end 72 | if Enabled == true or Enabled == nil then 73 | if Selected then 74 | if Style.RightLabel ~= nil and Style.RightLabel ~= "" then 75 | RenderText(Style.RightLabel, CurrentMenu.X + SettingsButton.RightText.X - RightBadgeOffset + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightText.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.RightText.Scale, 0, 0, 0, 255, 2) 76 | RightOffset = MeasureStringWidth(Style.RightLabel, 0, 0.35) 77 | end 78 | else 79 | if Style.RightLabel ~= nil and Style.RightLabel ~= "" then 80 | RightOffset = MeasureStringWidth(Style.RightLabel, 0, 0.35) 81 | RenderText(Style.RightLabel, CurrentMenu.X + SettingsButton.RightText.X - RightBadgeOffset + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightText.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.RightText.Scale, 245, 245, 245, 255, 2) 82 | end 83 | end 84 | end 85 | RightOffset = RightOffset + RightBadgeOffset 86 | if Enabled == true or Enabled == nil then 87 | if Selected then 88 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 0, 0, 0, 255) 89 | 90 | RenderSprite(SettingsSlider.LeftArrow.Dictionary, SettingsSlider.LeftArrow.Texture, CurrentMenu.X + SettingsSlider.LeftArrow.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.LeftArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.LeftArrow.Width, SettingsSlider.LeftArrow.Height, 0, 0, 0, 0, 255) 91 | RenderSprite(SettingsSlider.RightArrow.Dictionary, SettingsSlider.RightArrow.Texture, CurrentMenu.X + SettingsSlider.RightArrow.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.RightArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.RightArrow.Width, SettingsSlider.RightArrow.Height, 0, 0, 0, 0, 255) 92 | else 93 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 245, 245, 245, 255) 94 | end 95 | else 96 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 163, 159, 148, 255) 97 | 98 | if Selected then 99 | RenderSprite(SettingsSlider.LeftArrow.Dictionary, SettingsSlider.LeftArrow.Texture, CurrentMenu.X + SettingsSlider.LeftArrow.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.LeftArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.LeftArrow.Width, SettingsSlider.LeftArrow.Height, 163, 159, 148, 255) 100 | RenderSprite(SettingsSlider.RightArrow.Dictionary, SettingsSlider.RightArrow.Texture, CurrentMenu.X + SettingsSlider.RightArrow.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.RightArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.RightArrow.Width, SettingsSlider.RightArrow.Height, 163, 159, 148, 255) 101 | end 102 | end 103 | 104 | if type(Style) == "table" then 105 | if Style.Enabled == true or Style.Enabled == nil then 106 | if type(Style) == 'table' then 107 | if Style.LeftBadge ~= nil then 108 | if Style.LeftBadge ~= RageUI.BadgeStyle.None then 109 | local BadgeData = Style.LeftBadge(Selected) 110 | 111 | RenderSprite(BadgeData.BadgeDictionary or "commonmenu", BadgeData.BadgeTexture or "", CurrentMenu.X, CurrentMenu.Y + SettingsButton.LeftBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.LeftBadge.Width, SettingsButton.LeftBadge.Height, 0, BadgeData.BadgeColour and BadgeData.BadgeColour.R or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.G or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.B or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.A or 255) 112 | end 113 | end 114 | 115 | if Style.RightBadge ~= nil then 116 | if Style.RightBadge ~= RageUI.BadgeStyle.None then 117 | local BadgeData = Style.RightBadge(Selected) 118 | 119 | RenderSprite(BadgeData.BadgeDictionary or "commonmenu", BadgeData.BadgeTexture or "", CurrentMenu.X + SettingsButton.RightBadge.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.RightBadge.Width, SettingsButton.RightBadge.Height, 0, BadgeData.BadgeColour and BadgeData.BadgeColour.R or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.G or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.B or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.A or 255) 120 | end 121 | end 122 | end 123 | else 124 | ---@type table 125 | local LeftBadge = RageUI.BadgeStyle.Lock 126 | 127 | if LeftBadge ~= RageUI.BadgeStyle.None and LeftBadge ~= nil then 128 | local BadgeData = LeftBadge(Selected) 129 | 130 | RenderSprite(BadgeData.BadgeDictionary or "commonmenu", BadgeData.BadgeTexture or "", CurrentMenu.X, CurrentMenu.Y + SettingsButton.LeftBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.LeftBadge.Width, SettingsButton.LeftBadge.Height, 0, BadgeData.BadgeColour.R or 255, BadgeData.BadgeColour.G or 255, BadgeData.BadgeColour.B or 255, BadgeData.BadgeColour.A or 255) 131 | end 132 | end 133 | else 134 | error("UICheckBox Style is not a `table`") 135 | end 136 | 137 | if (type(Style.ProgressBackgroundColor) == "table") then 138 | RenderRectangle(CurrentMenu.X + SettingsSlider.Background.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.Background.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.Background.Width, SettingsSlider.Background.Height, Style.ProgressBackgroundColor.R, Style.ProgressBackgroundColor.G, Style.ProgressBackgroundColor.B, Style.ProgressBackgroundColor.A) 139 | else 140 | error("Style ProgressBackgroundColor is not a table or undefined") 141 | end 142 | 143 | if (type(Style.ProgressColor) == "table") then 144 | RenderRectangle(CurrentMenu.X + SettingsSlider.Slider.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.Slider.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, (((SettingsSlider.Slider.Width) / (#Items - 1)) * (ProgressStart - 1)), SettingsSlider.Slider.Height, Style.ProgressColor.R, Style.ProgressColor.G, Style.ProgressColor.B, Style.ProgressColor.A) 145 | else 146 | error("Style ProgressColor is not a table or undefined") 147 | end 148 | 149 | RageUI.ItemOffset = RageUI.ItemOffset + SettingsButton.Rectangle.Height 150 | 151 | RageUI.ItemsDescription(CurrentMenu, Description, Selected); 152 | 153 | if Selected and (CurrentMenu.Controls.Left.Active or (CurrentMenu.Controls.Click.Active and LeftArrowHovered)) and not (CurrentMenu.Controls.Right.Active or (CurrentMenu.Controls.Click.Active and RightArrowHovered)) then 154 | ProgressStart = ProgressStart - 1 155 | if ProgressStart < 1 then 156 | ProgressStart = #Items 157 | end 158 | if (Actions.onSliderChange ~= nil) then 159 | Actions.onSliderChange(ProgressStart); 160 | end 161 | RageUI.PlaySound(Audio[Audio.Use].LeftRight.audioName, Audio[Audio.Use].LeftRight.audioRef) 162 | elseif Selected and (CurrentMenu.Controls.Right.Active or (CurrentMenu.Controls.Click.Active and RightArrowHovered)) and not (CurrentMenu.Controls.Left.Active or (CurrentMenu.Controls.Click.Active and LeftArrowHovered)) then 163 | ProgressStart = ProgressStart + 1 164 | if ProgressStart > #Items then 165 | ProgressStart = 1 166 | end 167 | if (Actions.onSliderChange ~= nil) then 168 | Actions.onSliderChange(ProgressStart); 169 | end 170 | RageUI.PlaySound(Audio[Audio.Use].LeftRight.audioName, Audio[Audio.Use].LeftRight.audioRef) 171 | end 172 | 173 | if Selected and (CurrentMenu.Controls.Select.Active or ((Hovered and CurrentMenu.Controls.Click.Active) and (not LeftArrowHovered and not RightArrowHovered))) then 174 | if (Actions.onSelected ~= nil) then 175 | Actions.onSelected(ProgressStart); 176 | end 177 | RageUI.PlaySound(Audio[Audio.Use].Select.audioName, Audio[Audio.Use].Select.audioRef) 178 | elseif Selected then 179 | if(Actions.onActive ~= nil) then 180 | Actions.onActive() 181 | end 182 | end 183 | end 184 | 185 | RageUI.Options = RageUI.Options + 1 186 | end 187 | end 188 | end 189 | 190 | 191 | -------------------------------------------------------------------------------- /RageUI/menu/panels/UIBoutonPanel.lua: -------------------------------------------------------------------------------- 1 | local TextPanels = { 2 | Background = { Dictionary = "commonmenu", Texture = "gradient_bgd", Y = 4, Width = 431, Height = 42 }, 3 | Text = { 4 | Left = { X = 8, Y = 10, Scale = 0.35 }, 5 | Right = { X = 8, Y = 10, Scale = 0.35 }, 6 | }, 7 | } 8 | 9 | ---BoutonPanel 10 | ---@param LeftText string 11 | ---@param RightText string 12 | ---@public 13 | function RageUI.BoutonPanel(LeftText, RightText, Index) 14 | local CurrentMenu = RageUI.CurrentMenu 15 | if CurrentMenu ~= nil then 16 | local leftTextSize = MeasureStringWidth(LeftText) 17 | if CurrentMenu() and (Index == nil or (CurrentMenu.Index == Index)) then 18 | RenderRectangle(CurrentMenu.X, CurrentMenu.Y + TextPanels.Background.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset + (RageUI.StatisticPanelCount * 42), TextPanels.Background.Width + CurrentMenu.WidthOffset, TextPanels.Background.Height, 0, 0, 0, 170) 19 | RenderText(LeftText or "", CurrentMenu.X + TextPanels.Text.Left.X, (RageUI.StatisticPanelCount * 40) + CurrentMenu.Y + TextPanels.Text.Left.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, TextPanels.Text.Left.Scale, 245, 245, 245, 255, 0) 20 | RenderText(RightText or "", CurrentMenu.X + TextPanels.Background.Width + CurrentMenu.WidthOffset - leftTextSize, (RageUI.StatisticPanelCount * 40) + CurrentMenu.Y + TextPanels.Text.Left.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, TextPanels.Text.Left.Scale, 245, 245, 245, 255, 2) 21 | RageUI.StatisticPanelCount = RageUI.StatisticPanelCount + 1 22 | end 23 | end 24 | end -------------------------------------------------------------------------------- /RageUI/menu/panels/UIColourPanel.lua: -------------------------------------------------------------------------------- 1 | ---@type table 2 | local Colour = { 3 | Background = { Dictionary = "commonmenu", Texture = "gradient_bgd", Y = 4, Width = 431, Height = 112 }, 4 | LeftArrow = { Dictionary = "commonmenu", Texture = "arrowleft", X = 7.5, Y = 15, Width = 30, Height = 30 }, 5 | RightArrow = { Dictionary = "commonmenu", Texture = "arrowright", X = 393.5, Y = 15, Width = 30, Height = 30 }, 6 | Header = { X = 215.5, Y = 15, Scale = 0.35 }, 7 | Box = { X = 15, Y = 55, Width = 44.5, Height = 44.5 }, 8 | SelectedRectangle = { X = 15, Y = 47, Width = 44.5, Height = 8 }, 9 | Seperator = { Text = "of" } 10 | } 11 | 12 | ---ColourPanel 13 | ---@param Title string 14 | ---@param Colours thread 15 | ---@param MinimumIndex number 16 | ---@param CurrentIndex number 17 | ---@param Callback function 18 | ---@return nil 19 | ---@public 20 | function RageUI.ColourPanel(Title, Colours, MinimumIndex, CurrentIndex, Action, Index, Style) 21 | 22 | ---@type table 23 | local CurrentMenu = RageUI.CurrentMenu; 24 | 25 | if CurrentMenu ~= nil then 26 | if CurrentMenu() and (CurrentMenu.Index == Index) then 27 | 28 | ---@type number 29 | local Maximum = (#Colours > 9) and 9 or #Colours 30 | 31 | ---@type boolean 32 | local Hovered = RageUI.IsMouseInBounds(CurrentMenu.X + Colour.Box.X + CurrentMenu.SafeZoneSize.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Colour.Box.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, (Colour.Box.Width * Maximum), Colour.Box.Height) 33 | 34 | ---@type number 35 | local LeftArrowHovered = RageUI.IsMouseInBounds(CurrentMenu.X + Colour.LeftArrow.X + CurrentMenu.SafeZoneSize.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Colour.LeftArrow.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Colour.LeftArrow.Width, Colour.LeftArrow.Height) 36 | 37 | ---@type number 38 | local RightArrowHovered = RageUI.IsMouseInBounds(CurrentMenu.X + Colour.RightArrow.X + CurrentMenu.SafeZoneSize.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Colour.RightArrow.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Colour.RightArrow.Width, Colour.RightArrow.Height) 39 | 40 | ---@type boolean 41 | local Selected = false 42 | 43 | RenderSprite(Colour.Background.Dictionary, Colour.Background.Texture, CurrentMenu.X, CurrentMenu.Y + Colour.Background.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Colour.Background.Width + CurrentMenu.WidthOffset, Colour.Background.Height) 44 | RenderSprite(Colour.LeftArrow.Dictionary, Colour.LeftArrow.Texture, CurrentMenu.X + Colour.LeftArrow.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Colour.LeftArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Colour.LeftArrow.Width, Colour.LeftArrow.Height) 45 | RenderSprite(Colour.RightArrow.Dictionary, Colour.RightArrow.Texture, CurrentMenu.X + Colour.RightArrow.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Colour.RightArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Colour.RightArrow.Width, Colour.RightArrow.Height) 46 | 47 | RenderRectangle(CurrentMenu.X + Colour.SelectedRectangle.X + (Colour.Box.Width * (CurrentIndex - MinimumIndex)) + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Colour.SelectedRectangle.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Colour.SelectedRectangle.Width, Colour.SelectedRectangle.Height, 245, 245, 245, 255) 48 | 49 | for Index = 1, Maximum do 50 | RenderRectangle(CurrentMenu.X + Colour.Box.X + (Colour.Box.Width * (Index - 1)) + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Colour.Box.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Colour.Box.Width, Colour.Box.Height, table.unpack(Colours[MinimumIndex + Index - 1])) 51 | end 52 | 53 | local ColourSeperator = {} 54 | if type(Style) == "table" then 55 | if type(Style.Seperator) == "table" then 56 | ColourSeperator = Style.Seperator 57 | else 58 | ColourSeperator = Colour.Seperator 59 | end 60 | else 61 | ColourSeperator = Colour.Seperator 62 | end 63 | 64 | RenderText((Title and Title or "") .. " (" .. CurrentIndex .. " " .. ColourSeperator.Text .. " " .. #Colours .. ")", CurrentMenu.X + RageUI.Settings.Panels.Grid.Text.Top.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + RageUI.Settings.Panels.Grid.Text.Top.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, RageUI.Settings.Panels.Grid.Text.Top.Scale, 245, 245, 245, 255, 1) 65 | 66 | if Hovered or LeftArrowHovered or RightArrowHovered then 67 | if RageUI.Settings.Controls.Click.Active then 68 | Selected = true 69 | 70 | if LeftArrowHovered then 71 | CurrentIndex = CurrentIndex - 1 72 | 73 | if CurrentIndex < 1 then 74 | CurrentIndex = #Colours 75 | MinimumIndex = #Colours - Maximum + 1 76 | elseif CurrentIndex < MinimumIndex then 77 | MinimumIndex = MinimumIndex - 1 78 | end 79 | elseif RightArrowHovered then 80 | CurrentIndex = CurrentIndex + 1 81 | 82 | if CurrentIndex > #Colours then 83 | CurrentIndex = 1 84 | MinimumIndex = 1 85 | elseif CurrentIndex > MinimumIndex + Maximum - 1 then 86 | MinimumIndex = MinimumIndex + 1 87 | end 88 | elseif Hovered then 89 | for Index = 1, Maximum do 90 | if RageUI.IsMouseInBounds(CurrentMenu.X + Colour.Box.X + (Colour.Box.Width * (Index - 1)) + CurrentMenu.SafeZoneSize.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Colour.Box.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Colour.Box.Width, Colour.Box.Height) then 91 | CurrentIndex = MinimumIndex + Index - 1 92 | end 93 | end 94 | end 95 | 96 | if (Action.onColorChange ~= nil) then 97 | Action.onColorChange(MinimumIndex, CurrentIndex) 98 | end 99 | end 100 | end 101 | 102 | RageUI.ItemOffset = RageUI.ItemOffset + Colour.Background.Height + Colour.Background.Y 103 | 104 | if (Hovered or LeftArrowHovered or RightArrowHovered) and RageUI.Settings.Controls.Click.Active then 105 | local Audio = RageUI.Settings.Audio 106 | RageUI.PlaySound(Audio[Audio.Use].Select.audioName, Audio[Audio.Use].Select.audioRef) 107 | end 108 | end 109 | end 110 | end 111 | 112 | 113 | -------------------------------------------------------------------------------- /RageUI/menu/panels/UIGridPanel.lua: -------------------------------------------------------------------------------- 1 | --- 2 | --- @author Dylan MALANDAIN 3 | --- @version 2.0.0 4 | --- @since 2020 5 | --- 6 | --- RageUI Is Advanced UI Libs in LUA for make beautiful interface like RockStar GAME. 7 | --- 8 | --- 9 | --- Commercial Info. 10 | --- Any use for commercial purposes is strictly prohibited and will be punished. 11 | --- 12 | --- @see RageUI 13 | --- 14 | 15 | local GridType = RageUI.Enum { 16 | Default = 1, 17 | Horizontal = 2, 18 | Vertical = 3 19 | } 20 | 21 | local GridSprite = { 22 | [GridType.Default] = { Dictionary = "pause_menu_pages_char_mom_dad", Texture = "nose_grid", }, 23 | [GridType.Horizontal] = { Dictionary = "RageUI_", Texture = "horizontal_grid", }, 24 | [GridType.Vertical] = { Dictionary = "RageUI_", Texture = "vertical_grid", }, 25 | } 26 | 27 | local Grid = { 28 | Background = { Dictionary = "commonmenu", Texture = "gradient_bgd", Y = 4, Width = 431, Height = 275 }, 29 | Grid = { X = 115.5, Y = 47.5, Width = 200, Height = 200 }, 30 | Circle = { Dictionary = "mpinventory", Texture = "in_world_circle", X = 115.5, Y = 47.5, Width = 20, Height = 20 }, 31 | Text = { 32 | Top = { X = 215.5, Y = 15, Scale = 0.35 }, 33 | Bottom = { X = 215.5, Y = 250, Scale = 0.35 }, 34 | Left = { X = 57.75, Y = 130, Scale = 0.35 }, 35 | Right = { X = 373.25, Y = 130, Scale = 0.35 }, 36 | }, 37 | } 38 | 39 | local function UIGridPanel(Type, StartedX, StartedY, TopText, BottomText, LeftText, RightText, Action, Index) 40 | local CurrentMenu = RageUI.CurrentMenu 41 | if CurrentMenu ~= nil then 42 | if CurrentMenu() and ((CurrentMenu.Index == Index)) then 43 | local X = Type == GridType.Default and StartedX or Type == GridType.Horizontal and StartedX or Type == GridType.Vertical and 0.5 44 | local Y = Type == GridType.Default and StartedY or Type == GridType.Horizontal and 0.5 or Type == GridType.Vertical and StartedY 45 | local Hovered = RageUI.IsMouseInBounds(CurrentMenu.X + Grid.Grid.X + CurrentMenu.SafeZoneSize.X, CurrentMenu.Y + Grid.Grid.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Grid.Grid.Width + CurrentMenu.WidthOffset, Grid.Grid.Height) 46 | local Selected = false 47 | local CircleX = CurrentMenu.X + Grid.Grid.X + (CurrentMenu.WidthOffset / 2) 48 | local CircleY = CurrentMenu.Y + Grid.Grid.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset 49 | if X <= 0.0 then 50 | X = 0.0 51 | elseif X >= 1.0 then 52 | X = 1.0 53 | end 54 | if Y <= 0.0 then 55 | Y = 0.0 56 | elseif Y >= 1.0 then 57 | Y = 1.0 58 | end 59 | CircleX = CircleX + ((Grid.Grid.Width ) * X) - (Grid.Circle.Width / 2) 60 | CircleY = CircleY + ((Grid.Grid.Height ) * Y) - (Grid.Circle.Height / 2) 61 | RenderSprite(Grid.Background.Dictionary, Grid.Background.Texture, CurrentMenu.X, CurrentMenu.Y + Grid.Background.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Grid.Background.Width + CurrentMenu.WidthOffset, Grid.Background.Height) 62 | RenderSprite(GridSprite[Type].Dictionary, GridSprite[Type].Texture, CurrentMenu.X + Grid.Grid.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Grid.Grid.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Grid.Grid.Width, Grid.Grid.Height) 63 | RenderSprite(Grid.Circle.Dictionary, Grid.Circle.Texture, CircleX, CircleY, Grid.Circle.Width, Grid.Circle.Height) 64 | if (Type == GridType.Default) then 65 | RenderText(TopText or "", CurrentMenu.X + Grid.Text.Top.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Grid.Text.Top.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, Grid.Text.Top.Scale, 245, 245, 245, 255, 1) 66 | RenderText(BottomText or "", CurrentMenu.X + Grid.Text.Bottom.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Grid.Text.Bottom.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, Grid.Text.Bottom.Scale, 245, 245, 245, 255, 1) 67 | RenderText(LeftText or "", CurrentMenu.X + Grid.Text.Left.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Grid.Text.Left.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, Grid.Text.Left.Scale, 245, 245, 245, 255, 1) 68 | RenderText(RightText or "", CurrentMenu.X + Grid.Text.Right.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Grid.Text.Right.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, Grid.Text.Right.Scale, 245, 245, 245, 255, 1) 69 | end 70 | if (Type == GridType.Vertical) then 71 | RenderText(TopText or "", CurrentMenu.X + Grid.Text.Top.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Grid.Text.Top.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, Grid.Text.Top.Scale, 245, 245, 245, 255, 1) 72 | RenderText(BottomText or "", CurrentMenu.X + Grid.Text.Bottom.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Grid.Text.Bottom.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, Grid.Text.Bottom.Scale, 245, 245, 245, 255, 1) 73 | end 74 | if (Type == GridType.Horizontal) then 75 | RenderText(LeftText or "", CurrentMenu.X + Grid.Text.Left.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Grid.Text.Left.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, Grid.Text.Left.Scale, 245, 245, 245, 255, 1) 76 | RenderText(RightText or "", CurrentMenu.X + Grid.Text.Right.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Grid.Text.Right.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, Grid.Text.Right.Scale, 245, 245, 245, 255, 1) 77 | end 78 | if Hovered then 79 | if IsDisabledControlPressed(0, 24) then 80 | Selected = true 81 | CircleX = math.round(GetControlNormal(2, 239) * 1920) - CurrentMenu.SafeZoneSize.X - (Grid.Circle.Width / 2) 82 | CircleY = math.round(GetControlNormal(2, 240) * 1080) - CurrentMenu.SafeZoneSize.Y - (Grid.Circle.Height / 2) 83 | if CircleX > (CurrentMenu.X + Grid.Grid.X + (CurrentMenu.WidthOffset / 2) + Grid.Grid.Width ) then 84 | CircleX = CurrentMenu.X + Grid.Grid.X + (CurrentMenu.WidthOffset / 2) + Grid.Grid.Width 85 | elseif CircleX < (CurrentMenu.X + Grid.Grid.X - (Grid.Circle.Width / 2)) then 86 | CircleX = CurrentMenu.X + Grid.Grid.X - (Grid.Circle.Width / 2) 87 | end 88 | if CircleY > (CurrentMenu.Y + Grid.Grid.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset + Grid.Grid.Height ) then 89 | CircleY = CurrentMenu.Y + Grid.Grid.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset + Grid.Grid.Height 90 | elseif CircleY < (CurrentMenu.Y + Grid.Grid.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset - (Grid.Circle.Height / 2)) then 91 | CircleY = CurrentMenu.Y + Grid.Grid.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset - (Grid.Circle.Height / 2) 92 | end 93 | X = math.round((CircleX - (CurrentMenu.X + Grid.Grid.X + (CurrentMenu.WidthOffset / 2)) + (Grid.Circle.Width / 2)) / (Grid.Grid.Width ), 2) 94 | Y = math.round((CircleY - (CurrentMenu.Y + Grid.Grid.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset ) + (Grid.Circle.Height / 2)) / (Grid.Grid.Height ), 2) 95 | if (X ~= StartedX) and (Y ~= StartedY) then 96 | Action.onPositionChange(X, Y, (X * 2 - 1), (Y * 2 - 1)) 97 | end 98 | StartedX = X; 99 | StartedY = Y; 100 | if X >= 1.0 then 101 | X = 1.0 102 | end 103 | if Y >= 1.0 then 104 | Y = 1.0 105 | end 106 | end 107 | end 108 | RageUI.ItemOffset = RageUI.ItemOffset + Grid.Background.Height + Grid.Background.Y 109 | if Hovered and Selected then 110 | local Audio = RageUI.Settings.Audio 111 | RageUI.PlaySound(Audio[Audio.Use].Slider.audioName, Audio[Audio.Use].Slider.audioRef, true) 112 | if (Action.onSelected ~= nil) then 113 | Action.onSelected(X, Y, (X * 2 - 1), (Y * 2 - 1)); 114 | end 115 | end 116 | 117 | end 118 | end 119 | end 120 | 121 | function RageUI.Grid(StartedX, StartedY, TopText, BottomText, LeftText, RightText, Action, Index) 122 | UIGridPanel(GridType.Default, StartedX, StartedY, TopText, BottomText, LeftText, RightText, Action, Index) 123 | end 124 | 125 | function RageUI.GridHorizontal(StartedX, LeftText, RightText, Action, Index) 126 | UIGridPanel(GridType.Horizontal, StartedX, nil, nil, nil, LeftText, RightText, Action, Index) 127 | end 128 | 129 | function RageUI.GridVertical(StartedY, TopText, BottomText, Action, Index) 130 | UIGridPanel(GridType.Vertical, nil, StartedY, TopText, BottomText, nil, nil, Action, Index) 131 | end 132 | -------------------------------------------------------------------------------- /RageUI/menu/panels/UIPercentagePanel.lua: -------------------------------------------------------------------------------- 1 | local Percentage = { 2 | Background = { Dictionary = "commonmenu", Texture = "gradient_bgd", Y = 4, Width = 433, Height = 76 }, 3 | Bar = { X = 9, Y = 50, Width = 413, Height = 10 }, 4 | Text = { 5 | Left = { X = 25, Y = 19, Scale = 0.30 }, 6 | Middle = { X = 215.5, Y = 19, Scale = 0.30 }, 7 | Right = { X = 398, Y = 19, Scale = 0.30 }, 8 | }, 9 | } 10 | 11 | ---PercentagePanel 12 | ---@param Percent number 13 | ---@param HeaderText string 14 | ---@param MinText string 15 | ---@param MaxText string 16 | ---@param Callback function 17 | ---@param Index number 18 | ---@return nil 19 | ---@public 20 | function RageUI.PercentagePanel(Percent, HeaderText, MinText, MaxText, Action, Index) 21 | local CurrentMenu = RageUI.CurrentMenu 22 | 23 | if CurrentMenu ~= nil then 24 | if CurrentMenu() and (Index == nil or (CurrentMenu.Index == Index)) then 25 | 26 | ---@type boolean 27 | local Hovered = RageUI.IsMouseInBounds(CurrentMenu.X + Percentage.Bar.X + CurrentMenu.SafeZoneSize.X, CurrentMenu.Y + Percentage.Bar.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset - 4, Percentage.Bar.Width + CurrentMenu.WidthOffset, Percentage.Bar.Height + 8) 28 | 29 | ---@type boolean 30 | local Selected = false 31 | 32 | ---@type number 33 | local Progress = Percentage.Bar.Width 34 | 35 | if Percent < 0.0 then 36 | Percent = 0.0 37 | elseif Percent > 1.0 then 38 | Percent = 1.0 39 | end 40 | 41 | Progress = Progress * Percent 42 | 43 | RenderSprite(Percentage.Background.Dictionary, Percentage.Background.Texture, CurrentMenu.X, CurrentMenu.Y + Percentage.Background.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Percentage.Background.Width + CurrentMenu.WidthOffset, Percentage.Background.Height) 44 | RenderRectangle(CurrentMenu.X + Percentage.Bar.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Percentage.Bar.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Percentage.Bar.Width, Percentage.Bar.Height, 87, 87, 87, 255) 45 | RenderRectangle(CurrentMenu.X + Percentage.Bar.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Percentage.Bar.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Progress, Percentage.Bar.Height, 245, 245, 245, 255) 46 | 47 | RenderText(HeaderText or "Opacity", CurrentMenu.X + Percentage.Text.Middle.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Percentage.Text.Middle.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, Percentage.Text.Middle.Scale, 245, 245, 245, 255, 1) 48 | RenderText(MinText or "0%", CurrentMenu.X + Percentage.Text.Left.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Percentage.Text.Left.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, Percentage.Text.Left.Scale, 245, 245, 245, 255, 1) 49 | RenderText(MaxText or "100%", CurrentMenu.X + Percentage.Text.Right.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Percentage.Text.Right.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, Percentage.Text.Right.Scale, 245, 245, 245, 255, 1) 50 | 51 | if Hovered then 52 | if IsDisabledControlPressed(0, 24) then 53 | Selected = true 54 | 55 | Progress = math.round(GetControlNormal(2, 239) * 1920) - CurrentMenu.SafeZoneSize.X - (CurrentMenu.X + Percentage.Bar.X + (CurrentMenu.WidthOffset / 2)) 56 | 57 | if Progress < 0 then 58 | Progress = 0 59 | elseif Progress > (Percentage.Bar.Width) then 60 | Progress = Percentage.Bar.Width 61 | end 62 | 63 | Percent = math.round(Progress / Percentage.Bar.Width, 2) 64 | if (Action.onProgressChange ~= nil) then 65 | Action.onProgressChange(Percent) 66 | end 67 | end 68 | end 69 | 70 | RageUI.ItemOffset = RageUI.ItemOffset + Percentage.Background.Height + Percentage.Background.Y 71 | 72 | if Hovered and Selected then 73 | local Audio = RageUI.Settings.Audio 74 | RageUI.PlaySound(Audio[Audio.Use].Slider.audioName, Audio[Audio.Use].Slider.audioRef, true) 75 | if (Action.onSelected ~= nil) then 76 | Action.onSelected(Percent) 77 | end 78 | end 79 | end 80 | end 81 | end 82 | -------------------------------------------------------------------------------- /RageUI/menu/panels/UISpritPanel.lua: -------------------------------------------------------------------------------- 1 | --- 2 | --- Generated by EmmyLua(https://github.com/EmmyLua) 3 | --- Created by iTexZ. 4 | --- DateTime: 05/11/2020 02:17 5 | --- 6 | 7 | local TextPanels = { 8 | Background = { Dictionary = "commonmenu", Texture = "gradient_bgd", Y = 4, Width = 433, Height = 42 }, 9 | } 10 | 11 | ---@type Panel 12 | function RageUI.RenderSprite(Dictionary, Texture) 13 | local CurrentMenu = RageUI.CurrentMenu 14 | if CurrentMenu ~= nil then 15 | if CurrentMenu() then 16 | RenderSprite(Dictionary, Texture, CurrentMenu.X, CurrentMenu.Y + TextPanels.Background.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset + (RageUI.StatisticPanelCount * 42), TextPanels.Background.Width + CurrentMenu.WidthOffset, TextPanels.Background.Height + 200, 0, 255, 255, 255, 255); 17 | RageUI.StatisticPanelCount = RageUI.StatisticPanelCount + 1 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /RageUI/menu/panels/UIStatisticsPanel.lua: -------------------------------------------------------------------------------- 1 | local Statistics = { 2 | Background = { Dictionary = "commonmenu", Texture = "gradient_bgd", Y = 4, Width = 433, Height = 42 }, 3 | Text = { 4 | Left = { X = -40, Y = 19, Scale = 0.30 }, 5 | }, 6 | Bar = { Right = 8, Y = 27, Width = 200, Height = 10, OffsetRatio = 0.5 }, 7 | Divider = { 8 | [1] = { X = 200, Y = 27, Width = 2, Height = 10 }, 9 | [2] = { X = 200, Y = 27, Width = 2, Height = 10 }, 10 | [3] = { X = 200, Y = 27, Width = 2, Height = 10 }, 11 | [4] = { X = 200, Y = 27, Width = 2, Height = 10 }, 12 | [5] = { X = 200, Y = 27, Width = 2, Height = 10 }, 13 | } 14 | } 15 | 16 | function RageUI.StatisticPanel(Percent, Text, Index) 17 | local CurrentMenu = RageUI.CurrentMenu 18 | if CurrentMenu ~= nil then 19 | if CurrentMenu() and (Index == nil or (CurrentMenu.Index == Index)) then 20 | 21 | ---@type number 22 | local BarWidth = Statistics.Bar.Width + CurrentMenu.WidthOffset * Statistics.Bar.OffsetRatio 23 | 24 | RenderRectangle(CurrentMenu.X, CurrentMenu.Y + Statistics.Background.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset + (RageUI.StatisticPanelCount * 42), Statistics.Background.Width + CurrentMenu.WidthOffset, Statistics.Background.Height, 0, 0, 0, 170) 25 | RenderText(Text or "", CurrentMenu.X + 8.0, (RageUI.StatisticPanelCount * 40) + CurrentMenu.Y + Statistics.Text.Left.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, Statistics.Text.Left.Scale, 245, 245, 245, 255, 0) 26 | RenderRectangle(CurrentMenu.X + RageUI.Settings.Items.Title.Background.Width - BarWidth - Statistics.Bar.Right + CurrentMenu.WidthOffset, (RageUI.StatisticPanelCount * 40) + CurrentMenu.Y + Statistics.Bar.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, BarWidth, Statistics.Bar.Height, 87, 87, 87, 255) 27 | RenderRectangle(CurrentMenu.X + RageUI.Settings.Items.Title.Background.Width - BarWidth - Statistics.Bar.Right + CurrentMenu.WidthOffset, (RageUI.StatisticPanelCount * 40) + CurrentMenu.Y + Statistics.Bar.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Percent * BarWidth, Statistics.Bar.Height, 255, 255, 255, 255) 28 | for i = 1, #Statistics.Divider, 1 do 29 | RenderRectangle((CurrentMenu.X + RageUI.Settings.Items.Title.Background.Width - BarWidth - Statistics.Bar.Right) + i * ((BarWidth - (#Statistics.Divider / Statistics.Divider[i].Width)) / (#Statistics.Divider + 1)) + CurrentMenu.WidthOffset, (RageUI.StatisticPanelCount * 40) + CurrentMenu.Y + Statistics.Divider[i].Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Statistics.Divider[i].Width, Statistics.Divider[i].Height, 0, 0, 0, 255) 30 | end 31 | RageUI.StatisticPanelCount = RageUI.StatisticPanelCount + 1 32 | end 33 | end 34 | end 35 | 36 | function RageUI.StatisticPanelAdvanced(Text, Percent, RGBA1, Percent2, RGBA2, RGBA3, Index) 37 | local CurrentMenu = RageUI.CurrentMenu 38 | if CurrentMenu ~= nil then 39 | if CurrentMenu() and (Index == nil or (CurrentMenu.Index == Index)) then 40 | 41 | RGBA1 = RGBA1 or { 255, 255, 255, 255 } 42 | local BarWidth = Statistics.Bar.Width + CurrentMenu.WidthOffset * Statistics.Bar.OffsetRatio 43 | 44 | ---@type number 45 | RenderRectangle(CurrentMenu.X, CurrentMenu.Y + Statistics.Background.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset + (RageUI.StatisticPanelCount * 42), Statistics.Background.Width + CurrentMenu.WidthOffset, Statistics.Background.Height, 0, 0, 0, 170) 46 | RenderText(Text or "", CurrentMenu.X + 8.0, (RageUI.StatisticPanelCount * 40) + CurrentMenu.Y + Statistics.Text.Left.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, Statistics.Text.Left.Scale, 245, 245, 245, 255, 0) 47 | RenderRectangle(CurrentMenu.X + RageUI.Settings.Items.Title.Background.Width - BarWidth - Statistics.Bar.Right + CurrentMenu.WidthOffset, (RageUI.StatisticPanelCount * 40) + CurrentMenu.Y + Statistics.Bar.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, BarWidth, Statistics.Bar.Height, 87, 87, 87, 255) 48 | RenderRectangle(CurrentMenu.X + RageUI.Settings.Items.Title.Background.Width - BarWidth - Statistics.Bar.Right + CurrentMenu.WidthOffset, (RageUI.StatisticPanelCount * 40) + CurrentMenu.Y + Statistics.Bar.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Percent * BarWidth, Statistics.Bar.Height, RGBA1[1], RGBA1[2], RGBA1[3], RGBA1[4]) 49 | RGBA2 = RGBA2 or { 0, 153, 204, 255 } 50 | RGBA3 = RGBA3 or { 185, 0, 0, 255 } 51 | 52 | if Percent2 and Percent2 > 0 then 53 | local X = CurrentMenu.X + RageUI.Settings.Items.Title.Background.Width - BarWidth - Statistics.Bar.Right + CurrentMenu.WidthOffset + Percent * BarWidth 54 | RenderRectangle(X, (RageUI.StatisticPanelCount * 40) + CurrentMenu.Y + Statistics.Bar.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Percent2 * BarWidth, Statistics.Bar.Height, RGBA2[1], RGBA2[2], RGBA2[3], RGBA2[4]) 55 | elseif Percent2 and Percent2 < 0 then 56 | local X = CurrentMenu.X + RageUI.Settings.Items.Title.Background.Width - BarWidth - Statistics.Bar.Right + CurrentMenu.WidthOffset + Percent * BarWidth 57 | RenderRectangle(X, (RageUI.StatisticPanelCount * 40) + CurrentMenu.Y + Statistics.Bar.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Percent2 * BarWidth, Statistics.Bar.Height, RGBA3[1], RGBA3[2], RGBA3[3], RGBA3[4]) 58 | end 59 | 60 | for i = 1, #Statistics.Divider, 1 do 61 | RenderRectangle((CurrentMenu.X + RageUI.Settings.Items.Title.Background.Width - BarWidth - Statistics.Bar.Right) + i * ((BarWidth - (#Statistics.Divider / Statistics.Divider[i].Width)) / (#Statistics.Divider + 1)) + CurrentMenu.WidthOffset, (RageUI.StatisticPanelCount * 40) + CurrentMenu.Y + Statistics.Divider[i].Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Statistics.Divider[i].Width, Statistics.Divider[i].Height, 0, 0, 0, 255) 62 | end 63 | 64 | RageUI.StatisticPanelCount = RageUI.StatisticPanelCount + 1 65 | end 66 | end 67 | end 68 | 69 | -------------------------------------------------------------------------------- /RageUI/menu/windows/UIHeritage.lua: -------------------------------------------------------------------------------- 1 | ---@type table 2 | local Heritage = { 3 | Background = { Dictionary = "pause_menu_pages_char_mom_dad", Texture = "mumdadbg", Width = 433, Height = 228 }, 4 | Mum = { Dictionary = "char_creator_portraits", X = 25, Width = 228, Height = 228 }, 5 | Dad = { Dictionary = "char_creator_portraits", X = 195, Width = 228, Height = 228 }, 6 | } 7 | 8 | ---@type Window 9 | function RageUI.Window.Heritage(Mum, Dad) 10 | ---@type table 11 | local CurrentMenu = RageUI.CurrentMenu; 12 | if CurrentMenu ~= nil then 13 | if CurrentMenu() then 14 | -- if Mum < 0 or Mum > 21 then 15 | -- Mum = 0 16 | -- end 17 | -- if Dad < 0 or Dad > 23 then 18 | -- Dad = 0 19 | -- end 20 | Mum = Mum - 1 21 | Dad = Dad - 1 22 | -- print(Mum) 23 | -- if Mum >= 21 and Mum <= 22 then 24 | -- Mum = "special_female_" .. Mum 25 | -- elseif Mum < 21 then 26 | -- Mum = "female_" .. Mum 27 | -- elseif Mum > 22 then 28 | -- Mum = "male_" .. Mum 29 | -- elseif Mum >= 43 then 30 | -- Mum = "special_male_" .. Mum 31 | -- end 32 | 33 | 34 | if (Mum < 21) then 35 | Mum = "male_" .. Mum; 36 | elseif (Mum < 42) then 37 | Mum = "female_" .. (Mum - 21); 38 | elseif (Mum < 45) then 39 | Mum = "special_male_" .. (Mum - 42); 40 | else 41 | Mum = "special_female_0"; 42 | end 43 | 44 | if (Dad < 21) then 45 | Dad = "male_" .. Dad ; 46 | elseif (Dad < 42) then 47 | Dad = "female_" .. (Dad - 21); 48 | elseif (Dad < 45) then 49 | Dad = "special_male_" .. (Dad - 42) ; 50 | else 51 | Dad = "special_female_0"; 52 | end 53 | 54 | -- if Dad >= 21 then 55 | -- Dad = "special_male_" .. (tonumber(string.sub(Dad, 2, 2)) - 1) 56 | -- else 57 | -- Dad = "male_" .. Dad 58 | -- end 59 | -- if (MuDadm < 21) then 60 | -- textureName = "male_" + secondShapedId; 61 | -- elseif (secondShapedId < 42) { 62 | -- textureName = "female_" + (secondShapedId - 21); 63 | -- elseif (secondShapedId < 45) { 64 | -- textureName = "special_male_" + (secondShapedId - 42); 65 | -- else 66 | -- textureName = "special_female_0"; 67 | -- end 68 | 69 | RenderSprite(Heritage.Background.Dictionary, Heritage.Background.Texture, CurrentMenu.X, 70 | CurrentMenu.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 71 | Heritage.Background.Width + (CurrentMenu.WidthOffset / 1), Heritage.Background.Height) 72 | RenderSprite(Heritage.Dad.Dictionary, Dad, CurrentMenu.X + Heritage.Dad.X + (CurrentMenu.WidthOffset / 2), 73 | CurrentMenu.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Heritage.Dad.Width, Heritage.Dad.Height) 74 | RenderSprite(Heritage.Mum.Dictionary, Mum, CurrentMenu.X + Heritage.Mum.X + (CurrentMenu.WidthOffset / 2), 75 | CurrentMenu.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Heritage.Mum.Width, Heritage.Mum.Height) 76 | RageUI.ItemOffset = RageUI.ItemOffset + Heritage.Background.Height 77 | end 78 | end 79 | end 80 | -------------------------------------------------------------------------------- /RageUI/stream/RageUI_.ytd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mathu-lmn/mth-animations/e336f31f8edd1bf1d9780305662b3af32d34b59f/RageUI/stream/RageUI_.ytd -------------------------------------------------------------------------------- /client/client.lua: -------------------------------------------------------------------------------- 1 | -- Create a menu for the animations 2 | local animations_menu = RageUI.CreateMenu("Animations", "Select an animation to play") 3 | animations_menu:SetStyleSize(200) 4 | animations_menu:DisplayPageCounter(true) 5 | local results_menu = RageUI.CreateSubMenu(animations_menu, "Results", "Results of the search") 6 | results_menu:DisplayPageCounter(true) 7 | local dict_menu = RageUI.CreateSubMenu(animations_menu, "Dictionary", "Animations of the dictionary") 8 | 9 | local open = false 10 | local results = {} 11 | local dict = nil 12 | local inAnim = false 13 | local previousAnim = nil 14 | animations_menu.Closed = function() 15 | open = false 16 | RageUI.Visible(animations_menu, false) 17 | ClearPedTasksImmediately(GetPlayerPed(-1)) 18 | inAnim = false 19 | previousAnim = nil 20 | index = 1 21 | end 22 | 23 | local index = 1 24 | local animation_list = {} 25 | local animation_list_page = {} 26 | local all_indexes = {} 27 | local max_pages = 0 28 | local path_to_animations = "animDictsCompact.json" 29 | 30 | -- Create a thread to load the animations 31 | 32 | Citizen.CreateThread(function() 33 | local fileJson = LoadResourceFile(GetCurrentResourceName(), path_to_animations) 34 | if fileJson then 35 | animation_list = json.decode(fileJson) 36 | end 37 | 38 | for k, v in pairs(animation_list) do 39 | if not DoesAnimDictExist(v.DictionaryName) then 40 | table.remove(animation_list, k) 41 | end 42 | end 43 | max_pages = math.ceil(#animation_list / 8) 44 | for i = 1, max_pages do 45 | local page = {} 46 | for k = (i - 1) * 8 + 1, i * 8 do 47 | if animation_list[k] then 48 | table.insert(page, animation_list[k]) 49 | end 50 | end 51 | table.insert(animation_list_page, page) 52 | table.insert(all_indexes, i) 53 | end 54 | end) 55 | 56 | 57 | RegisterNetEvent('mth-animations:menu', function() 58 | OpenAnimationsMenu() 59 | end) 60 | 61 | function OpenAnimationsMenu() 62 | if open then 63 | open = false 64 | RageUI.Visible(animations_menu, false) 65 | ClearPedTasksImmediately(GetPlayerPed(-1)) 66 | inAnim = false 67 | previousAnim = nil 68 | index = 1 69 | return 70 | else 71 | open = true 72 | RageUI.Visible(animations_menu, true) 73 | CreateThread(function() 74 | while open do 75 | RageUI.IsVisible(animations_menu, function() 76 | -- add a button to search an animation 77 | RageUI.Button("Search for an animation", nil, { RightLabel = "→→→" }, true, { 78 | onSelected = function() 79 | local result = KeyboardInput("Search for an animation") 80 | if result then 81 | -- when the search is done, display all the results in a list 82 | results = {} 83 | -- for each dict, check if the search is in the animations names 84 | for k, v in pairs(animation_list) do 85 | for k2, v2 in pairs(v.Animations) do 86 | if string.find(string.lower(v2), string.lower(result)) then 87 | table.insert(results, { v.DictionaryName, v2 }) 88 | end 89 | end 90 | end 91 | end 92 | end 93 | }, results_menu) 94 | -- add a button for each page 95 | for k, v in pairs(animation_list_page[index]) do 96 | RageUI.Button(v.DictionaryName, nil, { RightLabel = ">" }, true, { 97 | onSelected = function() 98 | -- when the button is selected, display all the animations of the dictionary 99 | dict = k 100 | end 101 | }, dict_menu) 102 | end 103 | RageUI.List("Page", all_indexes, index, nil, {}, true, { 104 | onListChange = function(Index) 105 | index = Index 106 | end, 107 | onSelected = function() 108 | local result = KeyboardInput("Page number") 109 | if result and tonumber(result) and tonumber(result) <= max_pages and tonumber(result) > 0 then 110 | index = tonumber(result) 111 | end 112 | end 113 | }) 114 | end) 115 | RageUI.IsVisible(results_menu, function() 116 | -- add a button for each result 117 | if #results > 0 then 118 | for k, v in pairs(results) do 119 | RageUI.Button(v[2], "DictionaryName : " .. v[1], { RightLabel = ">" }, true, { 120 | onSelected = function() 121 | -- when the button is selected, play the animation 122 | PlayAnimation(v[1], v[2]) 123 | end 124 | }) 125 | end 126 | else 127 | RageUI.Separator("No results") 128 | end 129 | end) 130 | RageUI.IsVisible(dict_menu, function() 131 | -- set the menu subtitle to the current dictionary 132 | dict_menu.Subtitle = animation_list_page[index][dict].DictionaryName 133 | -- add a button for each animation of the dictionary 134 | for k, v in pairs(animation_list_page[index][dict].Animations) do 135 | RageUI.Button(v, nil, { RightLabel = "→→→" }, true, { 136 | onSelected = function() 137 | -- when the button is selected, play the animation 138 | PlayAnimation(animation_list_page[index][dict].DictionaryName, v) 139 | end 140 | }) 141 | end 142 | end) 143 | Wait(0) 144 | end 145 | end) 146 | end 147 | end 148 | 149 | 150 | function PlayAnimation(dict, anim) 151 | if inAnim and tostring(anim) == tostring(previousAnim) then 152 | ClearPedTasksImmediately(GetPlayerPed(-1)) 153 | inAnim = false 154 | elseif inAnim then 155 | ClearPedTasksImmediately(GetPlayerPed(-1)) 156 | local player = GetPlayerPed(-1) 157 | -- load the animation 158 | RequestAnimDict(dict) 159 | while not HasAnimDictLoaded(dict) do 160 | Wait(0) 161 | end 162 | -- play the animation 163 | TaskPlayAnim(player, dict, anim, 8.0, 8.0, -1, 1, 0, false, false, false) 164 | else 165 | inAnim = true 166 | previousAnim = anim 167 | local player = GetPlayerPed(-1) 168 | -- load the animation 169 | RequestAnimDict(dict) 170 | while not HasAnimDictLoaded(dict) do 171 | Wait(0) 172 | end 173 | -- play the animation 174 | TaskPlayAnim(player, dict, anim, 8.0, 8.0, -1, 1, 0, false, false, false) 175 | end 176 | end 177 | 178 | function KeyboardInput(text) 179 | local result = nil 180 | AddTextEntry("CUSTOM_AMOUNT", text) 181 | DisplayOnscreenKeyboard(1, "CUSTOM_AMOUNT", '', "", '', '', '', 255) 182 | while UpdateOnscreenKeyboard() ~= 1 and UpdateOnscreenKeyboard() ~= 2 do 183 | Wait(1) 184 | end 185 | if UpdateOnscreenKeyboard() ~= 2 then 186 | result = GetOnscreenKeyboardResult() 187 | Citizen.Wait(1) 188 | else 189 | Citizen.Wait(1) 190 | end 191 | return result 192 | end 193 | -------------------------------------------------------------------------------- /config.lua: -------------------------------------------------------------------------------- 1 | Config = {} 2 | 3 | -- false = everyone can use the animation menu 4 | Config.AdminOnly = false -------------------------------------------------------------------------------- /fxmanifest.lua: -------------------------------------------------------------------------------- 1 | fx_version 'cerulean' 2 | game 'gta5' 3 | 4 | name "mth-animations" 5 | description "Developer script to play every GTA animations" 6 | author "Mathu_lmn" 7 | version "1.1.1" 8 | 9 | files { 10 | 'animDictsCompact.json' 11 | } 12 | 13 | client_scripts { 14 | 'RageUI/RMenu.lua', 15 | 'RageUI/menu/RageUI.lua', 16 | 'RageUI/menu/Menu.lua', 17 | 'RageUI/menu/MenuController.lua', 18 | 'RageUI/components/*.lua', 19 | 'RageUI/menu/elements/*.lua', 20 | 'RageUI/menu/items/*.lua', 21 | 'RageUI/menu/panels/*.lua', 22 | 'RageUI/menu/windows/*.lua', 23 | 'client/*.lua', 24 | } 25 | 26 | server_scripts { 27 | 'server/*.lua', 28 | } 29 | 30 | shared_script { 31 | 'config.lua', 32 | } -------------------------------------------------------------------------------- /server/server.lua: -------------------------------------------------------------------------------- 1 | RegisterCommand("animations", function(source, args, rawCommand) 2 | TriggerClientEvent('mth-animations:menu', source) 3 | end, Config.AdminOnly) --------------------------------------------------------------------------------