lation in menus + small tweak to prog bar and manifest + folder structure in menus

This commit is contained in:
MrNewb committed 2025-07-08 09:44:53 -04:00
1 parent ec74338565
commit 1a7112fe25
7 files changed
+120 -12

No files matched your search

+1 -1
View File
@@ -53,7 +53,7 @@ client_scripts {
'modules/progressbar/**/client.lua',
'modules/clothing/**/client.lua',
'modules/input/**/client.lua',
'modules/menu/*.lua',
'modules/menu/**/client.lua',
'modules/helptext/**/client.lua',
'modules/notify/**/client.lua',
'modules/dialogue/**/client/*.lua',
@@ -12,6 +12,10 @@ function Menu.Open(data, useQb)
return id
end
function Menu.GetResourceName()
return GetMenuResourceName()
end
---Event to handle callback from menu selection.
---@param _args table The arguments passed to the callback.
---@return nil
+96
View File
@@ -0,0 +1,96 @@
local resourceName = "lation_ui"
local configValue = BridgeClientConfig.MenuSystem
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
Menus = Menus or {}
local function runCheckForImageIcon(icon)
local iconStr = tostring(icon):lower()
if iconStr:match("^https?://") or iconStr:match("^nui://") or iconStr:match("^file://") then
return true
end
local extensions = {".png", ".jpg", ".jpeg", ".gif", ".bmp", ".svg", ".webp", ".ico"}
for _, ext in pairs(extensions) do
if iconStr:match(ext .. "$") then
return true
end
end
return false
end
---Converts a QB menu to an Lation menu.
---@param id string The menu ID.
---@param menu table The QB menu data.
---@return table The Lation menu data.
local function QBToLationMenu(id, menu)
local lationMenu = {
id = id,
title = "",
canClose = true,
options = {},
}
for i, v in pairs(menu) do
if v.isMenuHeader then
if lationMenu.title == "" then
lationMenu.title = v.header
end
else
local option = {
title = v.header,
description = v.txt,
icon = v.icon,
args = v.params.args,
onSelect = function(selected, secondary, args)
local params = menu[id]?.options?[selected]?.params
if not params then return end
local event = params.event
local isServer = params.isServer
if not event then return end
if isServer then
return TriggerServerEvent(event, args)
end
return TriggerEvent(event, args)
end
}
table.insert(lationMenu.options, option)
end
end
return lationMenu
end
local function OxToLationMenu(data)
local repack = {
id = data.id,
title = data.title or "",
canClose = data.canClose ~= false,
options = {}
}
-- Handle icon colors: remove for image icons, convert strings to hex for others
for k, v in pairs(data.options) do
if v.iconColor then
if v.icon and runCheckForImageIcon(v.icon) then
v.iconColor = nil
end
end
table.insert(repack.options, v)
end
return repack
end
function OpenMenu(id, data, useQBinput)
if useQBinput then
data = QBToLationMenu(id, data)
else
data = OxToLationMenu(data)
end
exports.lation_ui:registerMenu(data)
exports.lation_ui:showMenu(id)
return data
end
function GetMenuResourceName()
return resourceName
end
@@ -44,7 +44,7 @@ local function QBToOxMenu(id, menu)
return oxMenu
end
OpenMenu = function(id, data, useQBinput)
function OpenMenu(id, data, useQBinput)
if useQBinput then
data = QBToOxMenu(id, data)
end
@@ -52,3 +52,7 @@ OpenMenu = function(id, data, useQBinput)
lib.showContext(id)
return data
end
GetMenuResourceName = function()
return resourceName
end
@@ -36,10 +36,14 @@ function OxToQBMenu(id, menu)
return qbMenu
end
OpenMenu = function(id, data, useQBinput)
function OpenMenu(id, data, useQBinput)
if not useQBinput then
data = OxToQBMenu(id, data)
end
exports['qb-menu']:openMenu(data)
return data
end
GetMenuResourceName = function()
return resourceName
end
+8 -8
View File
@@ -14,16 +14,16 @@ local function convertFromQB(options)
local prop2 = options.propTwo or {}
local props = {
{
model = prop1.model,
bone = prop1.bone,
pos = prop1.coords,
rot = prop1.rotation,
model = prop1?.model,
bone = prop1?.bone,
pos = prop1?.coords,
rot = prop1?.rotation,
},
{
model = prop2.model,
bone = prop2.bone,
pos = prop2.coords,
rot = prop2.rotation,
model = prop2?.model,
bone = prop2?.bone,
pos = prop2?.coords,
rot = prop2?.rotation,
}
}
return {
+1 -1
View File
@@ -1,7 +1,7 @@
BridgeSharedConfig = {}
BridgeSharedConfig.Lang = "auto" -- Change this to your preferred language (must match the locale file name ex. en or fr etc)
BridgeSharedConfig.DebugLevel = 0 -- Change this to your Debug level, 0 for none, 1 for some, 2 for all data
BridgeSharedConfig.Notify = "auto" -- [ auto | ox_lib | r_notify | okokNotify | mythic_notify | pNotify | t-notify | wasabi_notify | brutal_notify]
BridgeSharedConfig.Notify = "auto" -- [ auto | ox_lib | r_notify | wasabi_notify | lation_ui | okokNotify | mythic_notify | pNotify | t-notify | brutal_notify]
BridgeSharedConfig.HelpText = "auto" -- [ auto | ox_lib | jg-textui | cd_drawtextui | lab-HintUI | okokTextUI]
BridgeSharedConfig.Phone = "auto" -- [ auto | qs-smartphone | lb-phone | gksphone]
BridgeSharedConfig.Skills = "auto" -- [ auto | OT_skills | evolent_skills | pickle_xp]