diff --git a/client.lua b/client.lua index 27cde43..7172836 100644 --- a/client.lua +++ b/client.lua @@ -1,5 +1,6 @@ local OnStart, OnComplete, OnTimeout, Animation = nil, nil, nil, nil local Run, MiniGameCompleted = false, false +local idIncrement = 0 ------------------------------------------------------------ -- MAIN FUNCTIONS -- @@ -148,6 +149,9 @@ function Static(config) options.display = false options.static = true + idIncrement = idIncrement + 1 + options.id = idIncrement + SendNUIMessage(options) return { diff --git a/ui/js/app.js b/ui/js/app.js index 9b9f502..7c77b0a 100644 --- a/ui/js/app.js +++ b/ui/js/app.js @@ -1,7 +1,7 @@ const ui = document.getElementById('rprogress'); let running = false; let customDial = false -let staticDial = false +let staticDial = []; let miniGame = false window.onData = function (data) { @@ -123,8 +123,8 @@ window.onData = function (data) { } if ( data.static ) { - if ( !staticDial ) { - staticDial = new RadialProgress({ + if ( !staticDial[data.id] ) { + staticDial[data.id] = new RadialProgress({ r: data.Radius, s: data.Stroke, x: data.x, @@ -143,24 +143,24 @@ window.onData = function (data) { }, }); - staticDial.container.classList.add(`label-${data.LabelPosition}`); - staticDial.label.textContent = data.Label; + staticDial[data.id].container.classList.add(`label-${data.LabelPosition}`); + staticDial[data.id].label.textContent = data.Label; } else { if (data.show) { - staticDial.render(ui); + staticDial[data.id].render(ui); } if (data.hide) { - staticDial.remove(); + staticDial[data.id].remove(); } if ( data.progress !== false ) { - staticDial.setProgress(data.progress) + staticDial[data.id].setProgress(data.progress) } if (data.destroy) { - staticDial.remove(); - staticDial = false; + staticDial[data.id].remove(); + staticDial[data.id] = false; } } } @@ -221,4 +221,4 @@ function PostData(type, obj) { }, body: JSON.stringify(obj) }).then(resp => resp.json()).then(resp => resp).catch(error => console.log('RPROGRESS FETCH ERROR! ' + error.message)); -} \ No newline at end of file +}