manups4e / ScaleformUI

ScaleformUI is a GTA menu styled API made with custom Scaleforms to be lighter, faster and visually better
Other
139 stars 49 forks source link

Radio menu staying open? #201

Closed GLiTcH2 closed 12 hours ago

GLiTcH2 commented 6 months ago

I wanted to mess around with the radio menu and copied the code from the example to make my own menu, This is what I copied (Except for the bottom code, Added a bit to use a button/key combo to open it instead of single) :

function CreateRadioMenu()

    local txd = CreateRuntimeTxd("scaleformui")
    local imgdui1 = CreateDui("https://giphy.com/embed/10bTCLE8GtHHS8", 96, 64)
    CreateRuntimeTextureFromDuiHandle(txd, "item2", GetDuiHandle(imgdui1))
    local menu = UIRadioMenu.New()
    menu:AnimationDuration(1.0)
    menu:AnimDirection(-1)
    for i=1, 25, 1 do
        local item = RadioItem.New("Station " .. i, "Artist " .. i, "Track " .. i, "scaleformui", "item2")
        menu:AddStation(item)
    end
    menu.OnMenuOpen = function(menu, _)
        ScaleformUI.Notifications:ShowSubtitle("Radio Menu opened!")
    end

    menu.OnMenuClose = function(menu)
        ScaleformUI.Notifications:ShowSubtitle("Radio Menu closed!")
    end

    menu.OnIndexChange = function(index)
        ScaleformUI.Notifications:ShowSubtitle("Index ".. index .. " highlighted!")
    end

    menu.OnStationSelect = function(station, index)
        ScaleformUI.Notifications:ShowSubtitle("Selected station with index" .. index .. "!")
    end

    menu:Visible(true)

end

Citizen.CreateThread(function()
    while true do
        Wait(0)
        if IsControlPressed(0, 206) and IsControlJustPressed(0, 204) and not MenuHandler:IsAnyMenuOpen() then
            CreateRadialMenu()
        end
    end
end)

I wanted to test it in game to make sure it works and it does but once I open the menu and then close it, While it visibly closes on the screen it's like invisible in the background and if I move the analog stick on controller or use the mouse, It just keeps selecting the different stations/index. Once this happens I cant open the menu back up at all unless I restart the resource. Did I miss something from the example that I needed to copy in order to have it close properly?

Mathu-lmn commented 3 days ago

Hey, is that still the case now ? Could you try it with the last version ?

Mathu-lmn commented 1 day ago

@manups4e is this still an issue ?

manups4e commented 1 day ago

No idea

Mathu-lmn commented 17 hours ago

I have opened a PR to fix this issue, thanks for reporting and sorry for the huge delay ;)