Author Topic: Infinite DraggablePanel for Facebook Friends (Buffer Bug?!)  (Read 10918 times)

badawe

  • Jr. Member
  • **
  • Thank You
  • -Given: 8
  • -Receive: 7
  • Posts: 70
    • View Profile
Infinite DraggablePanel for Facebook Friends (Buffer Bug?!)
« on: January 24, 2013, 03:06:16 PM »
Hey guys, we're making a social game, and we need to load every friend of player's facebook.

Already so some searches here in the forum, but I cant see a real good way of doing that, here is the options I see:
 - Loading 50 friends at time, and when the user reach the end of the Draggable Pannel, we can remove some of top and load again the new ones.
 - Using the Apple table approach, creating like 10 cells and move these things around changing the vallues, like if the first one become invible, you move this to the bottom of the line and set the values of the 7 cell (I try to achieve that, but using some triggers to detect that don't seems to work, and do foreach object to check the position will be extremely heavy) but this really seem the way of doing that
- Make a navegation arrow with pages for the user navegate?


So what do you guys think?
« Last Edit: January 28, 2013, 11:38:13 AM by badawe »

badawe

  • Jr. Member
  • **
  • Thank You
  • -Given: 8
  • -Receive: 7
  • Posts: 70
    • View Profile
Re: What is the best approach for a friends list of Facebook
« Reply #1 on: January 25, 2013, 01:36:43 PM »
Basically I come up with one solution that sounds amazing!

 - Basically works like that:

 Everytime my panel is draggable to down and one row become invisible at top, I just reposition the panel with
  1. dragPannel.MoveRelative(new Vector3(0, -115, 0));

And move all my itens inside this panel +1 displaying the next on! Works perfect on Unity Editor:
http://www.youtube.com/watch?v=CYba0-4YMfk

But when is runnin on Editor, get some strange thing, looks like when i write some
http://www.youtube.com/watch?v=fS54I8tzlNg


Have some idea of what is going wrong?

PoN

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 4
  • Posts: 111
    • View Profile
Re: What is the best approach for a friends list of Facebook
« Reply #2 on: January 25, 2013, 02:43:58 PM »
pls share your code
Worked on Doc&DogAge Of Fury 3D. Actually working on WarMach.

badawe

  • Jr. Member
  • **
  • Thank You
  • -Given: 8
  • -Receive: 7
  • Posts: 70
    • View Profile
Re: What is the best approach for a friends list of Facebook
« Reply #3 on: January 28, 2013, 10:49:17 AM »
Sure! I just need the ArenaMonk help me solve this little Depth burn issue and is ready!

Is extrem light to run on devices, i get my friendlist with more than 1300 friends, and don't even a single lag!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Infinite DraggablePanel for Facebook Friends (Buffer Bug?!)
« Reply #4 on: January 28, 2013, 02:36:56 PM »
No idea who this ArenMonk guy is. :P

You are repositioning the panel while also dragging it? The two position movements conflict.

badawe

  • Jr. Member
  • **
  • Thank You
  • -Given: 8
  • -Receive: 7
  • Posts: 70
    • View Profile
Re: Infinite DraggablePanel for Facebook Friends (Buffer Bug?!)
« Reply #5 on: January 28, 2013, 03:26:38 PM »
AUHAUH Sorry @ArenaMook, but if you play Diablo you already have the best name for your monk :D

Basically i only move the Panel, never move the childs, do you give a look in this video:

http://www.youtube.com/watch?v=CYba0-4YMfk

sorry about the demo :D

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Infinite DraggablePanel for Facebook Friends (Buffer Bug?!)
« Reply #6 on: January 28, 2013, 09:09:51 PM »
Well, like I said -- you have two position-adjusting scripts that likely fight with each other.

badawe

  • Jr. Member
  • **
  • Thank You
  • -Given: 8
  • -Receive: 7
  • Posts: 70
    • View Profile
Re: Infinite DraggablePanel for Facebook Friends (Buffer Bug?!)
« Reply #7 on: January 29, 2013, 06:41:54 AM »
But ArenaMook, the only thing we move is the draggablePanel with this function:

  1. void UpdateItens ()
  2. {
  3. //Just update to see if the top iten was been displayed right
  4.         this.name = "Top Iten is: "+currentTopDisplayItem;
  5.         for(int i = 0; i < displayList.Length; i++)
  6.         {
  7. //This FriendDisplay is just a prefab with a some labels and background
  8.                 FriendDisplay tFD = displayList[i];
  9. //Set the data, and update
  10.                 tFD.SetFriendData(_actualList[ currentTopDisplayItem + i]);
  11.         }
  12.         dragPannel.panel.Refresh();
  13. }
  14. private void MovePanelUp ()
  15. {
  16.         if(currentTopDisplayItem > 0)
  17.         {
  18.                 currentTopDisplayItem--;
  19.                 UpdateItens();
  20.                 dragPannel.MoveRelative(new Vector3(0, 115, 0));
  21.         }
  22. }
  23.  
  24. private void MovePanelDown()
  25. {
  26.         if(currentTopDisplayItem < _actualList.Count)
  27.         {
  28.                 currentTopDisplayItem++;
  29.                 UpdateItens();
  30.                 dragPannel.MoveRelative(new Vector3(0, -115, 0));
  31.         }
  32. }
  33. private void CheckPosition()
  34. {
  35.         if(!_wasPopulated)
  36.                 return;
  37.        
  38.         if(displayList[_maxItens-1].playerData != _actualList[_actualList.Count-1])
  39.         {
  40.                 if(dragPannel.transform.localPosition.y > 377)
  41.                 {
  42.                         MovePanelDown();
  43.                 }
  44.         }
  45.         if(currentTopDisplayItem > 0)
  46.         {
  47.                 if(dragPannel.transform.localPosition.y < 262)
  48.                 {
  49.                         MovePanelUp();
  50.                 }
  51.         }
  52. }
  53. // Update is called once per frame
  54. void Update ()
  55. {
  56.         CheckPosition();
  57. }
  58.  

And this how I update the text

  1. public void SetFriendData (FriendsData pFriendData)
  2.         {
  3.                 playerData = pFriendData;
  4.                 playerName.text = "";
  5.                 playerName.text = pFriendData.userName;
  6.                 playerName.MarkAsChanged();
  7.                 playerName.Update();
  8.         }



In the editor, works perfect! but in the device this is what I see:


I really don't get it, when you tell
  1. - you have two position-adjusting scripts that likely fight with each other.

This is not what is going on, for what I see =/

Gregzo

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 64
    • View Profile
Re: Infinite DraggablePanel for Facebook Friends (Buffer Bug?!)
« Reply #8 on: January 29, 2013, 04:02:27 PM »
Hi,
I've recently coded a picker that could suit your needs. http://www.tasharen.com/forum/index.php?topic=2911.0.
Recycling objects in the picker, one at a time, only 2 more objects than displayed needed.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Infinite DraggablePanel for Facebook Friends (Buffer Bug?!)
« Reply #9 on: January 29, 2013, 04:14:24 PM »
Your pic suggests a completely different issue: turn off depth on your UIPanels.

IZLogic

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 8
    • View Profile
    • IZLogic!
Re: Infinite DraggablePanel for Facebook Friends (Buffer Bug?!)
« Reply #10 on: March 04, 2013, 10:06:41 AM »
Hello badawe!
I used your infinity draggable panel script, and I modified it to my needs. It is working well if I don't use a spring&momentum drag effect. When I use the spring and momentum effect if I drag too much it is start scrolling down through all the values of the list untill reaching the end. Did you facing this issue also? Any idea of fix?
I understood that the problem is the interaction of NGUI SpringPanel script with yours.
Seems that after a big drag the SpringPanel set the dragPannel.transform.localPosition.y > upLimit (in your case was 377) so the condition is always true in your script until we drag on the opposite side of scrolling direction or reaching the end of the list.
Off curse we have the same issue also for the Up scrolling.
I'm stuck on this cause I don't know how to bypass the SpringPanel or how to handle this condition in your script.
Thanks.
« Last Edit: March 04, 2013, 10:10:53 AM by IZLogic »