mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
refactor(client/interface): nui focus consistency
This commit is contained in:
@@ -15,9 +15,8 @@ function lib.alertDialog(data)
|
||||
if alert then return end
|
||||
|
||||
alert = promise.new()
|
||||
|
||||
lib.setNuiFocus(false)
|
||||
SetNuiFocus(true, true)
|
||||
SetNuiFocusKeepInput(false)
|
||||
SendNUIMessage({
|
||||
action = 'sendAlert',
|
||||
data = data
|
||||
@@ -33,8 +32,8 @@ function lib.closeAlertDialog()
|
||||
SendNUIMessage({
|
||||
action = 'closeAlertDialog'
|
||||
})
|
||||
alert:resolve(nil)
|
||||
|
||||
alert:resolve(nil)
|
||||
alert = nil
|
||||
end
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ function lib.inputDialog(heading, rows, options)
|
||||
end
|
||||
end
|
||||
|
||||
SetNuiFocus(true, true)
|
||||
lib.setNuiFocus(false)
|
||||
SendNUIMessage({
|
||||
action = 'openDialog',
|
||||
data = {
|
||||
@@ -53,18 +53,22 @@ end
|
||||
|
||||
function lib.closeInputDialog()
|
||||
if not input then return end
|
||||
input:resolve(nil)
|
||||
input = nil
|
||||
SetNuiFocus(false, false)
|
||||
|
||||
lib.resetNuiFocus()
|
||||
SendNUIMessage({
|
||||
action = 'closeInputDialog'
|
||||
})
|
||||
|
||||
input:resolve(nil)
|
||||
input = nil
|
||||
end
|
||||
|
||||
RegisterNUICallback('inputData', function(data, cb)
|
||||
cb(1)
|
||||
SetNuiFocus(false, false)
|
||||
lib.resetNuiFocus()
|
||||
|
||||
local promise = input
|
||||
input = nil
|
||||
|
||||
promise:resolve(data)
|
||||
end)
|
||||
|
||||
@@ -120,8 +120,7 @@ function lib.hideRadial()
|
||||
data = false
|
||||
})
|
||||
|
||||
SetNuiFocus(false, false)
|
||||
SetNuiFocusKeepInput(false)
|
||||
lib.setNuiFocus(true)
|
||||
table.wipe(menuHistory)
|
||||
|
||||
isOpen = false
|
||||
@@ -266,7 +265,7 @@ RegisterNUICallback('radialClose', function(_, cb)
|
||||
|
||||
if not isOpen then return end
|
||||
|
||||
SetNuiFocus(false, false)
|
||||
lib.resetNuiFocus()
|
||||
|
||||
isOpen = false
|
||||
currentRadial = nil
|
||||
@@ -314,8 +313,8 @@ lib.addKeybind({
|
||||
items = menuItems
|
||||
}
|
||||
})
|
||||
SetNuiFocus(true, true)
|
||||
SetNuiFocusKeepInput(true)
|
||||
|
||||
lib.setNuiFocus(false)
|
||||
SetCursorLocation(0.5, 0.5)
|
||||
|
||||
while isOpen do
|
||||
|
||||
@@ -10,7 +10,7 @@ function lib.skillCheck(difficulty, inputs)
|
||||
if skillcheck then return end
|
||||
skillcheck = promise:new()
|
||||
|
||||
SetNuiFocus(true, false)
|
||||
lib.setNuiFocus(false, true)
|
||||
SendNUIMessage({
|
||||
action = 'startSkillCheck',
|
||||
data = {
|
||||
@@ -24,9 +24,11 @@ end
|
||||
|
||||
RegisterNUICallback('skillCheckOver', function(success, cb)
|
||||
cb(1)
|
||||
|
||||
if skillcheck then
|
||||
lib.resetNuiFocus()
|
||||
|
||||
skillcheck:resolve(success)
|
||||
skillcheck = nil
|
||||
SetNuiFocus(false, false)
|
||||
end
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user