what is the optimal way to implement navigation through multiple cuiPanels by buttons?
I have number of pages filled up with some number of buttons, I want to switch to this pages by buttons in my menu
so one way is:
1. on nextPage/prevPage button click to Destroy main UI panel
2. than generate whole menu container based on which page I want to display
3. and then send it to the client via cuihelper.addui(player, container)
well I think it's not an optimal solution because in my opinion it will take some time to reGenerate lots of buttons in every page turn
the way I did it to avoid reGeneration of pages in every turn works like this:
1. generate menu and first page on first start up, and send it to player
2. on nextPage/prevPage button click check if next page has already been generated, if not generate it
3. and than refresh menu (destroyUI, addUI) and when sending menu immediately remove all other unwanted pages with for cycle destroyUI(page_{i}..
In generating I mean reading buttons from config and adding it to the parent page panel and then putting that parent page in CuiElementContainer
well In my way I don't have to reGenerate already generated pages every time on changing page, but I think I did worse because when
going to next page I send whole CuiElementContainer containing all generated pages to player and than immediately removing all pages except the wished page
on page turn I see flicker of other pages, like for milliseconds
so is there any way to mark unintended pages(CuiPanels) hidden? so they wont appear(render) when AddUI(player,container)
to avoid removing unwanted pages via DestroyUI(player, $"page_panel_{i}")?
DestroyUI can remove specific panel
AddUI sends whole container of cuiElements, can I somehow send/render only specific panel/cuiElement?
CuiPanel multiple pages navigation in User InterfaceSolved
Unfortunately, CUI is pretty limited. You can only destroy or create a UI on the client, not move, hide or change in any way. You cannot avoid the client side performance cost of this, but you can add some optimization for the server performance by caching the objects or json output and mutating those.
WhiteThunder
Unfortunately, CUI is pretty limited. You can only destroy or create a UI on the client, not move, hide or change in any way. You cannot avoid the client side performance cost of this, but you can add some optimization for the server performance by caching the objects or json output and mutating those.
thank you for response
Locked automatically