diff --git a/resources/[tools]/nordi_dj/client/main.lua b/resources/[tools]/nordi_dj/client/main.lua index 55069d83a..b40af42e4 100644 --- a/resources/[tools]/nordi_dj/client/main.lua +++ b/resources/[tools]/nordi_dj/client/main.lua @@ -75,70 +75,56 @@ function GetNearbyDJBooth() return nil end -function OpenDJMenu() - TriggerServerEvent('dj:server:getPlaylists') - - local options = { - { - title = 'YouTube Song abspielen', - description = 'Spiele einen Song von YouTube ab', - icon = 'fab fa-youtube', - onSelect = function() - OpenYouTubeMenu() - end - }, - { - title = 'Direkte URL abspielen', - description = 'Spiele einen Song von einer direkten URL ab', - icon = 'play', - onSelect = function() - OpenDirectUrlMenu() - end - }, - { - title = 'Musik stoppen', - description = 'Stoppe die aktuelle Musik', - icon = 'stop', - onSelect = function() - StopMusic() - end - }, - { - title = 'Lautstärke ändern', - description = 'Aktuelle Lautstärke: ' .. currentVolume .. '%', - icon = 'volume-up', - onSelect = function() - OpenVolumeMenu() - end - }, - { - title = 'Playlists verwalten', - description = 'Erstelle und verwalte Playlists', - icon = 'list', - onSelect = function() - OpenPlaylistMenu() - end - } - } - - if isPlaying and currentSong then - table.insert(options, 2, { - title = 'Aktueller Song', - description = currentSong.title, - icon = 'music', - disabled = true +-- Aktualisierte Client-Funktionen für das neue UI +function OpenDJInterface() + if not isDJBooth then + lib.notify({ + title = 'DJ System', + description = 'Du musst an einem DJ Pult stehen', + type = 'error' }) + return end - lib.registerContext({ - id = 'dj_main_menu', - title = 'DJ System - ' .. currentDJBooth.name, - options = options + SetNuiFocus(true, true) + SendNUIMessage({ + type = 'showDJInterface' }) - lib.showContext('dj_main_menu') + isUIOpen = true + + -- Disable controls while UI is open + CreateThread(function() + while isUIOpen do + DisableAllControlActions(0) + EnableControlAction(0, 1, true) -- Mouse look + EnableControlAction(0, 2, true) -- Mouse look + Wait(0) + end + end) end +-- NUI Callbacks für das neue Interface +RegisterNUICallback('djInterfaceClosed', function(data, cb) + SetNuiFocus(false, false) + isUIOpen = false + cb('ok') +end) + +RegisterNUICallback('deckStateChanged', function(data, cb) + print(string.format('[DJ System] Deck %s %s: %s', + data.deck, + data.isPlaying and 'playing' or 'stopped', + data.track and data.track.title or 'No track' + )) + + -- Hier könntest du zusätzliche Logik hinzufügen + -- z.B. Synchronisation mit anderen Spielern + + cb('ok') +end) + + function OpenYouTubeMenu() local input = lib.inputDialog('YouTube Song abspielen', { {type = 'input', label = 'Song Titel', placeholder = 'z.B. Daft Punk - One More Time'}, diff --git a/resources/[tools]/nordi_dj/html/index.html b/resources/[tools]/nordi_dj/html/index.html index 7f3fa6d63..6e7538855 100644 --- a/resources/[tools]/nordi_dj/html/index.html +++ b/resources/[tools]/nordi_dj/html/index.html @@ -3,23 +3,386 @@
-