From 3497eb6bcac0c853c34b5cfa3fe14efbb5641c49 Mon Sep 17 00:00:00 2001 From: Csoki Date: Tue, 24 Jan 2023 19:05:57 +0100 Subject: [PATCH] BREAKING CHANGE(es_extended): remove ESX.UI.HUD and hud functions --- [core]/es_extended/client/functions.lua | 70 ----------- [core]/es_extended/client/main.lua | 58 --------- [core]/es_extended/config.lua | 1 - [core]/es_extended/fxmanifest.lua | 4 - [core]/es_extended/html/css/app.css | 111 ++++++++---------- [core]/es_extended/html/img/accounts/bank.png | Bin 1015 -> 0 bytes .../html/img/accounts/black_money.png | Bin 1030 -> 0 bytes .../es_extended/html/img/accounts/money.png | Bin 662 -> 0 bytes [core]/es_extended/html/js/app.js | 86 +------------- [core]/es_extended/html/ui.html | 22 ++-- 10 files changed, 61 insertions(+), 291 deletions(-) delete mode 100644 [core]/es_extended/html/img/accounts/bank.png delete mode 100644 [core]/es_extended/html/img/accounts/black_money.png delete mode 100644 [core]/es_extended/html/img/accounts/money.png diff --git a/[core]/es_extended/client/functions.lua b/[core]/es_extended/client/functions.lua index 5403abcd..95975306 100644 --- a/[core]/es_extended/client/functions.lua +++ b/[core]/es_extended/client/functions.lua @@ -6,12 +6,6 @@ Core.CurrentRequestId = 0 Core.ServerCallbacks = {} Core.TimeoutCallbacks = {} Core.Input = {} -ESX.UI = {} -ESX.UI.HUD = {} -ESX.UI.HUD.RegisteredElements = {} -ESX.UI.Menu = {} -ESX.UI.Menu.RegisteredTypes = {} -ESX.UI.Menu.Opened = {} ESX.Game = {} ESX.Game.Utils = {} @@ -210,70 +204,6 @@ function ESX.TriggerServerCallback(name, cb, ...) Core.CurrentRequestId = Core.CurrentRequestId < 65535 and Core.CurrentRequestId + 1 or 0 end -function ESX.UI.HUD.SetDisplay(opacity) - SendNUIMessage({ - action = 'setHUDDisplay', - opacity = opacity - }) -end - -function ESX.UI.HUD.RegisterElement(name, index, priority, html, data) - local found = false - - for i = 1, #ESX.UI.HUD.RegisteredElements, 1 do - if ESX.UI.HUD.RegisteredElements[i] == name then - found = true - break - end - end - - if found then - return - end - - ESX.UI.HUD.RegisteredElements[#ESX.UI.HUD.RegisteredElements + 1] = name - - SendNUIMessage({ - action = 'insertHUDElement', - name = name, - index = index, - priority = priority, - html = html, - data = data - }) - - ESX.UI.HUD.UpdateElement(name, data) -end - -function ESX.UI.HUD.RemoveElement(name) - for i = 1, #ESX.UI.HUD.RegisteredElements, 1 do - if ESX.UI.HUD.RegisteredElements[i] == name then - table.remove(ESX.UI.HUD.RegisteredElements, i) - break - end - end - - SendNUIMessage({ - action = 'deleteHUDElement', - name = name - }) -end - -function ESX.UI.HUD.Reset() - SendNUIMessage({ - action = 'resetHUDElements' - }) - ESX.UI.HUD.RegisteredElements = {} -end - -function ESX.UI.HUD.UpdateElement(name, data) - SendNUIMessage({ - action = 'updateHUDElement', - name = name, - data = data - }) -end - function ESX.UI.Menu.RegisterType(type, open, close) ESX.UI.Menu.RegisteredTypes[type] = { open = open, diff --git a/[core]/es_extended/client/main.lua b/[core]/es_extended/client/main.lua index a10df217..653960d9 100644 --- a/[core]/es_extended/client/main.lua +++ b/[core]/es_extended/client/main.lua @@ -118,23 +118,6 @@ AddEventHandler('esx:playerLoaded', function(xPlayer, isNew, skin) end end) - if Config.EnableHud then - for i=1, #(ESX.PlayerData.accounts) do - local accountTpl = '
 {{money}}
' - ESX.UI.HUD.RegisterElement('account_' .. ESX.PlayerData.accounts[i].name, i, 0, accountTpl, {money = ESX.Math.GroupDigits(ESX.PlayerData.accounts[i].money)}) - end - - local jobTpl = '
{{job_label}}{{grade_label}}
' - - local gradeLabel = ESX.PlayerData.job.grade_label ~= ESX.PlayerData.job.label and ESX.PlayerData.job.grade_label or '' - if gradeLabel ~= '' then gradeLabel = ' - '..gradeLabel end - - ESX.UI.HUD.RegisterElement('job', #ESX.PlayerData.accounts, 0, jobTpl, { - job_label = ESX.PlayerData.job.label, - grade_label = gradeLabel - }) - end - SetDefaultVehicleNumberPlateTextPattern(-1, Config.CustomAIPlates) StartServerSyncLoops() end) @@ -142,7 +125,6 @@ end) RegisterNetEvent('esx:onPlayerLogout') AddEventHandler('esx:onPlayerLogout', function() ESX.PlayerLoaded = false - if Config.EnableHud then ESX.UI.HUD.Reset() end end) RegisterNetEvent('esx:setMaxWeight') @@ -227,12 +209,6 @@ AddEventHandler('esx:setAccountMoney', function(account) end ESX.SetPlayerData('accounts', ESX.PlayerData.accounts) - - if Config.EnableHud then - ESX.UI.HUD.UpdateElement('account_' .. account.name, { - money = ESX.Math.GroupDigits(account.money) - }) - end end) if not Config.OxInventory then @@ -307,14 +283,6 @@ end RegisterNetEvent('esx:setJob') AddEventHandler('esx:setJob', function(Job) - if Config.EnableHud then - local gradeLabel = Job.grade_label ~= Job.label and Job.grade_label or '' - if gradeLabel ~= '' then gradeLabel = ' - '..gradeLabel end - ESX.UI.HUD.UpdateElement('job', { - job_label = Job.label, - grade_label = gradeLabel - }) - end ESX.SetPlayerData('job', Job) end) @@ -379,32 +347,6 @@ if not Config.OxInventory then end) end --- Pause menu disables HUD display -if Config.EnableHud then - CreateThread(function() - local isPaused = false - - while true do - local time = 500 - Wait(time) - - if IsPauseMenuActive() and not isPaused then - time = 100 - isPaused = true - ESX.UI.HUD.SetDisplay(0.0) - elseif not IsPauseMenuActive() and isPaused then - time = 100 - isPaused = false - ESX.UI.HUD.SetDisplay(1.0) - end - end - end) - - AddEventHandler('esx:loadingScreenOff', function() - ESX.UI.HUD.SetDisplay(1.0) - end) -end - function StartServerSyncLoops() if not Config.OxInventory then -- keep track of ammo diff --git a/[core]/es_extended/config.lua b/[core]/es_extended/config.lua index 46daa5dd..2f465f82 100644 --- a/[core]/es_extended/config.lua +++ b/[core]/es_extended/config.lua @@ -19,7 +19,6 @@ Config.Accounts = { Config.StartingAccountMoney = {bank = 50000} Config.EnableSocietyPayouts = false -- pay from the society account that the player is employed at? Requirement: esx_society -Config.EnableHud = false -- enable the default hud? Display current job and accounts (black, bank & cash) Config.MaxWeight = 24 -- the max inventory weight without backpack Config.PaycheckInterval = 7 * 60000 -- how often to recieve pay checks in milliseconds Config.EnableDebug = false -- Use Debug options? diff --git a/[core]/es_extended/fxmanifest.lua b/[core]/es_extended/fxmanifest.lua index 0f5ca570..7694c427 100644 --- a/[core]/es_extended/fxmanifest.lua +++ b/[core]/es_extended/fxmanifest.lua @@ -61,10 +61,6 @@ files { 'html/fonts/pdown.ttf', 'html/fonts/bankgothic.ttf', - - 'html/img/accounts/bank.png', - 'html/img/accounts/black_money.png', - 'html/img/accounts/money.png' } dependencies { diff --git a/[core]/es_extended/html/css/app.css b/[core]/es_extended/html/css/app.css index 7c4c63f1..0bdbc908 100644 --- a/[core]/es_extended/html/css/app.css +++ b/[core]/es_extended/html/css/app.css @@ -1,88 +1,75 @@ @font-face { - font-family: 'Pricedown'; - src: url('../fonts/pdown.ttf') + font-family: 'Pricedown'; + src: url('../fonts/pdown.ttf'); } @font-face { - font-family: 'bankgothic'; - src: url('../fonts/bankgothic.ttf') + font-family: 'bankgothic'; + src: url('../fonts/bankgothic.ttf'); } html { - overflow: hidden; -} - -#hud { - opacity: 0.0; - position: absolute; - font-family: 'Pricedown'; - font-size: 35px; - color: white; - padding: 4px; - text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; - text-align: right; - top: 80; - right: 40; + overflow: hidden; } #inventory_notifications { - font-family: bankgothic; - position: absolute; - right: 40; - bottom: 40; - font-size: 2em; - font-weight: bold; - color: #FFF; - text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; + font-family: bankgothic; + position: absolute; + right: 40; + bottom: 40; + font-size: 2em; + font-weight: bold; + color: #fff; + text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; } .menu { - font-family: 'Open Sans', sans-serif; - min-width: 400px; - min-height: 250px; - color: #fff; - position: absolute; - left: 40; - top: 0; + font-family: 'Open Sans', sans-serif; + min-width: 400px; + min-height: 250px; + color: #fff; + position: absolute; + left: 40; + top: 0; } .menu .head { - font-family: 'Open Sans', sans-serif; - font-size: 28px; - padding: 10px; - background: #1A1A1A; - border-bottom: 3px solid #BC1635; - border-radius: 10px 10px 0 0; - -webkit-border-radius: 10px 10px 0 0; - -moz-border-radius: 10px 10px 0 0; - -o-border-radius: 10px 10px 0 0; - box-shadow: inset 0px 1px 0 rgba(255, 255, 255, 0.28); - -webkit-box-shadow: inset 0px 1px 0 rgba(255, 255, 255, 0.28); - -moz-box-shadow: inset 0px 1px 0 rgba(255, 255, 255, 0.28); - -o-box-shadow: inset 0px 1px 0 rgba(255, 255, 255, 0.28); - box-shadow: 1px 1px 10px 4px rgba(0, 0, 0, 0.4); + font-family: 'Open Sans', sans-serif; + font-size: 28px; + padding: 10px; + background: #1a1a1a; + border-bottom: 3px solid #bc1635; + border-radius: 10px 10px 0 0; + -webkit-border-radius: 10px 10px 0 0; + -moz-border-radius: 10px 10px 0 0; + -o-border-radius: 10px 10px 0 0; + box-shadow: inset 0px 1px 0 rgba(255, 255, 255, 0.28); + -webkit-box-shadow: inset 0px 1px 0 rgba(255, 255, 255, 0.28); + -moz-box-shadow: inset 0px 1px 0 rgba(255, 255, 255, 0.28); + -o-box-shadow: inset 0px 1px 0 rgba(255, 255, 255, 0.28); + box-shadow: 1px 1px 10px 4px rgba(0, 0, 0, 0.4); } .menu .head span { - font-family: 'Pricedown'; - font-size: 28px; - padding-left: 15px; - padding-top: 6px; + font-family: 'Pricedown'; + font-size: 28px; + padding-left: 15px; + padding-top: 6px; } .menu .menu-items .menu-item { - font-family: 'Open Sans', sans-serif; - font-size: 14px; - 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; + font-family: 'Open Sans', sans-serif; + font-size: 14px; + 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: #ccc; + background-color: #ccc; } diff --git a/[core]/es_extended/html/img/accounts/bank.png b/[core]/es_extended/html/img/accounts/bank.png deleted file mode 100644 index eb36dc8e70242136858874dc04024f41a4a0ffe4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1015 zcmV(_`g8%^e{{R4h=>PzAFaQARU;qF*m;eA5Z<1fd zMgRZowVTiq@}o(XxOP=4eyC973P=U1kRsFroRJ#! z(58{#776h;aLEM;L{SeVNSr|QQXy1+3PCF$LRAh>$;D}$6yr9(+&K1ncOM65H{N(1 z#D$Kuhc`R(oq6-#%=d|SpP}3h7iYue{}eqbkx7XFRFr{CNQ8)Xb~jy=7uE?4gk`F&OBwm4 zCoMHTH>$?xM%AIWM*@A{$sTp={U_D<+^9-VTDxK-EK`kLJ+5RzDnM!ek$H}yvF_~J zI*(=_0U-a;0)z8Wb)S zQLZ90W&QVw7&*Bd#kDto4a&FO>rT+B>2t%_D-HHP*Nt0qx&3jG%#?*w*}g}u7*V?q zC7?WT9&9^T7ittfS!~IwsWS)S-1}*T;uj^>ZdO>nzDliBXXNxy;O7swHVm3ETF1EN z4>(O1#JYDsk>%W4c>Lb8d62J?Ix`%Uf2Yk(iFNB}y6}hU)_oQ5>d!CYZn)gNQs$4D zKRXVhm%qw}1`)u%qg{dS$JcVyN_M3G6VnGdaH2iso z*ZbP|p!QdtrOPGu48|kL$mfBbu>v}-m+cT8XD>e8k&fM(*Y<#MYaY*k@Ki@S_G~Xi l#{maD><5W>*iW*51^`FRlAF&_hJ*kB002ovPDHLkV1iBj&&U7( diff --git a/[core]/es_extended/html/img/accounts/black_money.png b/[core]/es_extended/html/img/accounts/black_money.png deleted file mode 100644 index a42f6aa5191115bd04d04a728fb3c3463e6f4345..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1030 zcmV+h1o``kP)(_`g8%^e{{R4h=>PzAFaQARU;qF*m;eA5Z<1fd zMgRZT+Hn2g&!y2+1h(>773hKd&LYji7 zJxDS2q!OyV*_F1(HYnsEh!-iPJ(ZSP4aAjfgeH{rV4AN*TFttfb$4bmZx7v>?##{# z?V&y}hv%8+>;1pa$1D1}yJgw3cww6SpVXsi=&FhUWSBxsRZ)ZpHLjQ@PC%vrF-;5A zcci3ZS)uWZC+3;63 zP5NhNQG_7k$iD&Ti^Y6K$y>Lur5_yG;D0)PoSwjGx9WA?yK@Hs5kM{?1izg=O;;2A zE;12U>4j-}Ke7u86iTH~$S#kLGN9`%@&R4v!+raho}Ul3%PuT1H9YLaYQ8!YA?Of- zVztV(#YN7~&4oJYkHxr{N_qVKVv+mBqQ_rKrRWbJ>C*YRIj$`(Qmj_#5W-hqGN!6> zV{%d^3_~`GGW5GJG9sN!Mmm{{ygWMU$&U>V%5RSxkxnKfFN}=5(nrED_VAxIbo05=N-zC3)GHzE;!+1%vw@o_Ie!Z2_5K&81r!?IKr zh1|)L^k^EFQYm)L%mA>fvlD<*LqnXsdzb!LjLmA5H@mvL+HiFMpO3e$U&jh*>&SnZ zV$Kc?zZa1REj@pHO6~;d1>2x z`tTvs=`>qSb=2%5?DW0_oIrm*E|tjU^S*KVxKv_5*ZFQ`g|C;En1A||AJ*1bt5o_1QC~4jk~{59$PIcV{Q6qIgLP zKq^8|I&+4yWpT4m;NyGu+76Wq2dk9|S8_RzKNyeuf?vty+6KQmHpaPRl6W-Aj+7n(5dsSW zU}|`nua=fVm(h*oWj@%uw`CvvUM_QEd6{>0J#-nldmtFgTgU5_if`vg<{vZ*r`$_iK0G#)*@UBUHMF0Q*07*qoM6N<$f`k9( AtN;K2 diff --git a/[core]/es_extended/html/img/accounts/money.png b/[core]/es_extended/html/img/accounts/money.png deleted file mode 100644 index e05c91b0bb0c4faaa5f7a756c8d755f79f16ef1b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 662 zcmV;H0%`q;P)X^iM1 zwrODs(MFhlOeu(NQ0k`3E;Jz*K^GS-(n(r$SyU$3qJ?eD zMP*mpn2qSn_kAq}bmn)YvwhF=@_y%VJ|R%M(p`JORs)2MydFE;JyWQAK|q{IAQ}hA zsyhM{0U8AUS5g$`?U^t?HoXv$CIFnf3%s=G2Ql8*L~|;W2a-vRHD=GMab2iXm9)0} zRdo#>4v9U^4yvOKm6E;rerq!GWmBG??mUXnR-`)j9C(kQSg8T_h|1_>OKQn;aJnw#49Ea}Z>7Q03CLP55lYp)h)ynn7D zS6Pu+NrmzJ;Y5uMX`O7DeLCUyXA6OBWqCZ{_|bE!t?IaJzi*t2jdY9)OanO)c3@?H z;Qo*$`xzffB@0Rx;H`nAI~(;KCr0F?*IS*07*qoM6N<$g3p&H&Hw-a diff --git a/[core]/es_extended/html/js/app.js b/[core]/es_extended/html/js/app.js index dce07feb..26fb67e4 100644 --- a/[core]/es_extended/html/js/app.js +++ b/[core]/es_extended/html/js/app.js @@ -1,59 +1,5 @@ (() => { - ESX = {}; - ESX.HUDElements = []; - - ESX.setHUDDisplay = function (opacity) { - $('#hud').css('opacity', opacity); - }; - - ESX.insertHUDElement = function (name, index, priority, html, data) { - ESX.HUDElements.push({ - name: name, - index: index, - priority: priority, - html: html, - data: data - }); - - ESX.HUDElements.sort((a, b) => { - return a.index - b.index || b.priority - a.priority; - }); - }; - - ESX.updateHUDElement = function (name, data) { - for (let i = 0; i < ESX.HUDElements.length; i++) { - if (ESX.HUDElements[i].name == name) { - ESX.HUDElements[i].data = data; - } - } - - ESX.refreshHUD(); - }; - - ESX.deleteHUDElement = function (name) { - for (let i = 0; i < ESX.HUDElements.length; i++) { - if (ESX.HUDElements[i].name == name) { - ESX.HUDElements.splice(i, 1); - } - } - - ESX.refreshHUD(); - }; - - ESX.resetHUDElements = function () { - ESX.HUDElements = []; - ESX.refreshHUD(); - }; - - ESX.refreshHUD = function () { - $('#hud').html(''); - - for (let i = 0; i < ESX.HUDElements.length; i++) { - let html = Mustache.render(ESX.HUDElements[i].html, ESX.HUDElements[i].data); - $('#hud').append(html); - } - }; ESX.inventoryNotification = function (add, label, count) { let notif = ''; @@ -79,35 +25,8 @@ }; window.onData = (data) => { - switch (data.action) { - case 'setHUDDisplay': { - ESX.setHUDDisplay(data.opacity); - break; - } - - case 'insertHUDElement': { - ESX.insertHUDElement(data.name, data.index, data.priority, data.html, data.data); - break; - } - - case 'updateHUDElement': { - ESX.updateHUDElement(data.name, data.data); - break; - } - - case 'deleteHUDElement': { - ESX.deleteHUDElement(data.name); - break; - } - - case 'resetHUDElements': { - ESX.resetHUDElements(); - break; - } - - case 'inventoryNotification': { - ESX.inventoryNotification(data.add, data.item, data.count); - } + if (data.action === 'inventoryNotification') { + ESX.inventoryNotification(data.add, data.item, data.count); } }; @@ -116,5 +35,4 @@ onData(event.data); }); }; - })(); diff --git a/[core]/es_extended/html/ui.html b/[core]/es_extended/html/ui.html index 653f41d8..86ad62be 100644 --- a/[core]/es_extended/html/ui.html +++ b/[core]/es_extended/html/ui.html @@ -1,14 +1,12 @@ - - - - - -
-
+ + + + +
- - - - - \ No newline at end of file + + + + +