ibyte
New Member
Posts: 24
|
Post by ibyte on May 29, 2023 3:33:16 GMT
Hello, I have a requirement and I was hoping you could tell me if it is achievable
I would like to make a non interactive looping vertical image scroller that has 8 visible cells with 1 extra cell at the top outside the visible space of the scrollview. The visible cells will be preloaded with image data at the start. From my code I would like to set the image for the top most offscreen cell and then change the scroll position so that the top most cell comes into view of the scrollview while the bottom most cell will cycle back to appear at the top offscreen. Each time I need to set top most offscreen cell and then have the scrollview move the contents down one. What i seem to be stuck on atm is home to move the looping scrolllist one cell down each time. Also I am not sure how i will track which cell is a the top so I can update the correct one each time.
Thanks for your input. Glenn
|
|
|
Post by echo17 on May 29, 2023 11:08:15 GMT
For the cell that is outside the scroll view, I would not even include it in the EnhancedScroller portion of the code. I would create a different UI element completely and just update it like you would any other UI element.
To move down one cell at a time, you can just keep track of which cell you are on in your controller with an integer index value. Just add one to go down or subtract one to go up, then call JumpToDataIndex on that new value to move the scroller.
|
|
ibyte
New Member
Posts: 24
|
Post by ibyte on May 29, 2023 12:48:46 GMT
Hi Thanks for the reply. I want to update the hidden one (outside the scrollview) so that it can be seen scrolling into view once I initiate the scroll. So I would not think that should be a separate element outside of the scrollview? My crude diagram - from what i think should happen I would issue JumpToDataIndex 0 first then update the image in cell #4 then JumpToDataIndex #4 then upadate cell #3 and then JumpToDataIndex #3 and so on until i wrap back to 0?
1drv.ms/i/s!AnvZALa2ne9bgoIX9Y0o_kC41KrD0g?e=iSoOn2 ( i tried to link the image but it is not showing up inline)
|
|
|
Post by echo17 on May 30, 2023 12:21:22 GMT
Hmmm, not sure how to accomplish this. It is definitely not built into EnhancedScroller, so you'll need to come up with a custom solution for this scenario. You might need to attach to the scrollerScrolled delegate in your controller and make changes to the UI based on the scroller's position.
|
|
ibyte
New Member
Posts: 24
|
Post by ibyte on May 30, 2023 13:47:28 GMT
I notice when I create and add 8 data items to the list and and do a reload I get 9 items in the scene hierarchy - 8 visible and one not visible.
Because I am looping I am not clear on the difference of the cellview index and the dataindex.
When I init my loop, I see as mentioned in the documentation there are 3 sets of objects created in the back ground but there are seems to be one extra?
My last attempt was to get the data index of the last visible item in the list, change the image and then do a scroll to that data item but it is not working.
Thanks
|
|
ibyte
New Member
Posts: 24
|
Post by ibyte on May 30, 2023 15:06:08 GMT
I also confused by this Based on the doc once the reload happens
• StartDataIndex: The first data index being displayed. The cell view index may be different than the data index if looping is occurring because there are more cell slots when looping. (See Looping section) • EndDataIndex: The last data index being displayed. The cell view index may be different than the data index if looping is occurring because there are more cell slots when looping. (See Looping section)
waterfallScroller.Delegate = this; waterfallScroller.ReloadData();
Debug.Log($"OnHistoryReadyMsgReceived dataIndex {waterfallScroller.StartDataIndex} for first visible item and dataIndex {waterfallScroller.EndDataIndex} for last visible item after dataload");
OnHistoryReadyMsgReceived dataIndex 0 for first visible item and dataIndex 0 for last visible item after dataload
Why are they both the same?
|
|
ibyte
New Member
Posts: 24
|
Post by ibyte on May 31, 2023 4:27:22 GMT
HI I ended up going a different route. Thanks for trying to help.
|
|