diff --git a/README.md b/README.md index 62c42769..7a2235e4 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# fxserver-esx_menu_default -FXServer ESX Menu Default +# esx_menu_default +ESX Menu Default diff --git a/__resource.lua b/__resource.lua index eec9c5df..43bb03aa 100644 --- a/__resource.lua +++ b/__resource.lua @@ -19,10 +19,7 @@ files { 'html/js/mustache.min.js', 'html/js/app.js', 'html/fonts/pdown.ttf', - 'html/fonts/bankgothic.ttf', - 'html/img/cursor.png', - 'html/img/keys/enter.png', - 'html/img/keys/return.png', + 'html/fonts/bankgothic.ttf' } dependencies { diff --git a/client/main.lua b/client/main.lua index 984da0b5..5a482921 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1,7 +1,6 @@ ESX = nil Citizen.CreateThread(function() - while ESX == nil do TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) Citizen.Wait(0) @@ -24,7 +23,6 @@ Citizen.CreateThread(function() local MenuType = 'default' local openMenu = function(namespace, name, data) - SendNUIMessage({ action = 'openMenu', namespace = namespace, @@ -35,7 +33,6 @@ Citizen.CreateThread(function() end local closeMenu = function(namespace, name) - SendNUIMessage({ action = 'closeMenu', namespace = namespace, @@ -52,25 +49,20 @@ Citizen.CreateThread(function() if menu.submit ~= nil then menu.submit(data, menu) end - end) AddEventHandler('esx_menu_default:message:menu_cancel', function(data) - local menu = ESX.UI.Menu.GetOpened(MenuType, data._namespace, data._name) if menu.cancel ~= nil then menu.cancel(data, menu) end - end) AddEventHandler('esx_menu_default:message:menu_change', function(data) - local menu = ESX.UI.Menu.GetOpened(MenuType, data._namespace, data._name) - + for i=1, #data.elements, 1 do - menu.setElement(i, 'value', data.elements[i].value) if data.elements[i].selected then @@ -84,81 +76,68 @@ Citizen.CreateThread(function() if menu.change ~= nil then menu.change(data, menu) end - end) Citizen.CreateThread(function() while true do - Wait(0) + Citizen.Wait(10) if IsControlPressed(0, Keys['ENTER']) and GetLastInputMethod(2) and (GetGameTimer() - GUI.Time) > 150 then - SendNUIMessage({ action = 'controlPressed', control = 'ENTER' }) GUI.Time = GetGameTimer() - end if IsControlPressed(0, Keys['BACKSPACE']) and GetLastInputMethod(2) and (GetGameTimer() - GUI.Time) > 150 then - SendNUIMessage({ action = 'controlPressed', control = 'BACKSPACE' }) GUI.Time = GetGameTimer() - end - if IsControlPressed(0, Keys['TOP']) and GetLastInputMethod(2) and (GetGameTimer() - GUI.Time) > 150 then - + if IsControlPressed(0, Keys['TOP']) and GetLastInputMethod(2) and (GetGameTimer() - GUI.Time) > 200 then SendNUIMessage({ action = 'controlPressed', control = 'TOP' }) GUI.Time = GetGameTimer() - end - if IsControlPressed(0, Keys['DOWN']) and GetLastInputMethod(2) and (GetGameTimer() - GUI.Time) > 150 then - + if IsControlPressed(0, Keys['DOWN']) and GetLastInputMethod(2) and (GetGameTimer() - GUI.Time) > 200 then SendNUIMessage({ action = 'controlPressed', control = 'DOWN' }) GUI.Time = GetGameTimer() - end if IsControlPressed(0, Keys['LEFT']) and GetLastInputMethod(2) and (GetGameTimer() - GUI.Time) > 150 then - SendNUIMessage({ action = 'controlPressed', control = 'LEFT' }) GUI.Time = GetGameTimer() - end if IsControlPressed(0, Keys['RIGHT']) and GetLastInputMethod(2) and (GetGameTimer() - GUI.Time) > 150 then - SendNUIMessage({ action = 'controlPressed', control = 'RIGHT' }) GUI.Time = GetGameTimer() - end - end + end end) end) diff --git a/html/css/app.css b/html/css/app.css index 2739eada..84c72576 100644 --- a/html/css/app.css +++ b/html/css/app.css @@ -1,93 +1,94 @@ @font-face { - font-family: bankgothic; - src: url('../fonts/bankgothic.ttf'); + font-family: bankgothic; + src: url('../fonts/bankgothic.ttf'); } @font-face { - font-family: pcdown; - src: url('../fonts/pdown.ttf'); + font-family: pcdown; + src: url('../fonts/pdown.ttf'); } + .menu { - font-family: bankgothic; - min-width : 400px; - color : #fff; - box-shadow : 0px 0px 50px 0px #000; - position : absolute; + font-family: bankgothic; + min-width: 400px; + color: #fff; + box-shadow: 0px 0px 50px 0px #000; + position: absolute; } .menu.align-left { - left: 40; - top : 50%; - transform: translate(0, -50%); + left: 40; + top: 50%; + transform: translate(0, -50%); } .menu.align-top-left { - left: 40; - top : 40; + left: 40; + top: 40; } .menu.align-top { - left: 50%; - top : 40; - transform: translate(-50%, 0); + left: 50%; + top: 40; + transform: translate(-50%, 0); } .menu.align-top-right { - right: 10; - top : 40; + right: 10; + top: 40; } .menu.align-right { - right: 40; - top : 50%; - transform: translate(0, -50%); + right: 40; + top: 50%; + transform: translate(0, -50%); } .menu.align-bottom-right { - right : 40; - bottom: 40; + right: 40; + bottom: 40; } .menu.align-bottom { - left : 50%; - bottom: 40; - transform: translate(-50%, 0); + left: 50%; + bottom: 40; + transform: translate(-50%, 0); } .menu.align-bottom-left { - left : 40; - bottom: 40; + left: 40; + bottom: 40; } .menu.align-center { - left : 50%; - top : 50%; - transform: translate(-50%, -50%); + left: 50%; + top: 50%; + transform: translate(-50%, -50%); } .menu .head { - background-color: #506be6; - text-align : center; - height : 40px; - line-height : 40px; + background-color: #506be6; + text-align: center; + height: 40px; + line-height: 40px; } .menu .menu-items { - max-height : 600px; - overflow-y : auto; + max-height: 600px; + overflow-y: auto; } .menu .menu-items .menu-item { - height : 40px; - display : block; - background-color: #f1f1f1; - box-shadow : inset 1px 0px 0px 1px #b8b8b8; - height : 32px; - line-height : 32px; - color : #3A3A3A; - text-align : center; + height: 40px; + display: block; + background-color: #f1f1f1; + box-shadow: inset 1px 0px 0px 1px #b8b8b8; + height: 32px; + line-height: 32px; + color: #3A3A3A; + text-align: center; } .menu .menu-items .menu-item.selected { - background-color: #d0d0d0; + background-color: #d0d0d0; } \ No newline at end of file diff --git a/html/img/accounts/bank.png b/html/img/accounts/bank.png deleted file mode 100644 index eb36dc8e..00000000 Binary files a/html/img/accounts/bank.png and /dev/null differ diff --git a/html/img/accounts/black_money.png b/html/img/accounts/black_money.png deleted file mode 100644 index a42f6aa5..00000000 Binary files a/html/img/accounts/black_money.png and /dev/null differ diff --git a/html/img/cursor.png b/html/img/cursor.png deleted file mode 100644 index 39536f95..00000000 Binary files a/html/img/cursor.png and /dev/null differ diff --git a/html/img/keys/enter.png b/html/img/keys/enter.png deleted file mode 100644 index 3eb9a1f6..00000000 Binary files a/html/img/keys/enter.png and /dev/null differ diff --git a/html/img/keys/return.png b/html/img/keys/return.png deleted file mode 100644 index a3ca125a..00000000 Binary files a/html/img/keys/return.png and /dev/null differ diff --git a/html/js/app.js b/html/js/app.js index 8f0461c2..0a226575 100644 --- a/html/js/app.js +++ b/html/js/app.js @@ -51,7 +51,7 @@ if(data.elements[i].selected) ESX_MENU.pos[namespace][name] = i; else - data.elements[i].selected = false + data.elements[i].selected = false; } ESX_MENU.focus.push({ @@ -62,7 +62,7 @@ ESX_MENU.render(); $('#menu_' + namespace + '_' + name).find('.menu-item.selected')[0].scrollIntoView(); - } + }; ESX_MENU.close = function(namespace, name){ @@ -77,7 +77,7 @@ ESX_MENU.render(); - } + }; ESX_MENU.render = function(){ @@ -91,7 +91,7 @@ for(let name in ESX_MENU.opened[namespace]){ let menuData = ESX_MENU.opened[namespace][name]; - let view = JSON.parse(JSON.stringify(menuData)) + let view = JSON.parse(JSON.stringify(menuData)); for(let i=0; i { @@ -228,12 +228,12 @@ for(let i=0; i min){ elem.value--; - ESX_MENU.change(focused.namespace, focused.name, elem) + ESX_MENU.change(focused.namespace, focused.name, elem); } ESX_MENU.render(); @@ -335,12 +335,12 @@ if(typeof elem.options != 'undefined' && elem.value < elem.options.length - 1){ elem.value++; - ESX_MENU.change(focused.namespace, focused.name, elem) + ESX_MENU.change(focused.namespace, focused.name, elem); } if(typeof elem.max != 'undefined' && elem.value < elem.max){ elem.value++; - ESX_MENU.change(focused.namespace, focused.name, elem) + ESX_MENU.change(focused.namespace, focused.name, elem); } ESX_MENU.render(); @@ -368,12 +368,12 @@ } - } + }; window.onload = function(e){ window.addEventListener('message', (event) => { - onData(event.data) + onData(event.data); }); - } + }; -})() \ No newline at end of file +})(); \ No newline at end of file diff --git a/html/ui.html b/html/ui.html index c9363c07..af5fd03b 100644 --- a/html/ui.html +++ b/html/ui.html @@ -1,16 +1,16 @@ - - - - - - - - - - - + + + + + + + + + + + + - \ No newline at end of file