mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 15:06:02 +01:00
Merge branch 'master' of https://github.com/overextended/ox_lib
This commit is contained in:
@@ -24,11 +24,13 @@ function lib.registerContext(context)
|
||||
end
|
||||
end
|
||||
|
||||
RegisterNUICallback('openContext', function(id)
|
||||
RegisterNUICallback('openContext', function(id, cb)
|
||||
cb(1)
|
||||
lib.showContext(id)
|
||||
end)
|
||||
|
||||
RegisterNUICallback('clickContext', function(data)
|
||||
RegisterNUICallback('clickContext', function(data, cb)
|
||||
cb(1)
|
||||
if data.event then TriggerEvent(data.event, data.args) end
|
||||
if data.serverEvent then TriggerServerEvent(data.serverEvent, data.args) end
|
||||
SetNuiFocus(false, false)
|
||||
@@ -37,6 +39,7 @@ RegisterNUICallback('clickContext', function(data)
|
||||
})
|
||||
end)
|
||||
|
||||
RegisterNUICallback('closeContext', function()
|
||||
RegisterNUICallback('closeContext', function(_, cb)
|
||||
cb(1)
|
||||
SetNuiFocus(false, false)
|
||||
end)
|
||||
|
||||
22
resource/interface/client/input.lua
Normal file
22
resource/interface/client/input.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
function lib.inputDialog(heading, rows)
|
||||
if input then return end
|
||||
input = promise.new()
|
||||
|
||||
SetNuiFocus(true, true)
|
||||
SendNUIMessage({
|
||||
action = 'openDialog',
|
||||
data = {
|
||||
heading = heading,
|
||||
inputs = rows
|
||||
}
|
||||
})
|
||||
return Citizen.Await(input)
|
||||
end
|
||||
|
||||
RegisterNUICallback('inputData', function(data, cb)
|
||||
cb(1)
|
||||
if not input then return end
|
||||
if not data then input:resolve() else input:resolve(data) end
|
||||
SetNuiFocus(false, false)
|
||||
input = nil
|
||||
end)
|
||||
14
resource/interface/client/textui.lua
Normal file
14
resource/interface/client/textui.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
function lib.showTextUI(text, options)
|
||||
if not options then options = {} end
|
||||
options.text = text
|
||||
SendNUIMessage({
|
||||
action = 'textUi',
|
||||
data = options
|
||||
})
|
||||
end
|
||||
|
||||
function lib.hideTextUI()
|
||||
SendNUIMessage({
|
||||
action = 'textUiHide'
|
||||
})
|
||||
end
|
||||
Reference in New Issue
Block a user