void UpdateItens ()
{
//Just update to see if the top iten was been displayed right
this.name = "Top Iten is: "+currentTopDisplayItem;
for(int i = 0; i < displayList.Length; i++)
{
//This FriendDisplay is just a prefab with a some labels and background
FriendDisplay tFD = displayList[i];
//Set the data, and update
tFD.SetFriendData(_actualList[ currentTopDisplayItem + i]);
}
dragPannel.panel.Refresh();
}
private void MovePanelUp ()
{
if(currentTopDisplayItem > 0)
{
currentTopDisplayItem--;
UpdateItens();
dragPannel
.MoveRelative(new Vector3
(0,
115,
0)); }
}
private void MovePanelDown()
{
if(currentTopDisplayItem < _actualList.Count)
{
currentTopDisplayItem++;
UpdateItens();
dragPannel
.MoveRelative(new Vector3
(0,
-115,
0)); }
}
private void CheckPosition()
{
if(!_wasPopulated)
return;
if(displayList[_maxItens-1].playerData != _actualList[_actualList.Count-1])
{
if(dragPannel.transform.localPosition.y > 377)
{
MovePanelDown();
}
}
if(currentTopDisplayItem > 0)
{
if(dragPannel.transform.localPosition.y < 262)
{
MovePanelUp();
}
}
}
// Update is called once per frame
void Update ()
{
CheckPosition();
}