Add ZSX_UIV2 support for helptext, notify, and progressbar
Introduced new client modules for helptext, notify, and progressbar using ZSX_UIV2. Updated client and shared configuration files to include ZSX_UIV2 as an option for ProgressBarSystem, Notify, and HelpText. Bumped fxmanifest version to 0.13.2.
This commit is contained in:
1 parent
80dd16efa8
commit
98b883950d
6 files changed
+200
-4
No files matched your search
+1
-1
@@ -5,7 +5,7 @@ use_experimental_fxv2_oal 'yes'
|
||||
author 'The Order of the Sacred Framework'
|
||||
name 'community_bridge'
|
||||
description 'A Universal Bridge for Our Community, created by a group of contributors with a shared vision to enhance both user and developer experiences. This bridge connects various frameworks, inventories, target systems, notification systems, and more, fostering compatibility and seamless integration.'
|
||||
version '0.13.1'
|
||||
version '0.13.2'
|
||||
|
||||
shared_scripts {
|
||||
'@ox_lib/init.lua',
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
HelpText = HelpText or {}
|
||||
local resourceName = "ZSX_UIV2"
|
||||
local configValue = BridgeSharedConfig.HelpText
|
||||
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@return string
|
||||
HelpText.GetResourceName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
---This will show a help text message at the screen position passed
|
||||
---@param message string
|
||||
---@param position string
|
||||
---@return nil
|
||||
HelpText.ShowHelpText = function(message, position)
|
||||
return exports['ZSX_UIV2']:TextUI_Persistent(nil, message, nil, nil, nil)
|
||||
end
|
||||
|
||||
---This will hide the help text message on the screen
|
||||
---@return nil
|
||||
HelpText.HideHelpText = function()
|
||||
return exports['ZSX_UIV2']:TextUI_RemovePersistent(false)
|
||||
end
|
||||
|
||||
return HelpText
|
||||
@@ -0,0 +1,48 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
Notify = Notify or {}
|
||||
local resourceName = "ZSX_UIV2"
|
||||
local configValue = BridgeSharedConfig.Notify
|
||||
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
|
||||
|
||||
Notify.GetResourceName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
local Language = Language or Require("modules/locales/shared.lua")
|
||||
local locale = Language.Locale
|
||||
local placeHolderText = locale("Notifications.PlaceholderTitle")
|
||||
|
||||
local function getIconByType(_type)
|
||||
local icon = "info"
|
||||
if _type == "success" then
|
||||
icon = "check-circle"
|
||||
elseif _type == "error" then
|
||||
icon = "times-circle"
|
||||
elseif _type == "warning" then
|
||||
icon = "exclamation-triangle"
|
||||
end
|
||||
return icon
|
||||
end
|
||||
|
||||
Notify.SendNotify = function(message, _type, time)
|
||||
time = time or 3000
|
||||
local icon = getIconByType(_type)
|
||||
local serial = exports['ZSX_UIV2']:Notification(placeHolderText, message, icon, time)
|
||||
return serial
|
||||
end
|
||||
|
||||
---This will send a notify message of the type and time passed
|
||||
---@param title string
|
||||
---@param message string
|
||||
---@param _type string
|
||||
---@param time number
|
||||
---@props table optional
|
||||
---@return nil
|
||||
Notify.SendNotification = function(title, message, _type, time, props)
|
||||
time = time or 3000
|
||||
if not title then title = placeHolderText end
|
||||
local icon = getIconByType(_type)
|
||||
exports['ZSX_UIV2']:Notification(title, message, icon, time)
|
||||
end
|
||||
|
||||
return Notify
|
||||
@@ -0,0 +1,121 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
local resourceName = "ZSX_UIV2"
|
||||
local configValue = BridgeClientConfig.ProgressBarSystem
|
||||
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
|
||||
|
||||
ProgressBar = ProgressBar or {}
|
||||
|
||||
ProgressBar.GetResourceName = function()
|
||||
return "ZSX_UIV2"
|
||||
end
|
||||
|
||||
---This function converts an Ox progress bar options table to ZSX_UIV2 format.
|
||||
---@param options table
|
||||
---@return table
|
||||
local function convertFromOx(options)
|
||||
if not options then return options end
|
||||
local prop1 = options.prop?[1] or options.prop or {}
|
||||
local prop2 = options.prop?[2] or {}
|
||||
|
||||
return {
|
||||
label = options.label,
|
||||
duration = options.duration,
|
||||
canCancel = options.canCancel,
|
||||
disableControls = {
|
||||
disable_mouse = options.disable?.mouse,
|
||||
disable_walk = options.disable?.move,
|
||||
disable_driving = options.disable?.car,
|
||||
disable_combat = options.disable?.combat
|
||||
},
|
||||
anim = options.anim and {
|
||||
dict = options.anim.dict,
|
||||
clip = options.anim.clip,
|
||||
flag = options.anim.flag or 49
|
||||
} or nil,
|
||||
prop1 = prop1.model and {
|
||||
model = prop1.model,
|
||||
bone = prop1.bone,
|
||||
pos = prop1.pos,
|
||||
rot = prop1.rot
|
||||
} or nil,
|
||||
prop2 = prop2.model and {
|
||||
model = prop2.model,
|
||||
bone = prop2.bone,
|
||||
pos = prop2.pos,
|
||||
rot = prop2.rot
|
||||
} or nil
|
||||
}
|
||||
end
|
||||
|
||||
---This function converts a QB progress bar options table to ZSX_UIV2 format.
|
||||
---@param options table
|
||||
---@return table
|
||||
local function convertFromQB(options)
|
||||
if not options then return options end
|
||||
|
||||
return {
|
||||
label = options.label,
|
||||
duration = options.duration,
|
||||
canCancel = options.canCancel,
|
||||
disableControls = {
|
||||
disable_mouse = options.controlDisables?.disableMouse,
|
||||
disable_walk = options.controlDisables?.disableMovement,
|
||||
disable_driving = options.controlDisables?.disableCarMovement,
|
||||
disable_combat = options.controlDisables?.disableCombat
|
||||
},
|
||||
anim = options.animation and {
|
||||
dict = options.animation.animDict,
|
||||
clip = options.animation.anim,
|
||||
flag = options.animation.flags or 49
|
||||
} or nil,
|
||||
prop1 = options.prop and options.prop.model and {
|
||||
model = options.prop.model,
|
||||
bone = options.prop.bone,
|
||||
pos = options.prop.coords,
|
||||
rot = options.prop.rotation
|
||||
} or nil,
|
||||
prop2 = options.propTwo and options.propTwo.model and {
|
||||
model = options.propTwo.model,
|
||||
bone = options.propTwo.bone,
|
||||
pos = options.propTwo.coords,
|
||||
rot = options.propTwo.rotation
|
||||
} or nil
|
||||
}
|
||||
end
|
||||
|
||||
---This function opens a progress bar.
|
||||
---@param options table
|
||||
---@param cb any
|
||||
---@param qbFormat boolean
|
||||
---@return boolean boolean
|
||||
function ProgressBar.Open(options, cb, qbFormat)
|
||||
if not exports['ZSX_UIV2'] then return false end
|
||||
|
||||
if qbFormat then
|
||||
options = convertFromQB(options)
|
||||
else
|
||||
options = convertFromOx(options)
|
||||
end
|
||||
local prom = promise.new()
|
||||
exports['ZSX_UIV2']:ProgressBar(
|
||||
'fas fa-circle-notch',
|
||||
options.label,
|
||||
options.duration or 5000,
|
||||
function()
|
||||
if cb then cb(true) end
|
||||
prom:resolve(true)
|
||||
end,
|
||||
function()
|
||||
if cb then cb(false) end
|
||||
prom:resolve(false)
|
||||
end,
|
||||
options.canCancel,
|
||||
options.disableControls,
|
||||
options.anim,
|
||||
options.prop1,
|
||||
options.prop2
|
||||
)
|
||||
return Citizen.Await(prom)
|
||||
end
|
||||
|
||||
return ProgressBar
|
||||
@@ -1,7 +1,7 @@
|
||||
BridgeClientConfig = {}
|
||||
BridgeClientConfig.InputSystem = "auto" -- [ auto | ox_lib | lation_ui | qb-input ]
|
||||
BridgeClientConfig.MenuSystem = "auto" -- [ auto | ox_lib | wasabi_uikit | lation_ui | qb-menu ]
|
||||
BridgeClientConfig.ProgressBarSystem = "auto" -- [ auto | ox_lib | wasabi_uikit | lation_ui | keep-progressbar | progressbar ]
|
||||
BridgeClientConfig.ProgressBarSystem = "auto" -- [ auto | ox_lib | wasabi_uikit | lation_ui | ZSX_UIV2 | keep-progressbar | progressbar ]
|
||||
BridgeClientConfig.VehicleKey = "auto" -- [ auto | qb-vehiclekeys | MrNewbVehicleKeys | jaksams_VehiclesKeys | wasabi_carlock | mk_vehiclekeys | qbx_vehiclekeys | qs-vehiclekeys | t1ger_keys | Renewed-Vehiclekeys | mono_carkeys| cd_garage | okokGarage | F_RealCarKeysSystem
|
||||
BridgeClientConfig.Fuel = "auto" -- [ auto | LegacyFuel | ox_fuel | ps-fuel | qs-fuelstations | Renewed-Fuel | ti_fuel | lc_fuel | x-fuel | cdn-fuel | esx-sna-fuel | BigDaddy-Fuel | okokGasStation ]
|
||||
BridgeClientConfig.TargetSystem = "auto" -- [ auto | ox_target | qb-target | sleepless_interact ] -- sleepless is only partially supported and would need another system in place
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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 | wasabi_notify | lation_ui | okokNotify | mythic_notify | pNotify | t-notify | brutal_notify | FL-Notify]
|
||||
BridgeSharedConfig.HelpText = "auto" -- [ auto | ox_lib | jg-textui | lation_ui | cd_drawtextui | lab-HintUI | okokTextUI]
|
||||
BridgeSharedConfig.Notify = "auto" -- [ auto | ox_lib | r_notify | wasabi_notify | lation_ui | ZSX_UIV2 | okokNotify | mythic_notify | pNotify | t-notify | brutal_notify | FL-Notify]
|
||||
BridgeSharedConfig.HelpText = "auto" -- [ auto | ox_lib | jg-textui | lation_ui | ZSX_UIV2 | cd_drawtextui | lab-HintUI | okokTextUI]
|
||||
BridgeSharedConfig.Phone = "auto" -- [ auto | qs-smartphone | lb-phone | gksphone]
|
||||
BridgeSharedConfig.Skills = "auto" -- [ auto | OT_skills | evolent_skills | pickle_xp]
|
||||
|
||||
|
||||
Reference in new issue
Block a user