From 3175f02cb3ee3c31c3268d6d3762e80988fc547f Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Sun, 2 Jul 2023 11:54:53 +0100 Subject: [PATCH 1/4] Add support for multiple static dialogs --- client.lua | 4 ++++ 1 file changed, 4 insertions(+) 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 { From c499186eef579df520292c91c8ed44654d619abe Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Sun, 2 Jul 2023 11:56:06 +0100 Subject: [PATCH 2/4] Add support for multiple static dials (2/2) --- ui/js/app.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ui/js/app.js b/ui/js/app.js index 9b9f502..dcc7848 100644 --- a/ui/js/app.js +++ b/ui/js/app.js @@ -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, @@ -147,20 +147,20 @@ window.onData = function (data) { staticDial.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 +} From be3e4ebd5d89c77845f9ce10bc006cdf8923e837 Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Sun, 2 Jul 2023 11:57:59 +0100 Subject: [PATCH 3/4] Fix last commit --- ui/js/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/js/app.js b/ui/js/app.js index dcc7848..eac5db2 100644 --- a/ui/js/app.js +++ b/ui/js/app.js @@ -143,8 +143,8 @@ 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[data.id].render(ui); From 3a18cf5fcf8f111a1ac6d0b6b0d0636c7c65b377 Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Sun, 2 Jul 2023 12:01:38 +0100 Subject: [PATCH 4/4] Final fix --- ui/js/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/js/app.js b/ui/js/app.js index eac5db2..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) {