MrBounty / PZ-UI_API

UI API for the game project zomboid
17 stars 4 forks source link

UI:setCollapse(true) leaves black background when collapsed #1

Closed danielwa86 closed 17 hours ago

danielwa86 commented 2 years ago

Hello, I recently got into Project Zomboid modding and this UI Library is very helpful.

There is an issue with the Collapsable window in my mod however. Not sure what is causing it, but is it correct that UI:setCollapse(true) has to be set after UI:saveLayout() is applied?

Here's a clip of what's happening https://streamable.com/hlfy7w

Here's the code for the UI creation. This code is inside a Events.EveryDays.Add(EveryDays) function getting triggered once a day at 00:00. I also tried copying the examples but got the same problem with the black background.

UI = NewUI();
UI:setTitle("Day " .. tostring(math.floor(HN_getActualSpawnAgeDay())) .. " Report")
UI:addText("zombieKillsPanel", "  Killed Zombies: " .. zombieKillsDelta, "Medium", "Left")
UI:nextLine()
UI:addText("weightPanel", "   Weight Delta: " .. math.floor(playerWeightDelta * 100) / 100, "Small", "Left")
for k, v in pairs(skillGains) do        
    if v.skillDelta > 0 then
        local skillString = tostring(k)
        UI:nextLine()
        UI:addText("","   " .. skillString .. " XP: " .. math.floor(v.skillDelta * 100) / 100, "Small", "Left")
    end
end
UI:setWidthPixel(260) 
UI:saveLayout()
UI:setPositionPixel(getWidth - 420, 120)
--UI:setCollapse(true)
MrBounty commented 17 hours ago

Closed because old, I think I fixed that at some point.